songxinlu 4 роки тому
батько
коміт
ec84f3e87d

+ 2 - 0
src/main/java/com/diagbot/dto/CheckJobDTO.java

@@ -25,6 +25,8 @@ public class CheckJobDTO {
     private String leaveHospitalDate;
     //任务分配人员id
     private Long jobDistributor;
+    //任务分配人员名称
+    private String jobDistributorName;
 
     //筛选分值
     private int value;

+ 12 - 8
src/main/java/com/diagbot/facade/MedCheckInfoFacade.java

@@ -586,16 +586,20 @@ public class MedCheckInfoFacade extends MedCheckInfoServiceImpl {
                 for(DeptCheckUserDTO jobNumDto:userJobs)
                 {
                     //这个科室有这个人
-                    if(deptCheckUserDTO.getDeptId().equals(jobNumDto.getDeptId())&&
-                            deptCheckUserDTO.getDoctorId().equals(jobNumDto.getDoctorId()))
+                    if(deptCheckUserDTO.getDeptId().equals(jobNumDto.getDeptId()))
                     {
-                        deptCheckUserDTO.setJobNum(jobNumDto.getJobNum());
-                    }
-                    //没有这个人
-                    else
-                    {
-                        deptCheckUserDTO.setJobNum(0);
+                        if(deptCheckUserDTO.getDoctorId().equals(jobNumDto.getDoctorId()))
+                        {
+                            deptCheckUserDTO.setJobNum(jobNumDto.getJobNum());
+                        }
+                        //没有这个人
+//                        else
+//                        {
+//                            deptCheckUserDTO.setJobNum(0);
+//                        }
+
                     }
+
                 }
             }
             checkRoleMap.get(roleId+"").add(checkDeptDTO);

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

@@ -222,6 +222,20 @@ public class MedCheckWorkFacade {
         if (res == null || ListUtil.isEmpty(res.getRecords())) {
             return res;
         }
+        List<String> behospitalCodes = res.getRecords().stream()
+                .map(CheckWorkDTO::getBehospitalCode).collect(Collectors.toList());
+        checkWorkPageVO.setBehospitalCodes(behospitalCodes);
+        List<CheckWorkDTO>  ageCheckWorkDTO = medCheckInfoFacade.getBaseMapper().getCheckWorkAgeByCodes(checkWorkPageVO);
+        res.getRecords().stream().forEach(checkWorkDTO -> {
+            ageCheckWorkDTO.stream().forEach(agecheckWork-> {
+                if(checkWorkDTO.getBehospitalCode().equals(agecheckWork.getBehospitalCode()))
+                {
+                    checkWorkDTO.setAgeYear(agecheckWork.getAgeYear());
+                    checkWorkDTO.setAgeMon(agecheckWork.getAgeMon());
+                    checkWorkDTO.setAgeDay(agecheckWork.getAgeDay());
+                }
+            });
+        });
         res.getRecords().forEach(i -> {
             String age = "";
             if (StringUtil.isNotBlank(i.getAgeYear()) && !i.getAgeYear().equals("0")) {

+ 2 - 0
src/main/java/com/diagbot/mapper/MedCheckInfoMapper.java

@@ -31,6 +31,8 @@ public interface MedCheckInfoMapper extends BaseMapper<MedCheckInfo> {
     List<DeptCheckUserDTO> getJobNumByUserId(CheckUserVO checkUserVO);
     //核查任务列表
     IPage<CheckWorkDTO> getCheckWorkPage(CheckWorkPageVO checkWorkPageVO);
+    //获取核查任务年龄
+    List<CheckWorkDTO> getCheckWorkAgeByCodes(CheckWorkPageVO checkWorkPageVO);
     //获取指定核查人员的核查任务
     List<CheckJobDTO> getCheckListByUserId(CheckJobVO checkJobVO);
     //取消核查任务

+ 5 - 0
src/main/java/com/diagbot/vo/CheckWorkPageVO.java

@@ -62,6 +62,11 @@ public class CheckWorkPageVO extends Page implements Serializable {
      */
     @ApiModelProperty("科室编号集合")
     private List<String> department;
+    /**
+     * 病人住院序号集合
+     */
+    @ApiModelProperty(hidden = true)
+    private List<String> behospitalCodes;
 
     /**
      * 病历等级

+ 33 - 6
src/main/resources/mapper/MedCheckInfoMapper.xml

@@ -133,12 +133,19 @@
                 <if test="name !=null and name != ''">
                     and a.`name` LIKE CONCAT('%',#{name},'%')
                 </if>
-                <if test="deptList !=null and deptList.size()!=0">
+                <if test="deptList !=null and deptList.size()!=0 and (jobType == 0 or jobType ==1)">
                     and a.beh_dept_id in
                     <foreach collection="deptList" item="item" open="(" close=")" separator=",">
                         #{item}
                     </foreach>
                 </if>
+                <if test="deptList !=null and deptList.size()!=0 and jobType == 2">
+                    and a.beh_dept_id not in
+                    <foreach collection="deptList" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                </if>
+
 
         ) a LEFT JOIN med_behospital_type b on a.behospital_code = b.behospital_code
         and a.hospital_id = b.hospital_id and b.is_deleted = 'N'
@@ -155,7 +162,8 @@
         a.`name`,
         b.`value`,
         a.id,
-        a.job_distributor jobDistributor
+        a.job_distributor jobDistributor,
+        a.job_distribution_name jobDistributorName
         from
         (select
             a.behospital_code,
@@ -166,7 +174,8 @@
             a.hospital_id,
             a.beh_dept_id,
             b.id,
-            b.job_distributor
+            b.job_distributor,
+            b.job_distribution_name
             from
             med_behospital_info a ,med_check_info b
             where a.behospital_code = b.behospital_code and a.hospital_id = b.hospital_id and a.is_deleted = 'N'
@@ -203,9 +212,6 @@
         mbi.file_code fileCode,
         mbi.sex,
         mhp.age,
-        TIMESTAMPDIFF(year,ifnull(mhp.birthday,mbi.birthday),mbi.behospital_date) as ageYear,
-        TIMESTAMPDIFF(month,DATE_ADD(ifnull(mhp.birthday,mbi.birthday),INTERVAL TIMESTAMPDIFF(year,ifnull(mhp.birthday,mbi.birthday),mbi.behospital_date) year),mbi.behospital_date) as ageMon,
-        TIMESTAMPDIFF(day,DATE_ADD(ifnull(mhp.birthday,mbi.birthday),INTERVAL TIMESTAMPDIFF(month,ifnull(mhp.birthday,mbi.birthday),mbi.behospital_date) month),mbi.behospital_date) as ageDay,
         mbi.beh_dept_name behDeptName,
         mbi.leave_hospital_date leaveHospitalDate,
         mhp.behospital_day_num behospitalDayNum,
@@ -287,6 +293,27 @@
         </if>
     </select>
 
+    <!--获取核查任务年龄-->
+    <select id="getCheckWorkAgeByCodes" resultType="com.diagbot.dto.CheckWorkDTO">
+        SELECT
+        mbi.behospital_code behospitalCode,
+        mhp.age,
+        TIMESTAMPDIFF(year,ifnull(mhp.birthday,mbi.birthday),mbi.behospital_date) as ageYear,
+        TIMESTAMPDIFF(month,DATE_ADD(ifnull(mhp.birthday,mbi.birthday),INTERVAL TIMESTAMPDIFF(year,ifnull(mhp.birthday,mbi.birthday),mbi.behospital_date) year),mbi.behospital_date) as ageMon,
+        TIMESTAMPDIFF(day,DATE_ADD(ifnull(mhp.birthday,mbi.birthday),INTERVAL TIMESTAMPDIFF(month,ifnull(mhp.birthday,mbi.birthday),mbi.behospital_date) month),mbi.behospital_date) as ageDay
+        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'
+        WHERE mbi.hospital_id=#{hospitalId} AND mbi.is_deleted = 'N'
+        <if test="behospitalCodes !=null and behospitalCodes.size > 0">
+            and mbi.behospital_code in
+            <foreach collection="behospitalCodes" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+    </select>
     <!--通过住院号,取消核查任务-->
     <update id="deleteBatchCodes">
         <foreach collection="list" item="item"  separator=";">