|
@@ -804,55 +804,55 @@
|
|
|
<!-- 手术人数统计-全院-首页 -->
|
|
|
<select id="operationMap" parameterType="com.diagbot.vo.FilterVO" resultType="map">
|
|
|
select count(1) ss,sum(a) four,sum(if(a>1,0,b)) three,sum(if(a+b>1,0,c)) two,sum(if(a+b+c>1,0,d)) one from (
|
|
|
- SELECT a.behospital_code,if(g.ssdj ='四级手术',1,0) a,if(g.ssdj ='三级手术',1,0) b,if(g.ssdj ='二级手术',1,0) c,if(g.ssdj ='一级手术',1,0) d
|
|
|
+ SELECT a.behospital_code,if(LOCATE('四级手术',f.ssdj) >0,1,0) a,if(LOCATE('三级手术',f.ssdj) >0,1,0) b,if(LOCATE('二级手术',f.ssdj) >0 ,1,0) c,if(LOCATE('一级手术',f.ssdj) >0,1,0) d
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
- med_medical_record c,
|
|
|
- qc_mode d,
|
|
|
med_home_page e,
|
|
|
- med_home_operation_info f,
|
|
|
- kl_operative_9 g
|
|
|
+ med_home_operation_info f
|
|
|
WHERE a.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND d.is_deleted = 'N'
|
|
|
AND e.is_deleted = 'N'
|
|
|
AND f.is_deleted = 'N'
|
|
|
- AND a.hospital_id = c.hospital_id
|
|
|
- AND a.behospital_code = c.behospital_code
|
|
|
- AND c.mode_id = d.id
|
|
|
AND a.hospital_id = e.hospital_id
|
|
|
AND a.hospital_id = f.hospital_id
|
|
|
AND a.behospital_code = e.behospital_code
|
|
|
AND e.home_page_id = f.home_page_id
|
|
|
- AND f.operation_name=g.ssmc AND g.lbbm='04'
|
|
|
- <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
- and a.is_placefile = #{isPlacefile}
|
|
|
- </if>
|
|
|
- AND d.`name` = '手术记录'
|
|
|
- <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
- <if test="hospitalId != null and hospitalId != ''">
|
|
|
- AND a.hospital_id = #{hospitalId}
|
|
|
- </if>
|
|
|
- <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
+ and f.operation_code is not null and f.operation_code !='[]'
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
group by a.behospital_code
|
|
|
) a where a+b+c+d >0
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
+ <!-- 预处理病案首页手术数据 -->
|
|
|
+ <update id="preHomeOperation" >
|
|
|
+ update med_home_operation_info a,(select home_page_id,GROUP_CONCAT(g.ssdj) ssdj
|
|
|
+ from med_home_operation_info f
|
|
|
+ left join kl_operative_9 g on LOCATE(g.ssbm,f.operation_code) >0 and (lbbm='04' or lbbm='03')
|
|
|
+ where f.operation_code is not null and f.operation_code !='[]' and (f.flag =0 or f.flag is null)
|
|
|
+ group by home_page_id
|
|
|
+ ) b set a.ssdj=b.ssdj,a.flag=1 where a.home_page_id=b.home_page_id
|
|
|
+ </update>
|
|
|
|
|
|
<!-- 入院人数统计-首页 -->
|
|
|
<select id="beHosCount" parameterType="com.diagbot.vo.FilterVO"
|
|
@@ -5242,245 +5242,179 @@
|
|
|
</select>
|
|
|
<!-- 离院病人评分详情页-->
|
|
|
<select id="leaveHosMRPage" resultType="com.diagbot.dto.QcResultShortDTO">
|
|
|
- SELECT DISTINCT
|
|
|
- t.*
|
|
|
+ SELECT DISTINCT t.*
|
|
|
<if test='qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == "1" and qcResultShortPageVO.hospitalId == "7"'>
|
|
|
,
|
|
|
GROUP_CONCAT(case when t4.operation_doctor_id is not null then t4.operation_doctor_id else '' end separator ',') AS operationDoctorName,
|
|
|
- GROUP_CONCAT(if(tx.ssdj is null,'',tx.ssdj) separator ',') AS operationLevel
|
|
|
+ t4.ssdj AS operationLevel
|
|
|
</if>
|
|
|
FROM
|
|
|
(SELECT
|
|
|
- t1.hospital_id AS hospitalId,
|
|
|
- t1.behospital_code AS behospitalCode,
|
|
|
- t1.bed_code AS bedCode,
|
|
|
- t1.LEVEL AS LEVEL,
|
|
|
- t1.grade_type AS gradeType,
|
|
|
- t1.score_res AS scoreRes,
|
|
|
- t1.scoreBn,
|
|
|
- t1.NAME AS NAME,
|
|
|
- t1.sex AS sex,
|
|
|
- t1.beh_dept_id AS behDeptId,
|
|
|
- t1.beh_dept_name AS behDeptName,
|
|
|
- t1.doctor_id AS doctorId,
|
|
|
- t1.doctor_name AS doctorName,
|
|
|
- t1.beh_doctor_id AS behDoctorId,
|
|
|
- t1.beh_doctor_name AS behDoctorName,
|
|
|
- t1.director_doctor_id AS directorDoctorId,
|
|
|
- t1.director_doctor_name AS directorDoctorName,
|
|
|
- t1.birthday AS birthday,
|
|
|
- t1.behospital_date AS behospitalDate,
|
|
|
- t1.leave_hospital_date AS leaveHospitalDate,
|
|
|
- t1.placefile_date AS placefileDate,
|
|
|
- t1.gmt_create AS gradeTime,
|
|
|
- t1.diagnose,
|
|
|
- t1.ward_name AS wardName,
|
|
|
- t1.checkStatus,
|
|
|
- t1.mrStatus,
|
|
|
- t1.chName,
|
|
|
- t1.mrName,
|
|
|
- t1.chTime,
|
|
|
- t1.mrTime,
|
|
|
- <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==2">
|
|
|
- CONCAT( ifnull(t2.age,'') ,ifnull(t2.age_unit,'') )as age,
|
|
|
- </if>
|
|
|
- t1.file_code AS fileCode,
|
|
|
- t1.is_daytime as isDaytime
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT be.*,
|
|
|
- ifnull(mci.status,0) AS checkStatus,
|
|
|
- ifnull(hm_mci.status,0) AS mrStatus,
|
|
|
- mci.check_name as chName,
|
|
|
- e.score_res as scoreBn,
|
|
|
- hm_mci.check_name as mrName,
|
|
|
- mci.gmt_create as chTime,
|
|
|
- hm_mci.gmt_create as mrTime
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT DISTINCT
|
|
|
- tt1.*
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- b.*,
|
|
|
- ifnull(c.LEVEL,'未评分') as LEVEL ,
|
|
|
- c.grade_type,
|
|
|
- c.score_res,
|
|
|
- c.gmt_create
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT DISTINCT
|
|
|
- a.hospital_id,
|
|
|
- a.behospital_code,
|
|
|
- a.bed_code,
|
|
|
- a.NAME,
|
|
|
- a.sex,
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name,
|
|
|
- a.birthday,
|
|
|
- a.behospital_date,
|
|
|
- a.leave_hospital_date,
|
|
|
- a.doctor_id,
|
|
|
- a.doctor_name,
|
|
|
- a.beh_doctor_id,
|
|
|
- a.beh_doctor_name,
|
|
|
- a.director_doctor_id,
|
|
|
- a.director_doctor_name,
|
|
|
- a.diagnose,
|
|
|
- a.placefile_date,
|
|
|
- a.ward_name,
|
|
|
- a.file_code,
|
|
|
- a.is_daytime
|
|
|
- FROM
|
|
|
- med_behospital_info a
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND a.qc_type_id != 0
|
|
|
- <if test="qcResultShortPageVO.isDaytime != null and qcResultShortPageVO.isDaytime != ''">
|
|
|
- and a.is_daytime = #{qcResultShortPageVO.isDaytime}
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
|
|
|
- and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
|
|
|
- AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 0">
|
|
|
- <if test="qcResultShortPageVO.startDate != null ">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{qcResultShortPageVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.endDate != null ">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{qcResultShortPageVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 1">
|
|
|
- <if test="qcResultShortPageVO.startDate != null ">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{qcResultShortPageVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.endDate != null">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{qcResultShortPageVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.diagnose != null and qcResultShortPageVO.diagnose != ''">
|
|
|
- AND a.diagnose LIKE CONCAT( '%', #{qcResultShortPageVO.diagnose}, '%' )
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
|
|
|
- AND a.beh_dept_name = #{qcResultShortPageVO.deptName}
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
|
|
|
- AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
|
|
|
- AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
|
|
|
- AND (a.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
- OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
- OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
|
|
|
- AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
- OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
- OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
|
|
|
- </if>
|
|
|
- ) b
|
|
|
- LEFT JOIN med_qcresult_info c ON c.is_deleted = 'N'
|
|
|
- AND b.hospital_id = c.hospital_id
|
|
|
- AND b.behospital_code = c.behospital_code
|
|
|
- ) tt1
|
|
|
- <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==3">
|
|
|
- ,med_medical_record tt2,
|
|
|
- qc_mode tt3
|
|
|
- WHERE
|
|
|
- tt2.is_deleted = 'N'
|
|
|
- AND tt3.is_deleted = 'N'
|
|
|
- AND tt1.hospital_id = tt2.hospital_id
|
|
|
- AND tt1.behospital_code = tt2.behospital_code
|
|
|
- AND tt2.mode_id = tt3.id
|
|
|
- AND tt3.`name` = '手术记录'
|
|
|
- </if>
|
|
|
- ) be
|
|
|
- left join med_check_info mci
|
|
|
- on mci.is_deleted = 'N'
|
|
|
- and mci.check_type in(0,2)
|
|
|
- and be.hospital_id = mci.hospital_id
|
|
|
- and be.behospital_code = mci.behospital_code
|
|
|
- left join med_check_info hm_mci
|
|
|
- on hm_mci.is_deleted = 'N'
|
|
|
- and hm_mci.check_type = 1
|
|
|
- and be.hospital_id = hm_mci.hospital_id
|
|
|
- and be.behospital_code = hm_mci.behospital_code
|
|
|
- LEFT JOIN med_qcresult_cases e
|
|
|
- on be.behospital_code = e.behospital_code
|
|
|
- and be.hospital_id = e.hospital_id
|
|
|
- AND e.is_deleted = 'N'
|
|
|
- and e.cases_id = 243
|
|
|
- )t1
|
|
|
- <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==2">
|
|
|
- ,med_home_page t2
|
|
|
- WHERE
|
|
|
- t2.is_deleted = 'N'
|
|
|
- AND t1.hospital_id = t2.hospital_id
|
|
|
- AND t1.behospital_code = t2.behospital_code
|
|
|
- AND (
|
|
|
- ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-'AND t2.newborn_day != '—' )
|
|
|
- OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-'AND t2.newborn_month != '—' )
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">
|
|
|
- , med_medical_record b,
|
|
|
- med_medical_record_content c,
|
|
|
- med_home_page t2
|
|
|
- WHERE
|
|
|
- b.is_deleted = 'N'
|
|
|
- and c.is_deleted = 'N'
|
|
|
- and t2.is_deleted = 'N'
|
|
|
- and t1.hospital_id = b.hospital_id
|
|
|
- and t1.hospital_id = c.hospital_id
|
|
|
- and t1.hospital_id = t2.hospital_id
|
|
|
- AND t1.behospital_code = b.behospital_code
|
|
|
- AND t1.behospital_code = t2.behospital_code
|
|
|
- AND b.rec_id = c.rec_id
|
|
|
- and b.mode_id = '24'
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==4">
|
|
|
- ,med_home_page t2
|
|
|
- WHERE
|
|
|
- t2.is_deleted = 'N'
|
|
|
- AND t1.hospital_id = t2.hospital_id
|
|
|
- AND t1.behospital_code = t2.behospital_code
|
|
|
- AND t2.leave_hospital_type = '非医嘱离院'
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.leaveHosType == null or qcResultShortPageVO.leaveHosType == 0 or qcResultShortPageVO.leaveHosType == 3">
|
|
|
- LEFT JOIN med_home_page t2 ON t2.is_deleted = 'N'
|
|
|
- AND t1.hospital_id = t2.hospital_id
|
|
|
- AND t1.behospital_code = t2.behospital_code
|
|
|
- </if>
|
|
|
- <if test='qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType == 6 and qcResultShortPageVO.hospitalId == "7"'>
|
|
|
- ,med_home_page t2
|
|
|
- WHERE
|
|
|
- t2.is_deleted = 'N'
|
|
|
- AND t1.hospital_id = t2.hospital_id
|
|
|
- AND t1.behospital_code = t2.behospital_code
|
|
|
- AND
|
|
|
- ( t2.blood_fee != 0
|
|
|
- or t2.blood_fee != 0.00
|
|
|
- or t2.blood_fee != null
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test='qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType == 7 and qcResultShortPageVO.hospitalId == "7"'>
|
|
|
- ,med_home_page t2
|
|
|
- WHERE
|
|
|
- t2.is_deleted = 'N'
|
|
|
- AND t1.hospital_id = t2.hospital_id
|
|
|
- AND t1.behospital_code = t2.behospital_code
|
|
|
- and t1.diagnose_icd like 'C%'
|
|
|
- </if>
|
|
|
- )t
|
|
|
+ t1.hospital_id AS hospitalId,
|
|
|
+ t1.behospital_code AS behospitalCode,
|
|
|
+ t1.bed_code AS bedCode,
|
|
|
+ t1.LEVEL AS LEVEL,
|
|
|
+ t1.grade_type AS gradeType,
|
|
|
+ t1.score_res AS scoreRes,
|
|
|
+ t1.scoreBn,
|
|
|
+ t1.NAME AS NAME,
|
|
|
+ t1.sex AS sex,
|
|
|
+ t1.beh_dept_id AS behDeptId,
|
|
|
+ t1.beh_dept_name AS behDeptName,
|
|
|
+ t1.doctor_id AS doctorId,
|
|
|
+ t1.doctor_name AS doctorName,
|
|
|
+ t1.beh_doctor_id AS behDoctorId,
|
|
|
+ t1.beh_doctor_name AS behDoctorName,
|
|
|
+ t1.director_doctor_id AS directorDoctorId,
|
|
|
+ t1.director_doctor_name AS directorDoctorName,
|
|
|
+ t1.birthday AS birthday,
|
|
|
+ t1.behospital_date AS behospitalDate,
|
|
|
+ t1.leave_hospital_date AS leaveHospitalDate,
|
|
|
+ t1.placefile_date AS placefileDate,
|
|
|
+ t1.gmt_create AS gradeTime,
|
|
|
+ t1.diagnose,
|
|
|
+ t1.ward_name AS wardName,
|
|
|
+ t1.checkStatus,
|
|
|
+ t1.mrStatus,
|
|
|
+ t1.chName,
|
|
|
+ t1.mrName,
|
|
|
+ t1.chTime,
|
|
|
+ t1.mrTime,
|
|
|
+ <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==2">
|
|
|
+ CONCAT( ifnull(t2.age,'') ,ifnull(t2.age_unit,'') )as age,
|
|
|
+ </if>
|
|
|
+ t1.file_code AS fileCode,
|
|
|
+ t1.is_daytime as isDaytime
|
|
|
+ FROM(
|
|
|
+ SELECT
|
|
|
+ be.*,
|
|
|
+ ifnull(mci.status,0) AS checkStatus,
|
|
|
+ ifnull(hm_mci.status,0) AS mrStatus,
|
|
|
+ mci.check_name as chName,
|
|
|
+ e.score_res as scoreBn,
|
|
|
+ hm_mci.check_name as mrName,
|
|
|
+ mci.gmt_create as chTime,
|
|
|
+ hm_mci.gmt_create as mrTime
|
|
|
+ FROM(
|
|
|
+ SELECT DISTINCT tt1.*
|
|
|
+ FROM(
|
|
|
+ SELECT
|
|
|
+ b.*,
|
|
|
+ ifnull(c.LEVEL,'未评分') as LEVEL ,
|
|
|
+ c.grade_type,
|
|
|
+ c.score_res,
|
|
|
+ c.gmt_create
|
|
|
+ FROM(
|
|
|
+ SELECT
|
|
|
+ DISTINCT a.hospital_id,
|
|
|
+ a.behospital_code,
|
|
|
+ a.bed_code,
|
|
|
+ a.NAME,
|
|
|
+ a.sex,
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.birthday,
|
|
|
+ a.behospital_date,
|
|
|
+ a.leave_hospital_date,
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name,
|
|
|
+ a.beh_doctor_id,
|
|
|
+ a.beh_doctor_name,
|
|
|
+ a.director_doctor_id,
|
|
|
+ a.director_doctor_name,
|
|
|
+ a.diagnose,
|
|
|
+ a.placefile_date,
|
|
|
+ a.ward_name,
|
|
|
+ a.file_code,
|
|
|
+ a.is_daytime
|
|
|
+ FROM med_behospital_info a
|
|
|
+ WHERE a.is_deleted = 'N' AND a.qc_type_id != 0
|
|
|
+ <if test="qcResultShortPageVO.isDaytime != null and qcResultShortPageVO.isDaytime != ''">
|
|
|
+ and a.is_daytime = #{qcResultShortPageVO.isDaytime}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 0">
|
|
|
+ <if test="qcResultShortPageVO.startDate != null ">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{qcResultShortPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.endDate != null ">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{qcResultShortPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 1">
|
|
|
+ <if test="qcResultShortPageVO.startDate != null ">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{qcResultShortPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.endDate != null">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{qcResultShortPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.diagnose != null and qcResultShortPageVO.diagnose != ''">
|
|
|
+ AND a.diagnose LIKE CONCAT( '%', #{qcResultShortPageVO.diagnose}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name = #{qcResultShortPageVO.deptName}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
|
|
|
+ AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
|
|
|
+ AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
|
|
|
+ AND (a.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
+ OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
+ OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
|
|
|
+ AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
+ OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
+ OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
|
|
|
+ </if>
|
|
|
+ ) b
|
|
|
+ LEFT JOIN med_qcresult_info c ON c.is_deleted = 'N' AND b.hospital_id = c.hospital_id AND b.behospital_code = c.behospital_code
|
|
|
+ ) tt1
|
|
|
+ <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==3">
|
|
|
+ ,med_medical_record tt2,qc_mode tt3
|
|
|
+ WHERE tt2.is_deleted = 'N' AND tt3.is_deleted = 'N' AND tt1.hospital_id = tt2.hospital_id AND tt1.behospital_code = tt2.behospital_code AND tt2.mode_id = tt3.id AND tt3.`name` = '手术记录'
|
|
|
+ </if>
|
|
|
+ ) be
|
|
|
+ left join med_check_info mci on mci.is_deleted = 'N' and mci.check_type in(0,2) and be.hospital_id = mci.hospital_id and be.behospital_code = mci.behospital_code
|
|
|
+ left join med_check_info hm_mci on hm_mci.is_deleted = 'N' and hm_mci.check_type = 1 and be.hospital_id = hm_mci.hospital_id and be.behospital_code = hm_mci.behospital_code
|
|
|
+ LEFT JOIN med_qcresult_cases e on be.behospital_code = e.behospital_code and be.hospital_id = e.hospital_id AND e.is_deleted = 'N' and e.cases_id = 243
|
|
|
+ )t1
|
|
|
+ <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==2">
|
|
|
+ ,med_home_page t2
|
|
|
+ WHERE t2.is_deleted = 'N' AND t1.hospital_id = t2.hospital_id AND t1.behospital_code = t2.behospital_code AND ( ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-'AND t2.newborn_day != '—' ) OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-'AND t2.newborn_month != '—' ) )
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">
|
|
|
+ , med_medical_record b,med_medical_record_content c, med_home_page t2
|
|
|
+ WHERE b.is_deleted = 'N' and c.is_deleted = 'N' and t2.is_deleted = 'N' and t1.hospital_id = b.hospital_id and t1.hospital_id = c.hospital_id and t1.hospital_id = t2.hospital_id AND t1.behospital_code = b.behospital_code AND t1.behospital_code = t2.behospital_code AND b.rec_id = c.rec_id and b.mode_id = '24'
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==4">
|
|
|
+ ,med_home_page t2
|
|
|
+ WHERE t2.is_deleted = 'N' AND t1.hospital_id = t2.hospital_id AND t1.behospital_code = t2.behospital_code AND t2.leave_hospital_type = '非医嘱离院'
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.leaveHosType == null or qcResultShortPageVO.leaveHosType == 0 or qcResultShortPageVO.leaveHosType == 3">
|
|
|
+ LEFT JOIN med_home_page t2 ON t2.is_deleted = 'N' AND t1.hospital_id = t2.hospital_id AND t1.behospital_code = t2.behospital_code
|
|
|
+ </if>
|
|
|
+ <if test='qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType == 6 and qcResultShortPageVO.hospitalId == "7"'>
|
|
|
+ ,med_home_page t2
|
|
|
+ WHERE t2.is_deleted = 'N' AND t1.hospital_id = t2.hospital_id AND t1.behospital_code = t2.behospital_code AND ( t2.blood_fee != 0 or t2.blood_fee != 0.00 or t2.blood_fee != null )
|
|
|
+ </if>
|
|
|
+ <if test='qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType == 7 and qcResultShortPageVO.hospitalId == "7"'>
|
|
|
+ ,med_home_page t2
|
|
|
+ WHERE t2.is_deleted = 'N' AND t1.hospital_id = t2.hospital_id AND t1.behospital_code = t2.behospital_code
|
|
|
+ and (t2.outpatient_emr_diagnose_code like 'C%')
|
|
|
+ </if>
|
|
|
+ )t
|
|
|
<if test='qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != "" and qcResultShortPageVO.isPlacefile == "1" and qcResultShortPageVO.hospitalId == "7"'>
|
|
|
- ,med_home_page t3
|
|
|
- ,med_home_operation_info t4,kl_operative_9 tx
|
|
|
+ ,med_home_page t3,med_home_operation_info t4
|
|
|
</if>
|
|
|
where 1=1
|
|
|
<if test='qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != "" and qcResultShortPageVO.isPlacefile == "1" and qcResultShortPageVO.hospitalId == "7"'>
|
|
@@ -5488,7 +5422,7 @@
|
|
|
AND t.hospitalId = t4.hospital_id
|
|
|
AND t.behospitalCode = t3.behospital_code
|
|
|
AND t3.home_page_id = t4.home_page_id
|
|
|
- AND t4.operation_name=tx.ssmc AND tx.lbbm='04'
|
|
|
+ and t4.operation_code is not null and t4.operation_code !='[]'
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.checkStatus != null">
|
|
|
and t.checkStatus = #{qcResultShortPageVO.checkStatus}
|
|
@@ -5522,10 +5456,9 @@
|
|
|
AND t4.`operation_doctor_id` like concat('%', #{qcResultShortPageVO.operationDoctor}, '%')
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.operationLevel != null and qcResultShortPageVO.operationLevel != ''">
|
|
|
- AND t4.`operation_level` like concat('%', #{qcResultShortPageVO.operationLevel}, '%')
|
|
|
+ AND t4.ssdj = if(#{qcResultShortPageVO.operationLevel}='1','一级手术',if(#{qcResultShortPageVO.operationLevel}='2','二级手术',if(#{qcResultShortPageVO.operationLevel}='3','三级手术','四级手术')))
|
|
|
</if>
|
|
|
- GROUP BY
|
|
|
- t.behospitalCode
|
|
|
+ GROUP BY t.behospitalCode
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
@@ -10520,32 +10453,36 @@
|
|
|
|
|
|
<!--癌痛患者人数-->
|
|
|
<select id="cancerCount" resultType="int" parameterType="com.diagbot.vo.FilterVO">
|
|
|
- SELECT count(1)
|
|
|
- FROM med_behospital_info a
|
|
|
- WHERE a.is_deleted = 'N' and a.diagnose_icd like 'C%'
|
|
|
- <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
- and a.is_placefile = #{isPlacefile}
|
|
|
- </if>
|
|
|
- AND a.qc_type_id != 0
|
|
|
- <if test="hospitalId != null and hospitalId != ''">
|
|
|
- AND a.hospital_id = #{hospitalId}
|
|
|
- </if>
|
|
|
- <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
+ SELECT count(1) from (
|
|
|
+ select a.behospital_code
|
|
|
+ FROM med_behospital_info a,med_home_page b
|
|
|
+ WHERE a.hospital_id=b.hospital_id and a.behospital_code=b.behospital_code
|
|
|
+ AND a.qc_type_id != 0 and a.is_deleted = 'N' and b.is_deleted = 'N'
|
|
|
+ and (b.outpatient_emr_diagnose_code like 'C%')
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ group by a.behospital_code
|
|
|
+ )a
|
|
|
</select>
|
|
|
|
|
|
<select id="operationBehospitalCode" resultType="String">
|