Browse Source

挂号列表

hurugang 4 years ago
parent
commit
da49bc221c

+ 95 - 0
src/main/java/cn/hnthyy/thmz/controller/api/MedicalViewApiController.java

@@ -829,6 +829,101 @@ public class MedicalViewApiController {
 
 
 
+    /**
+     * 门诊挂号记录查询
+     *
+     * @param mzyReqrec
+     * @return
+     */
+    @RequestMapping(value = "/getRegistrationForPaid", method = {RequestMethod.POST})
+    public Map<String, Object> getRegistrationForPaid(@RequestBody MzyReqrec mzyReqrec) {
+        Map<String, Object> results = new HashMap<>();
+        if (mzyReqrec == null) {
+            results.put("resultCode", -1);
+            results.put("resultMessage", "门诊挂号记录查询参数为空");
+            return results;
+        }
+        if (mzyReqrec.getPatientId() == null) {
+            results.put("resultCode", -1);
+            results.put("resultMessage", "患者ID不能为空");
+            return results;
+        }
+        try {
+            mzyReqrec.setOpId(Constants.BRZZJF_CODE);
+            MzyReqrecPageDto mzyReqrecPageDto = new MzyReqrecPageDto();
+            mzyReqrecPageDto.setPageSize(1000);
+            mzyReqrecPageDto.setMzyReqrec(mzyReqrec);
+            mzyReqrecPageDto.setPatientIds(Arrays.asList(mzyReqrec.getPatientId()));
+            mzyReqrecPageDto.setTableName("mzy_reqrec");
+            List<MzyReqrec> mzyReqrecList = mzyReqrecService.queryMzyReqrecWithPage(mzyReqrecPageDto);
+            List<Map<String,Object>> list = new ArrayList<>();
+            Map<String, String> employeeMap = null;
+            Set<String> set = new HashSet<>();
+            employeeMap = getStringStringMap(mzyReqrecList, list, employeeMap, set);
+            mzyReqrecPageDto.setTableName("mzy_reqrec_b");
+            mzyReqrecList = mzyReqrecService.queryMzyReqrecWithPage(mzyReqrecPageDto);
+            getStringStringMap(mzyReqrecList, list, employeeMap, set);
+            if (list == null || list.size() == 0) {
+                results.put("resultCode", -1);
+                results.put("resultMessage", "未查询到挂号记录");
+                return results;
+            }
+            results.put("resultCode", 0);
+            results.put("resultMessage", "挂号记录查询成功");
+            results.put("data", list);
+            return results;
+        } catch (Exception e) {
+            e.printStackTrace();
+            results.put("resultCode", -1);
+            results.put("resultMessage", "门诊挂号记录查询失败,请联系管理员,错误信息{"+e.getMessage()+"}");
+            log.error("系统异常,错误信息{}", e.getMessage());
+            return results;
+        }
+    }
+
+    private Map<String, String> getStringStringMap(List<MzyReqrec> mzyReqrecList, List<Map<String, Object>> list, Map<String, String> employeeMap, Set<String> set) {
+        if(mzyReqrecList!=null && mzyReqrecList.size()>0){
+            if (employeeMap == null) {
+                List<Employee> employees = employeeService.queryAll();
+                if (employees != null) {
+                    employeeMap = employees.stream().collect(Collectors.toMap(Employee::getEmployeeCode, Employee::getEmployeeName));
+                }
+            }
+            for (MzyReqrec mr:mzyReqrecList){
+                if(set.contains(mr.getPsordnum())){
+                    continue;
+                }
+                Map<String,Object> map = new HashMap<>();
+                map.put("patientId",mr.getPatientId());
+                map.put("doctorName",employeeMap.get(mr.getDoctorCode()));
+                map.put("unitName",zdUnitCodeService.queryDeptNameByIdInCache(mr.getUnitCode()));
+                map.put("requestDay",DateUtil.fomart(mr.getRequestDay(),"yyyy-MM-dd HH:mm:ss"));
+                if (StringUtils.isNotBlank(mr.getChargeType())) {
+                    MzyZdChargeType mzyZdChargeType = mzyZdChargeTypeService.queryByCode(mr.getChargeType());
+                    if (mzyZdChargeType != null) {
+                        map.put("chargeType", mzyZdChargeType.getName());
+                    }else {
+                        map.put("chargeType","");
+                    }
+                }
+                BigDecimal fee=BigDecimal.ZERO;
+                if (mr.getReqFee() == null) {
+                    mr.setReqFee(BigDecimal.ZERO);
+                }
+                if (mr.getClinicFee() == null) {
+                    mr.setClinicFee(BigDecimal.ZERO);
+                }
+                if (mr.getOthFee() == null) {
+                    mr.setOthFee(BigDecimal.ZERO);
+                }
+                fee = fee.add(mr.getReqFee()).add(mr.getClinicFee()).add(mr.getOthFee());
+                map.put("fee",fee);
+                list.add(map);
+                set.add(mr.getPatientId());
+            }
+        }
+        return employeeMap;
+    }
 
 
     /**

+ 8 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/MzyReqrecMapper.java

@@ -47,7 +47,7 @@ public interface MzyReqrecMapper {
      * @return
      */
     @Select({"<script>",
-            "select count(*) count from mzy_reqrec  where times >0 ",
+            "select count(*) count from ${tableName}  where times >0 ",
             "<when test='patientIds!=null'>",
             " and patient_id in ",
             "<foreach item='item' index='index' collection='patientIds' open='(' separator=',' close=')'>",
@@ -84,6 +84,9 @@ public interface MzyReqrecMapper {
             "<when test='endTime!=null'>",
             " and op_day &lt;=#{endTime,jdbcType=TIMESTAMP}",
             "</when>",
+            "<when test='mzyReqrec.opId!=null'>",
+            " and op_id =#{mzyReqrec.opId}",
+            "</when>",
             "</script>"})
     Integer countMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto);
 
@@ -99,7 +102,7 @@ public interface MzyReqrecMapper {
             "rtrim(admiss_time) admiss_time,rtrim(op_id) op_id,op_day,clinic_fee,rtrim(visited_mark) visited_mark,rtrim(plus_mark) plus_mark,closing_date,",
             "rtrim(printer_id) printer_id,rtrim(print_flag) print_flag,rtrim(windows_no) windows_no,serial_no,rtrim(receipt_bill) receipt_bill,dcount_no,brochure_fee,dept_no,visit_dept,",
             "visit_doctor,visit_date,paymode,psordnum,agtordnum,print_closing_date,print_dcount_no   FROM (SELECT ROW_NUMBER() OVER (ORDER BY mzy_reqrec_page.request_day desc) AS RowNumber,",
-            "* from dbo.mzy_reqrec mzy_reqrec_page where times >0 ",
+            "* from dbo.${tableName} mzy_reqrec_page where times >0 ",
             "<when test='patientIds!=null'>",
             " and patient_id in ",
             "<foreach item='item' index='index' collection='patientIds' open='(' separator=',' close=')'>",
@@ -136,6 +139,9 @@ public interface MzyReqrecMapper {
             "<when test='endTime!=null'>",
             " and op_day &lt;=#{endTime,jdbcType=TIMESTAMP}",
             "</when>",
+            "<when test='mzyReqrec.opId!=null'>",
+            " and op_id =#{mzyReqrec.opId}",
+            "</when>",
             ") as A WHERE RowNumber >#{pageSize}*#{pageIndex} order by RowNumber asc",
             "</script>"})
     List<MzyReqrec> selectMzyReqrecWithPage(MzyReqrecPageDto mzyReqrecPageDto);

+ 2 - 0
src/main/java/cn/hnthyy/thmz/pageDto/MzyReqrecPageDto.java

@@ -33,4 +33,6 @@ public class MzyReqrecPageDto {
     private List<String> patientIds;
     //总付款费用
     private BigDecimal totalFee;
+    //表名
+    private String tableName;
 }

+ 10 - 4
src/main/java/cn/hnthyy/thmz/service/impl/his/MzDepositFileServiceImpl.java

@@ -93,15 +93,15 @@ public class MzDepositFileServiceImpl implements MzDepositFileService {
         List<MzDepositFile> list = mzDepositFileMapper.selectMzDepositFileWithPage(mzDepositFile);
         List<Map<String, Object>> resultList = new ArrayList<>();
         Map<String, String> employeeMap = null;
-        employeeMap = getStringStringMap(list, resultList, employeeMap);
-
+        Set<String> set = new HashSet<>();
+        employeeMap = getStringStringMap(list, resultList, employeeMap,set);
         mzDepositFile.setTableName("mz_deposit_file_b");
         list = mzDepositFileMapper.selectMzDepositFileWithPage(mzDepositFile);
-        getStringStringMap(list, resultList, employeeMap);
+        getStringStringMap(list, resultList, employeeMap,set);
         return resultList;
     }
 
-    private Map<String, String> getStringStringMap(List<MzDepositFile> list, List<Map<String, Object>> resultList, Map<String, String> employeeMap) {
+    private Map<String, String> getStringStringMap(List<MzDepositFile> list, List<Map<String, Object>> resultList, Map<String, String> employeeMap,Set<String> set) {
         if (list != null && list.size() > 0) {
             if (employeeMap == null) {
                 List<Employee> employees = employeeMapper.selectAll();
@@ -110,14 +110,20 @@ public class MzDepositFileServiceImpl implements MzDepositFileService {
                 }
             }
             for (MzDepositFile mf : list) {
+                String hisOrdNum=mf.getPatientId()+"_"+mf.getTimes()+"_"+mf.getReceiptNo();
+                if(set.contains(hisOrdNum)){
+                    continue;
+                }
                 Map<String, Object> map = new HashMap<>();
                 map.put("chargeDate", DateUtil.fomart(mf.getChargeDate(),"yyyy-MM-dd HH:mm:ss"));
                 map.put("amount", mf.getAmount());
+                map.put("hisOrdNum",hisOrdNum);
                 MzVisitTable mzVisitTable = mzVisitTableMapper.selectByPatientIdAndTimes(mf.getPatientId(), mf.getTimes());
                 if (mzVisitTable != null) {
                     map.put("visitDeptName", zdUnitCodeService.queryDeptNameByIdInCache(mzVisitTable.getVisitDeptCode()));
                     map.put("doctorName", employeeMap.get(mzVisitTable.getDoctorCode()));
                 }
+                set.add(hisOrdNum);
                 resultList.add(map);
             }
         }

+ 6 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/MzyReqrecServiceImpl.java

@@ -404,11 +404,17 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
     public Integer countMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto) {
         //清洗挂号数据
         // mzyReqrecMapper.updateCanCelMark();
+        if(StringUtils.isBlank(mzyReqrecPageDto.getTableName())){
+            mzyReqrecPageDto.setTableName("mzy_reqrec");
+        }
         return mzyReqrecMapper.countMzyReqrec(mzyReqrecPageDto);
     }
 
     @Override
     public List<MzyReqrec> queryMzyReqrecWithPage(MzyReqrecPageDto mzyReqrecPageDto) {
+        if(StringUtils.isBlank(mzyReqrecPageDto.getTableName())){
+            mzyReqrecPageDto.setTableName("mzy_reqrec");
+        }
         return mzyReqrecMapper.selectMzyReqrecWithPage(mzyReqrecPageDto);
     }