select a.hisid, b.blnr, a.jlsj, c.zs, d.tw, e.mb, f.hx, g.xy, f.cbzd
from (select a.mr_id,
e.住院号 || '_' || e.主页id as hisid,
to_char(a.Create_Time, 'yyyy-mm-dd hh24:mi') as jlsj
from MEDICAL_REC a,
MR_TEMPLATE c,
BASECONFIG.PAT_VISIT_INFO d,
病案主页@to_his e,
MEDICAL_REC_CONTENT f
where a.Template_Id = c.Template_Id
and a.status <> -1
and c.template_name like '%入院记录%'
and c.is_enable = 1
and a.pat_visit_info_id = d.pat_visit_info_id
and d.pat_id = e.病人id
and d.visit_id = e.主页id
and a.mr_id = f.mr_id) a
left join (select t.mr_id, a.SUBSTR(t.section_content, 1000, 1)) as blnr
from MR_SECTION_CONTENT t
where t.section_id = '7CBF1A9E-35AB-47E2-B95B-7580703773DB') b on a.mr_id =b.mr_id
left join (select t.mr_id, TO_CHAR(t.section_content) as zs
from MR_SECTION_CONTENT t
where t.section_id = '14A6846E-C050-494C-A0D5-61C802A68928') c on a.mr_id =c.mr_id
left join (select t.mr_id, TO_CHAR(t.section_content) as tw
from MR_SECTION_CONTENT t
where t.section_id = 'ee96553d-6b50-42a9-a084-ae327d781145') d on a.mr_id =d.mr_id
left join (select t.mr_id, TO_CHAR(t.section_content) as mb
from MR_SECTION_CONTENT t
where t.section_id = '8f637358-9d1a-4b90-8893-bdf706d5bab0') e on a.mr_id =e.mr_id
left join (select t.mr_id, TO_CHAR(t.section_content) as hx
from MR_SECTION_CONTENT t
where t.section_id = 'f6477075-850e-4507-8c4f-5b5cb8a4f33e') f on a.mr_id =f.mr_id
left join (select t.mr_id, TO_CHAR(t.section_content) as xy
from MR_SECTION_CONTENT t
where t.section_id = 'd545b27d-6c9e-4685-a326-0682798ebc51') g on a.mr_id =g.mr_id
left join (select t.mr_id, TO_CHAR(t.section_content) as cbzd
from MR_SECTION_CONTENT t
where t.section_id = '43D2193E-431E-4EA8-A7EF-48FE666C7330') f on a.mr_id = f.mr_id