Prechádzať zdrojové kódy

Merge branch '20211018_yw_check' into test_qiyuan

chengyao 3 rokov pred
rodič
commit
101852e1a8

+ 0 - 3
src/main/java/com/diagbot/facade/MedCheckWorkFacade.java

@@ -342,9 +342,6 @@ public class MedCheckWorkFacade {
                         .in(ListUtil.isNotEmpty(checkWorkPageVO.getDepts()),"dept_id",checkWorkPageVO.getDepts()));
                 checkWorkPageVO.setDoctorIds(basDoctorInfos.stream().map(BasDoctorInfo::getDoctorId).collect(Collectors.toList()));
             }
-            //通过主治医生去查,病区、科室、医疗组不作为筛选条件
-//            checkWorkPageVO.setDepts(null);
-            checkWorkPageVO.setWards(null);
         }
     }
 

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

@@ -1511,6 +1511,7 @@
         med_behospital_info a
         WHERE
         a.is_deleted = 'N'
+        and a.qc_type_id != 0
         <if test="isPlacefile != null and isPlacefile != ''">
             and a.is_placefile = #{isPlacefile}
         </if>
@@ -1670,6 +1671,7 @@
         med_behospital_info a
         WHERE
         a.is_deleted = 'N'
+        and a.qc_type_id != 0
         <if test="isPlacefile != null and isPlacefile != ''">
             and a.is_placefile = #{isPlacefile}
         </if>
@@ -6849,7 +6851,7 @@
         GROUP BY
         d.doctor_id,
         d.doctor_name
-        having  sum( e.cases_entry_id = 2594 ) is not null or sum( e.cases_entry_id = 2973 ) or sum( e.cases_entry_id = 2930 )
+        having  sum( e.cases_entry_id = 2594 ) is not null or sum( e.cases_entry_id = 2973 ) is not null or sum( e.cases_entry_id = 2930 is not null)
         ) UNION
         (
         SELECT

+ 143 - 13
src/main/resources/mapper/MedCheckInfoMapper.xml

@@ -318,6 +318,10 @@
         and a.hospital_id = b.hospital_id and b.is_deleted = 'N'
     </select>
     <select id="getCheckWorkPage" resultType="com.diagbot.dto.CheckWorkDTO">
+        SELECT
+        *
+        FROM
+        (
         SELECT
         mbi.behospital_code behospitalCode,
         mbi.`name`,
@@ -437,26 +441,152 @@
                 #{item}
             </foreach>
         </if>
-        <if test="doctorIds !=null and doctorIds.size > 0">
-            and (mbi.doctor_id IN
-            <foreach collection="doctorIds" item="item" open="(" close=")" separator=",">
+        <if test="wards !=null and wards.size > 0">
+            AND mbi.ward_code IN
+            <foreach collection="wards" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
-            <if test="depts !=null and depts.size > 0 and (medoups!=null and medoups.size==0)">
-                or mbi.beh_dept_id in
-                <foreach collection="depts" item="item" open="(" close=")" separator=",">
-                    #{item}
-                </foreach>
+        </if>
+        <if test="depts !=null and depts.size > 0">
+            AND mbi.beh_dept_id in
+            <foreach collection="depts" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="medoups !=null and medoups.size > 0">
+            AND medoup.`code` IN
+            <foreach collection="medoups" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        UNION
+        SELECT
+        mbi.behospital_code behospitalCode,
+        mbi.`name`,
+        mbi.file_code fileCode,
+        mbi.sex,
+        TIMESTAMPDIFF(
+        DAY,
+        ifnull(mhp.birthday, mbi.birthday),
+        mbi.behospital_date
+        ) AS birthday,
+        mhp.age,
+        mbi.ward_code wardCode,
+        mbi.ward_name wardName,
+        mbi.beh_dept_id deptId,
+        mbi.beh_dept_name behDeptName,
+        mbi.leave_hospital_date leaveHospitalDate,
+        mhp.behospital_day_num + 0 behospitalDayNum,
+        mbi.doctor_id doctorId,
+        mbi.doctor_name doctorName,
+        mqi.score_res scoreRes,
+        mqi.`level`,
+        mbi.diagnose,
+        CASE
+        WHEN mbt.behospital_type = '出院病人' THEN
+        '6'
+        WHEN mbt.behospital_type = '死亡病人' THEN
+        '6'
+        WHEN mbt.behospital_type = '危重病人' THEN
+        '4'
+        WHEN mbt.behospital_type = '抢救病人' THEN
+        '5'
+        WHEN mbt.behospital_type = '手术病人' THEN
+        '2'
+        WHEN mbt.behospital_type = '疑难病人' THEN
+        '3'
+        WHEN mbt.behospital_type = '输血病人' THEN
+        '4'
+        ELSE
+        '0'
+        END AS score,
+        CASE
+        WHEN ISNULL(mci.job_create_time) THEN
+        '未生成'
+        ELSE
+        '已生成'
+        END AS creatStatus,
+        mci.job_create_time jobCreateTime,
+        mci.job_creator jobCreator,
+        mci.job_creator_name jobCreatorName,
+        mci.check_time checkTime,
+        mci.job_distribution_time jobDistributionTime,
+        medoup.`code` medoupCode,
+        medoup.`name` medoupName
+        FROM
+        med_behospital_info mbi
+        LEFT JOIN med_home_page mhp ON mbi.behospital_code = mhp.behospital_code
+        AND mbi.hospital_id = mhp.hospital_id
+        AND mhp.is_deleted = 'N'
+        LEFT JOIN bas_doctor_info doctor ON doctor.doctor_id = mbi.doctor_id
+        AND doctor.is_deleted = 'N'
+        LEFT JOIN sys_medoup medoup ON medoup.`code` = doctor.group_id
+        AND medoup.is_deleted = 'N'
+        LEFT JOIN med_check_info mci ON mbi.behospital_code = mci.behospital_code
+        AND mbi.hospital_id = mci.hospital_id
+        AND mci.is_deleted = 'N'
+        LEFT JOIN med_qcresult_info mqi ON mbi.behospital_code = mqi.behospital_code
+        AND mbi.hospital_id = mqi.hospital_id
+        AND mqi.is_deleted = 'N'
+        JOIN med_behospital_type mbt ON mbi.behospital_code = mbt.behospital_code
+        AND mbi.hospital_id = mbt.hospital_id
+        AND mbt.is_deleted = 'N'
+        WHERE
+        mbi.hospital_id=#{hospitalId} AND mbi.is_deleted = 'N' and mqi.score_res is not null
+        AND mci.check_id is null
+        AND mbi.beh_dept_id in (2015,2019)
+        <if test="startDate != null">
+            <![CDATA[ AND mbi.leave_hospital_date >= #{startDate}]]>
+        </if>
+        <if test="endDate != null">
+            <![CDATA[ AND mbi.leave_hospital_date < #{endDate}]]>
+        </if>
+        <if test="creatStatus != null and creatStatus == '1'.toString()">
+            AND mci.job_create_time is not null
+            <if test="jobType != null and jobType != ''">
+                AND mci.job_type=#{jobType}
             </if>
-            )
         </if>
-
-        <if test="wards !=null and wards.size > 0">
-            AND mbi.ward_code IN
-            <foreach collection="wards" item="item" open="(" close=")" separator=",">
+        <if test="creatStatus != null and creatStatus == '0'.toString()">
+            AND mci.job_create_time is null
+        </if>
+        <if test="name != null and name != ''">
+            AND mbi.`name` like CONCAT('%',#{name},'%')
+        </if>
+        <if test="behospitalCode != null and behospitalCode != ''">
+            AND mbi.behospital_code like CONCAT('%',#{behospitalCode},'%')
+        </if>
+        <if test="smallDay != null">
+            <![CDATA[ AND mhp.behospital_day_num >= #{smallDay}]]>
+        </if>
+        <if test="bigDay != null">
+            <![CDATA[ AND mhp.behospital_day_num <= #{bigDay}]]>
+        </if>
+        <if test="doctorName != null and doctorName != ''">
+            AND mbi.doctor_name LIKE CONCAT( '%', #{doctorName}, '%' )
+        </if>
+        <if test="diagnose != null and diagnose != ''">
+            AND mbi.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
+        </if>
+        <if test="level != null and level != ''">
+            AND mqi.`level`= #{level}
+        </if>
+        <if test="isPlacefile != null and isPlacefile != ''">
+            AND mbi.is_placefile = #{isPlacefile}
+        </if>
+        <if test="values !=null and values.size > 0">
+            and mbt.`value` in
+            <foreach collection="values" item="item" open="(" close=")" separator=",">
                 #{item}
             </foreach>
         </if>
+        <if test="doctorIds !=null and doctorIds.size > 0">
+            and mbi.doctor_id IN
+            <foreach collection="doctorIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        ) a
     </select>
 
     <!--通过住院号,取消核查任务-->