Просмотр исходного кода

湘雅合格不合格病历sql逻辑调整

chengyao 3 лет назад
Родитель
Сommit
4805228a31
1 измененных файлов с 3 добавлено и 111 удалено
  1. 3 111
      src/main/resources/mapper/BehospitalInfoMapper.xml

+ 3 - 111
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -12930,111 +12930,9 @@
         LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
         AND t1.behospital_code = t2.behospital_code
         AND t2.is_deleted = 'N'
-        ) t,
-        (
-        SELECT
-        a.beh_dept_id AS deptId,
-        a.beh_dept_name AS deptName
-        FROM
-        med_behospital_info a,
-        med_home_page b,
-        med_qcresult_cases c,
-        med_qcresult_detail d,
-        qc_cases_entry e
-        WHERE
-        a.is_deleted = 'N'
-        AND b.is_deleted = 'N'
-        AND c.is_deleted = 'N'
-        AND d.is_deleted = 'N'
-        AND e.is_deleted = 'N'
-        AND a.hospital_id = b.hospital_id
-        AND a.hospital_id = c.hospital_id
-        AND a.hospital_id = d.hospital_id
-        AND a.behospital_code = b.behospital_code
-        AND a.behospital_code = c.behospital_code
-        AND a.behospital_code = d.behospital_code
-        AND c.cases_id = d.cases_id
-        AND d.cases_id = e.cases_id
-        AND d.cases_entry_id = e.id
-        AND d.cases_id = 243
-        AND a.qc_type_id != 0
-                <if test="qcResultPageVO.titleName != null ">
-                    <if test="qcResultPageVO.titleName == '不合格数'">
-                        AND c.`level`='不合格'
-                    </if>
-                    <if test="qcResultPageVO.titleName == '合格数'">
-                        AND c.`level`='合格'
-                    </if>
-                </if>
-        <if test="qcResultPageVO.isPlacefile != null and qcResultPageVO.isPlacefile != ''">
-            and a.is_placefile = #{qcResultPageVO.isPlacefile}
-        </if>
-        <if test="qcResultPageVO.hospitalId != null and qcResultPageVO.hospitalId != ''">
-            AND a.hospital_id = #{qcResultPageVO.hospitalId}
-        </if>
-        <if test="qcResultPageVO.isPlacefile != null and qcResultPageVO.isPlacefile == 0">
-            <if test="qcResultPageVO.startDate != null ">
-                <![CDATA[ AND a.behospital_date >= #{qcResultPageVO.startDate}]]>
-            </if>
-            <if test="qcResultPageVO.endDate != null ">
-                <![CDATA[ AND a.behospital_date <= #{qcResultPageVO.endDate}]]>
-            </if>
-        </if>
-        <if test="qcResultPageVO.isPlacefile != null and qcResultPageVO.isPlacefile == 1">
-            <if test="qcResultPageVO.startDate != null ">
-                <![CDATA[ AND a.leave_hospital_date >= #{qcResultPageVO.startDate}]]>
-            </if>
-            <if test="qcResultPageVO.endDate != null">
-                <![CDATA[ AND a.leave_hospital_date <= #{qcResultPageVO.endDate}]]>
-            </if>
-        </if>
-        <if test="qcResultPageVO.diagnose != null and qcResultPageVO.diagnose != ''">
-            AND a.diagnose LIKE CONCAT( '%', #{qcResultPageVO.diagnose}, '%' )
-        </if>
-        <if test="qcResultPageVO.deptName != null and qcResultPageVO.deptName != ''">
-            AND a.beh_dept_name LIKE CONCAT( '%', #{qcResultPageVO.deptName}, '%' )
-        </if>
-        <if test="qcResultPageVO.deptId != null and qcResultPageVO.deptId != ''">
-            AND a.beh_dept_id = #{qcResultPageVO.deptId}
-        </if>
-        <if test="qcResultPageVO.doctorId != null and qcResultPageVO.doctorId != ''">
-            AND a.doctor_id = #{qcResultPageVO.doctorId}
-        </if>
-        <if test="qcResultPageVO.behospitalCode != null and qcResultPageVO.behospitalCode != ''">
-            AND a.behospital_code LIKE CONCAT( '%', #{qcResultPageVO.behospitalCode}, '%' )
-        </if>
-        <if test="qcResultPageVO.patName != null and qcResultPageVO.patName != ''">
-            AND a.NAME LIKE CONCAT( '%', #{qcResultPageVO.patName}, '%' )
-        </if>
-        <if test="qcResultPageVO.doctorName != null and qcResultPageVO.doctorName != ''">
-            AND (case
-            when b.attending_doctor != '' and b.attending_doctor is not null then b.attending_doctor
-            when (b.attending_doctor = '' or b.attending_doctor is null) and
-            b.director_doctor != '' and b.director_doctor is not null
-            then b.director_doctor
-            when (b.attending_doctor = '' or b.attending_doctor is null) and
-            (b.director_doctor = '' or b.director_doctor is null) and
-            b.behospital_doctor != '' and b.behospital_doctor is not null
-            then b.behospital_doctor end) LIKE CONCAT( '%', #{qcResultPageVO.doctorName}, '%' )
-        </if>
-        <if test="qcResultPageVO.professor != null and qcResultPageVO.professor != ''">
-            AND (case
-            when b.attending_doctor != '' and b.attending_doctor is not null then '主治医师'
-            when (b.attending_doctor = '' or b.attending_doctor is null) and
-            b.director_doctor != '' and b.director_doctor is not null
-            then '主任医师'
-            when (b.attending_doctor = '' or b.attending_doctor is null) and
-            (b.director_doctor = '' or b.director_doctor is null) and
-            b.behospital_doctor != '' and b.behospital_doctor is not null
-            then '住院医师' end) = #{qcResultPageVO.professor}
-        </if>
-        GROUP BY
-        a.beh_dept_id,
-        a.beh_dept_name
-        ) t2
+        ) t
         where
-        t.behDeptId = t2.deptId
-        AND t.behDeptName = t2.deptName
+        1=1
         <if test="qcResultPageVO.checkStatus != null">
             AND t.checkStatus = #{qcResultPageVO.checkStatus}
         </if>
@@ -14258,7 +14156,6 @@
         FROM
         med_behospital_info a,
         med_home_page b,
-        med_qcresult_detail k,
         med_qcresult_cases c,
         qc_cases_entry d
         WHERE
@@ -14270,12 +14167,7 @@
         AND a.hospital_id = c.hospital_id
         AND a.behospital_code = b.behospital_code
         AND a.behospital_code = c.behospital_code
-        AND c.cases_id = d.cases_id
-        AND a.hospital_id = k.hospital_id
-        AND a.behospital_code = k.behospital_code
-        AND c.cases_id = k.cases_id
-        AND k.cases_id = d.cases_id
-        AND k.cases_entry_id = d.id
+        AND c.cases_id = 243
                 <if test="qcResultShortPageVO.titleName != null ">
                     <if test="qcResultShortPageVO.titleName == '不合格数'">
                         AND c.`level`='不合格'