SELECT
ps.id, substring(ps.begin_end_time,2,LENGTH(ps.begin_end_time)-2) as beginEndTime , SUBSTRING_INDEX(SUBSTRING_INDEX(substring(ps.dates,2,LENGTH(ps.dates)-2),',',s.id+1),',',-1) AS dates
, SUBSTRING_INDEX(SUBSTRING_INDEX(ps.state,',',s.id+1),',',-1) AS state
-- , ps.agent,ps.remarks,pt.name as ptname,bed.bed_number as bedNumber,dd.label,ps.dates as arrDates,
-- ps.dict_detail_id as dictDetailId,ps.synchronize_others as synchronizeOthers
FROM
sl_patient_schedule as ps
JOIN sequence s ON s.id <(
LENGTH(ps.dates) - LENGTH(REPLACE(ps.dates,',','')) + 1
)
INNER JOIN sl_patient as pt on ps.patient_id=pt.id
LEFT JOIN sl_patient_bed_relation as pbr on pbr.patient_id=pt.id
LEFT JOIN sl_bed_info as bed on bed.id=pbr.bed_id
LEFT JOIN dict_detail as dd on dd.id=ps.dict_detail_id
where 1=1
![在这里插入图片描述](https://img-blog.csdnimg.cn/6dcbefa9e001428d8fcb278c763bc487.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAQ3hUb0Jq,size_20,color_FFFFFF,t_70,g_se,x_16)
mysql分隔日期
最新推荐文章于 2024-07-14 03:55:23 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)