Browse Source

关键条目缺陷占比-住院超过31日病人数逻辑调整

chengyao 4 years ago
parent
commit
a45cadad87
1 changed files with 29 additions and 4 deletions
  1. 29 4
      src/main/resources/mapper/BehospitalInfoMapper.xml

+ 29 - 4
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -6047,9 +6047,21 @@
         a.beh_dept_name,
         a.beh_dept_id
         FROM
-        med_behospital_info a
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d
         WHERE
         a.is_deleted = 'N'
+        AND b.is_deleted = 'N'
+        AND c.is_deleted = 'N'
+        AND d.is_deleted = 'N'
+        AND a.hospital_id = b.hospital_id
+        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 c.cases_entry_id = d.id
         AND TIMESTAMPDIFF(
         DAY,
         DATE( behospital_date ),
@@ -6561,18 +6573,31 @@
         a.doctor_name
         FROM
         med_behospital_info a,
-        sys_user_dept b
+        med_behospital_info a,
+        med_qcresult_info b,
+        med_qcresult_detail c,
+        qc_cases_entry d,
+        sys_user_dept 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.beh_dept_id = b.dept_id
+        AND a.hospital_id = c.hospital_id
+        AND a.hospital_id = e.hospital_id
+        AND a.behospital_code = b.behospital_code
+        AND a.behospital_code = c.behospital_code
+        AND c.cases_id = d.cases_id
+        AND c.cases_entry_id = d.id
+        AND a.beh_dept_id = e.dept_id
         AND TIMESTAMPDIFF(
         DAY,
         DATE( behospital_date ),
         DATE( leave_hospital_date ))> 31
         <if test="userId!=null">
-            AND b.user_id = #{userId}
+            AND e.user_id = #{userId}
         </if>
         <if test="isPlacefile != null and isPlacefile != ''">
             and a.is_placefile = #{isPlacefile}