美文网首页
根据科室病种选数据

根据科室病种选数据

作者: AI_Finance | 来源:发表于2019-07-27 14:36 被阅读0次

根据科室病种选择完成病例数据:

select part3.*, ppd.disease_name from
(
    select part1.uuid, part1.record_name, part1.attribute_name, part1.progress_content, part2.patient_age, part2.patient_age_type, 
                 part2.patient_gender, part2.inpatient_department from 
    (
            select uuid, record_name, attribute_name, progress_content from
                            (
                                            select concat(customer_id,'-',record_id) as uuid, record_type_id, msda.attribute_name, progress_content
                                            from pt_patient_progress ppp
                                            join ms_dictionary_attribute msda
                                            on ppp.dictionary_attribute_id = msda.id where customer_id=1285
                            ) result_attr
             join ms_system_record_type msr
             on result_attr.record_type_id = msr.record_type
             where record_name in ("入院记录", "出院小结", "首次病程")
     ) as part1
    join 
    (
            select uuid, patient_age, patient_age_type, patient_gender, inpatient_department  
            from hmcdss2_xmzs_0520.mt_patient_record 
            where inpatient_department like "%儿科%" 
    ) as part2
    on  part1.uuid=part2.uuid
) as part3
join pt_patient_disease as ppd
on concat(ppd.customer_id, "-", record_id)=part3.uuid
where ppd.profile_part_type=22 and ppd.disease_name="肺炎"

根据病种查询症状特征

select dis.disease_id, dis.disease_name, dis.symptom_id, s.name as "症状", dis.symptom_relevance, dis.use_for_recall
from
(
    select ds.disease_id, ds.symptom_id, ds.symptom_relevance, d.disease_name, ds.use_for_recall
    from disease_symptom_mapping as ds
    inner join disease as d
    on d.id=ds.disease_id where ds.type in (3, 4) and d.disease_name="胸膜炎"
) as dis
inner join symptom as s
on dis.symptom_id=s.id

按照uuid取病例,目前使用的库是盘古库

select part1.uuid, part1.record_name, part1.attribute_name, part1.progress_content, part2.patient_age, part2.patient_age_type, 
                     part2.patient_gender, part2.inpatient_department from 
        (
                select uuid, record_name, attribute_name, progress_content from
                                (
                                                select concat(customer_id,'-',record_id) as uuid, record_type_id, msda.attribute_name, progress_content
                                                from pt_patient_progress ppp
                                                join ms_dictionary_attribute msda
                                                on ppp.dictionary_attribute_id = msda.id
                                ) result_attr
                 join ms_system_record_type msr
                 on result_attr.record_type_id = msr.record_type
         ) as part1
         join 
        (
                select uuid, patient_age, patient_age_type, patient_gender, inpatient_department  
                from hmcdss2_xw_0716.mt_patient_record
        ) as part2
        on  part1.uuid=part2.uuid
        where part2.uuid in 
        (
    '1172-1037108'
        )

相关文章

网友评论

      本文标题:根据科室病种选数据

      本文链接:https://www.haomeiwen.com/subject/lrherctx.html