瀏覽代碼

厦门五院sql代码更新

wangsy 3 年之前
父節點
當前提交
29ba43a64d
共有 2 個文件被更改,包括 21 次插入28 次删除
  1. 0 18
      src/main/java/com/diagbot/facade/ConsoleFacade.java
  2. 21 10
      src/main/resources/mapper/BehospitalInfoMapper.xml

+ 0 - 18
src/main/java/com/diagbot/facade/ConsoleFacade.java

@@ -2667,24 +2667,6 @@ public class ConsoleFacade {
     public IPage<QcResultShortDTO> leaveHosMRPage(QcResultShortPageVO qcResultShortPageVO) {
         filterFacade.qcResultShortPageVOSet(qcResultShortPageVO);
         IPage<QcResultShortDTO> page = behospitalInfoFacade.leaveHosMRPage(qcResultShortPageVO);
-        List<QcResultShortDTO> records = page.getRecords();
-        HashMap<String, QcResultShortDTO> map = new HashMap<String, QcResultShortDTO>();
-        for (QcResultShortDTO record : records) {
-            if (map.get(record.getBehospitalCode())==null){
-                map.put(record.getBehospitalCode(),record);
-            }else {
-                QcResultShortDTO qcResultShortDTO = map.get(record.getBehospitalCode());
-                qcResultShortDTO.setOperationDocterName(qcResultShortDTO.getOperationDocterName()+","+record.getOperationDocterName());
-                qcResultShortDTO.setOperationLevel(qcResultShortDTO.getOperationLevel()+","+record.getOperationLevel());
-                map.put(record.getBehospitalCode(),qcResultShortDTO);
-            }
-        }
-        List<QcResultShortDTO> resultShortDTOS=new ArrayList<>();
-        Set<Map.Entry<String, QcResultShortDTO>> entries = map.entrySet();
-        for (Map.Entry<String, QcResultShortDTO> entry : entries) {
-            resultShortDTOS.add(entry.getValue());
-        }
-        page.setRecords(resultShortDTOS);
         return page;
     }
 

+ 21 - 10
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -7804,9 +7804,12 @@
     <!-- 离院病人评分详情页-->
     <select id="leaveHosMRPage" resultType="com.diagbot.dto.QcResultShortDTO">
         SELECT DISTINCT
-        t.*,
-        t4.operation_doctor_id AS operationDocterName,
-        t4.operation_level AS operationLevel
+        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(case when t4.operation_level is not null then t4.operation_level else '' end separator ',') AS operationLevel
+        </if>
         FROM
         (SELECT
         t1.hospital_id AS hospitalId,
@@ -8013,7 +8016,7 @@
             AND t1.hospital_id = t2.hospital_id
             AND t1.behospital_code = t2.behospital_code
         </if>
-        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType == 6">
+        <if test='qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType == 6 and qcResultShortPageVO.hospitalId == "7"'>
             ,med_home_page t2
             WHERE
             t2.is_deleted = 'N'
@@ -8025,7 +8028,7 @@
             or t2.blood_fee != null
             )
         </if>
-        <if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType == 7">
+        <if test='qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType == 7 and qcResultShortPageVO.hospitalId == "7"'>
             ,med_home_page t2
             ,med_doctor_advice b
             WHERE
@@ -8040,13 +8043,17 @@
             AND b.da_status != '作废'
         </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
+        </if>
         where 1=1
+        <if test='qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != "" and qcResultShortPageVO.isPlacefile == "1" and qcResultShortPageVO.hospitalId == "7"'>
         AND t.hospitalId = t3.hospital_id
         AND t.hospitalId = t4.hospital_id
         AND t.behospitalCode = t3.behospital_code
         AND t3.home_page_id = t4.home_page_id
+        </if>
         <if test="qcResultShortPageVO.checkStatus != null">
             and t.checkStatus = #{qcResultShortPageVO.checkStatus}
         </if>
@@ -8074,11 +8081,15 @@
         <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
             AND t.`level` = #{qcResultShortPageVO.level}
         </if>
-        <if test="qcResultShortPageVO.operationDoctor != null and qcResultShortPageVO.operationDoctor != ''">
-            AND t4.`operationDocterName` = #{qcResultShortPageVO.operationDoctor}
-        </if>
-        <if test="qcResultShortPageVO.operationLevel != null and qcResultShortPageVO.operationLevel != ''">
-            AND t4.`operationLevel` = #{qcResultShortPageVO.operationLevel}
+        <if test='qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != "" and qcResultShortPageVO.isPlacefile == "1" and qcResultShortPageVO.hospitalId == "7"'>
+            <if test="qcResultShortPageVO.operationDoctor != null and qcResultShortPageVO.operationDoctor != ''">
+                AND t4.`operation_doctor_id` = #{qcResultShortPageVO.operationDoctor}
+            </if>
+            <if test="qcResultShortPageVO.operationLevel != null and qcResultShortPageVO.operationLevel != ''">
+                AND t4.`operation_level` = #{qcResultShortPageVO.operationLevel}
+            </if>
+            GROUP BY
+            t.behospitalCode
         </if>
     </select>