Browse Source

质控评分科室sql逻辑调整

chengyao 3 years ago
parent
commit
c740fe7a48
1 changed files with 8 additions and 8 deletions
  1. 8 8
      src/main/resources/mapper/BehospitalInfoMapper.xml

+ 8 - 8
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -4461,7 +4461,7 @@
         t1.score,
         t2.avgScore,
         <if test="radioCheck !=null and radioCheck == 1">
-        t1.msg,
+        c.msg AS msg,
         t1.caseName,
         </if>
         e.score_res as scoreBn
@@ -4475,11 +4475,11 @@
         a.file_code as fileCode,
         a.behospital_code AS behospitalCode,
         a.hospital_id AS hospital_id,
+        d.id,
         a.behospital_date AS behospitalDate,
         a.leave_hospital_date AS leaveHospitalDate,
         b.score_res AS score,
         <if test="radioCheck !=null and radioCheck == 1">
-            c.msg AS msg,
             d.NAME AS caseName,
         </if>
         a.beh_dept_id AS behDeptId,
@@ -4488,21 +4488,16 @@
         FROM
         med_behospital_info a,
         med_qcresult_info b,
-        med_qcresult_detail c,
         qc_cases 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.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.id
         AND a.beh_dept_id = e.dept_id
         <if test="diagnose != null and diagnose != ''">
             AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
@@ -4560,7 +4555,12 @@
         on  t1.behospitalCode = e.behospital_code
         and t1.hospital_id = e.hospital_id
         AND e.is_deleted = 'N'
-        and e.cases_id = 243,
+        and e.cases_id = 243
+        LEFT JOIN med_qcresult_detail c
+        on  t1.behospitalCode = c.behospital_code
+        and t1.hospital_id = c.hospital_id
+        AND c.cases_id = t1.id
+        AND c.is_deleted = 'N',
         (
         SELECT
         ROUND( AVG( b.score_res ), 2 ) AS avgScore,