Ver código fonte

历史数据回显

hurugang 4 anos atrás
pai
commit
bdad0fa322

+ 27 - 10
src/main/java/cn/hnthyy/thmz/controller/mz/ClinicController.java

@@ -302,13 +302,12 @@ public class ClinicController {
             Date beginTime = calendar.getTime();
             Date now = DateUtil.getFirstSecond();
             Date breakDay = DateUtil.pase("2021-09-27 00:00:00", "yyyy-MM-dd HH:mm:ss");
-            List<Clinic> list = new ArrayList<>();
             Set<String> set = new HashSet<>();
             while (beginTime.before(now)) {
                 calendar.add(Calendar.DAY_OF_YEAR, 1);
                 Date endTime = calendar.getTime();
                 try {
-                    process(beginTime, endTime, list,set);
+                    process(beginTime, endTime,set);
                 } catch (Exception e) {
                     e.printStackTrace();
                     log.error("当前日期没有抓取 beginTime=" + beginTime + "----endTime=" + endTime);
@@ -334,16 +333,17 @@ public class ClinicController {
     }
 
 
-    private void process(Date beginTime, Date endTime, List<Clinic> list,Set<String> set) {
+    private void process(Date beginTime, Date endTime, Set<String> set) {
         List<MzVisitTable> mzVisitTableList = mzVisitTableService.queryByDateRages(beginTime, endTime, "mz_visit_table_b");
-        setClinic(list, mzVisitTableList,set);
+        setClinic(mzVisitTableList,set);
         mzVisitTableList = mzVisitTableService.queryByDateRages(beginTime, endTime, "mz_visit_table");
-        setClinic(list, mzVisitTableList,set);
+        setClinic( mzVisitTableList,set);
     }
 
-    private void setClinic(List<Clinic> list, List<MzVisitTable> mzVisitTableList,Set<String> set) {
+    private void setClinic( List<MzVisitTable> mzVisitTableList,Set<String> set) {
         if (mzVisitTableList != null && mzVisitTableList.size() > 0) {
             StringBuilder sbd = new StringBuilder();
+            Set<String> mzDepositFileSet = new HashSet<>();
             for (MzVisitTable mzVisitTable : mzVisitTableList) {
                 sbd.setLength(0);
                 sbd.append(mzVisitTable.getPatientId()).append("_").append(mzVisitTable.getTimes());
@@ -389,11 +389,12 @@ public class ClinicController {
                         }
                     }
                 } else {
-                    BigDecimal amount = mzDepositFileService.queryAmountForPatientId(mzVisitTable.getPatientId(), mzVisitTable.getTimes(), "mz_deposit_file_b");
-                    if (amount == null) {
-                        amount = mzDepositFileService.queryAmountForPatientId(mzVisitTable.getPatientId(), mzVisitTable.getTimes(), "mz_deposit_file");
-                    }
                     clinic.setOpId(StringUtils.isNotBlank(mzVisitTable.getDoctorCode()) ? mzVisitTable.getDoctorCode() : mzVisitTable.getOpId());
+                    List<MzDepositFile> mzDepositFileBs = mzDepositFileService.queryAllMzDepositFileByTimesInHisData(mzVisitTable.getPatientId(), mzVisitTable.getTimes(), "mz_deposit_file_b");
+                    List<MzDepositFile> mzDepositFiles=mzDepositFileService.queryAllMzDepositFileByTimesInHisData(mzVisitTable.getPatientId(), mzVisitTable.getTimes(), "mz_deposit_file");
+                    BigDecimal amount = BigDecimal.ZERO;
+                    amount = getBigDecimal(sbd, mzDepositFileSet, mzVisitTable, mzDepositFileBs, amount);
+                    amount = getBigDecimal(sbd, mzDepositFileSet, mzVisitTable, mzDepositFiles, amount);
                     if (amount == null) {
                         clinic.setClinicStatus(ClinicStatusEnum.HAD_CLINIC.code);
                     } else if (BigDecimal.ZERO.compareTo(amount) == 0) {
@@ -412,6 +413,22 @@ public class ClinicController {
         }
     }
 
+    private BigDecimal getBigDecimal(StringBuilder sbd, Set<String> mzDepositFileSet, MzVisitTable mzVisitTable, List<MzDepositFile> mzDepositFileBs, BigDecimal amount) {
+        if (mzDepositFileBs != null && mzDepositFileBs.size()>0) {
+            for (MzDepositFile mzDepositFile:mzDepositFileBs){
+                sbd.setLength(0);
+                sbd.append(mzVisitTable.getPatientId()).append("_").append(mzVisitTable.getTimes()).append("_").append(mzDepositFile.getReceiptNo()).append("_").append(mzDepositFile.getChequeType()).append("_").append(mzDepositFile.getReceiptSn());
+                String tempKey =sbd.toString();
+                if(mzDepositFileSet.contains(tempKey)){
+                    continue;
+                }
+                mzDepositFileSet.add(tempKey);
+                amount=amount.add(mzDepositFile.getAmount());
+            }
+        }
+        return amount;
+    }
+
 
     /**
      * 查询分诊记录

+ 6 - 3
src/main/java/cn/hnthyy/thmz/controller/mz/MzChargeDetailController.java

@@ -1492,7 +1492,7 @@ public class MzChargeDetailController {
      *
      * @param patientId
      * @param times
-     * @param MzBlRecordFlag 如果是修改处方传false  如果是重复接诊传; true 时,只需要构造病历信息,不需要设置用药和诊疗信息
+     * @param MzBlRecordFlag 如果是修改处方传false  如果是重复接诊传true; true 时,只需要构造病历信息,不需要设置用药和诊疗信息
      * @param payMark        5 未缴费处 0 已缴费
      * @param clnicId        就诊记录id 是否需要查询就诊记录信息
      * @return
@@ -1516,7 +1516,10 @@ public class MzChargeDetailController {
                     if (clinic != null) {
                         resultMap.put("opDate", DateUtil.fomart(clinic.getOpDay(), "yyyy-MM-dd HH:mm:ss"));
                         resultMap.put("deptName", zdUnitCodeService.queryDeptNameByIdInCache(clinic.getDeptCode()));
-                        resultMap.put("doctorName", employeeService.queryByUserCode(clinic.getDoctorCode()).getEmployeeName());
+                        if(clinic.getDoctorCode()!=null && StringUtils.isNotBlank(clinic.getDoctorCode())){
+                            Employee employee= employeeService.queryByUserCode(clinic.getDoctorCode());
+                            resultMap.put("doctorName", employee!=null?employee.getEmployeeName():"");
+                        }
                     }
                 }
             }
@@ -1564,7 +1567,7 @@ public class MzChargeDetailController {
             mzChargeDetail.setBillItemCode("100");
             List<MzChargeDetail> mzChargeDetailList = mzChargeDetailService.getTempMzChargeDetailListForUnPaid(mzChargeDetail);
             if (mzChargeDetailList == null || mzChargeDetailList.size() == 0) {
-                results.put("code", -1);
+                results.put("code", -2);
                 results.put("message", "未查询到门诊缴费指引单记录");
                 return results;
             }

+ 19 - 5
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzDepositFileMapper.java

@@ -243,14 +243,28 @@ public interface MzDepositFileMapper {
     int countMzDepositFile(MzDepositFile mzDepositFile);
 
 
+//    /**
+//     * 查询病人当次缴费总额
+//     * @param patientId
+//     * @param times
+//     * @param tableName
+//     * @return
+//     */
+//    @Select(" select sum(amount) from ${tableName} where patient_id =#{patientId} and times=#{times} and pay_mark <> 2 ")
+//    BigDecimal selectAmountForPatientId(@Param(value = "patientId") String patientId, @Param("times") Integer times, @Param("tableName") String tableName);
+
+
+
     /**
-     * 查询病人档次缴费总额
+     * 查询病人当次缴费除作废外的所有数据
+     *
      * @param patientId
      * @param times
-     * @param tableName
      * @return
      */
-    @Select(" select sum(amount) from ${tableName} where patient_id =#{patientId} and times=#{times} and pay_mark <> 2 ")
-    BigDecimal selectAmountForPatientId(@Param(value = "patientId") String patientId, @Param("times") Integer times, @Param("tableName") String tableName);
-
+    @Select(
+            "select rtrim(patient_id) patient_id,times,receipt_no,rtrim(pay_mark) pay_mark,rtrim(cheque_type) cheque_type,rtrim(cheque_no) cheque_no,amount,charge_date,dcount_date,"+
+            "rtrim(dcount_no) dcount_no,rtrim(op_id) op_id,receipt_sn,serial_no,rtrim(responce_type) responce_type,yb_jlh,yb_ywh,dept_no,psordnum,agtordnum,hisrefundnum "+
+            " from ${tableName} where patient_id =#{patientId} and times=#{times} and pay_mark <> 2 ")
+    List<MzDepositFile> selectAllMzDepositFileByTimesInHisData(@Param(value = "patientId") String patientId, @Param("times") Integer times, @Param("tableName") String tableName);
 }

+ 11 - 1
src/main/java/cn/hnthyy/thmz/service/his/mz/MzDepositFileService.java

@@ -66,6 +66,16 @@ public interface MzDepositFileService {
      */
     List<Map<String, Object>> queryMzDepositFileForZZ(MzDepositFile mzDepositFile);
 
+//    /**
+//     * 查询病人档次缴费总额
+//     * @param patientId
+//     * @param times
+//     * @param tableName
+//     * @return
+//     */
+//    BigDecimal queryAmountForPatientId(String patientId,Integer times, String tableName);
+
+
     /**
      * 查询病人档次缴费总额
      * @param patientId
@@ -73,6 +83,6 @@ public interface MzDepositFileService {
      * @param tableName
      * @return
      */
-    BigDecimal queryAmountForPatientId(String patientId,Integer times, String tableName);
+    List<MzDepositFile> queryAllMzDepositFileByTimesInHisData(String patientId,Integer times, String tableName);
 
 }

+ 4 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/YpBaseYfServiceImpl.java

@@ -32,13 +32,16 @@ import java.util.List;
  */
 @Service
 public class YpBaseYfServiceImpl implements YpBaseYfService {
-
+    @SuppressWarnings("all")
     @Autowired
     private YpBaseYfMapper ypBaseYfMapper;
+    @SuppressWarnings("all")
     @Autowired
     private YpConfigMapper ypConfigMapper;
+    @SuppressWarnings("all")
     @Autowired
     private YpInDetlYfMapper ypInDetlYfMapper;
+    @SuppressWarnings("all")
     @Autowired
     private YpOutDetlMapper ypOutDetlMapper;
     @Autowired

+ 22 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -869,7 +869,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
      * 设置处方明细的描述
      *
      * @param mzPrescriptionVo
-     * @param savePrescription Yes  新处方  no历史处方
+     * @param savePrescription Yes  新处方  已入库处方
      */
     private void setPrescriptionDetail(MzPrescriptionVo mzPrescriptionVo, YesNoEnum savePrescription) throws MzException {
         Map<String, Object> prescriptionDetail = new HashMap<>();
@@ -1713,6 +1713,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         }else if (PayMarkEnum.NO_CHARGE.code.equals(payMark)) {
             mzPrescriptionVo.setMzYjReqList(mzYjReqMapper.selectNotPayMzYjReq(new MzYjReq(patientId, times)));
         }
+        if(mzBlRecord.getPrescriptionDetail()==null || StringUtils.isBlank(mzBlRecord.getPrescriptionDetail())){
+            setPrescriptionDetail(mzPrescriptionVo, YesNoEnum.NO);
+        }
         return mzPrescriptionVo;
     }
 
@@ -1989,6 +1992,10 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         List<MzChargeDetail> mzChargeDetails = getNewListForRefundFee(opId, mzDepositFileVo, YesNoEnum.YES);
         //是否全退
         boolean allRefund = mzChargeDetails == null || mzChargeDetails.size() == 0;
+        MzBlRecord mzBlRecord=null;
+        if(!allRefund){
+            mzBlRecord=mzBlRecordMapper.selectMzBlRecordByPatientIdAndTimes(mzDepositFileVo.getPatientId(),mzDepositFileVo.getTimes());
+        }
         MzChargeDetailYb mzChargeDetailYb = new MzChargeDetailYb();
         mzChargeDetailYb.setPatientId(mzDepositFileVo.getPatientId());
         mzChargeDetailYb.setTimes(mzDepositFileVo.getTimes());
@@ -2120,7 +2127,15 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 newClinic.setFirstOrNot(dbClinic.getFirstOrNot());
             }
             clinicMapper.insertClinic(newClinic);
-
+            MzPrescriptionVo mzPrescriptionVo =new MzPrescriptionVo();
+            mzPrescriptionVo.setMzChargeDetailList(mzChargeDetails);
+            mzPrescriptionVo.setMzYjReqList(mzYjReqs);
+            if(mzBlRecord!=null){
+                mzBlRecord.setTimes(times);
+                mzPrescriptionVo.setMzBlRecord(mzBlRecord);
+                setPrescriptionDetail(mzPrescriptionVo, YesNoEnum.NO);
+                mzBlRecordMapper.insertMzBlRecord(mzBlRecord);
+            }
         }
         MzYjReq updateMzYjReq = new MzYjReq(mzDepositFileVo.getPatientId(), oriTimes);
         updateMzYjReq.setPayMark(PayMarkEnum.RETURN_PREMIUM.code);
@@ -2372,6 +2387,11 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         times++;
         if (YesNoEnum.YES.equals(yesNo)) {
             MzVisitTable newMzVisitTable = getMzVisitTable(opId, mzChargeDetails, times, now);
+            MzVisitTable dbMzVisitTable = mzVisitTableMapper.selectByPatientIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(),"mz_visit_table");
+            if(dbMzVisitTable!=null){
+                newMzVisitTable.setIcdCode(dbMzVisitTable.getIcdCode());
+                newMzVisitTable.setIcdText(dbMzVisitTable.getIcdText());
+            }
             mzVisitTableMapper.insertMzVisitTable(newMzVisitTable);
         }
         List<MzChargeDetail> newMzChargeDetailList = new ArrayList<>();

+ 7 - 2
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzDepositFileServiceImpl.java

@@ -112,10 +112,15 @@ public class MzDepositFileServiceImpl implements MzDepositFileService {
     }
 
     @Override
-    public BigDecimal queryAmountForPatientId(String patientId, Integer times, String tableName) {
-        return mzDepositFileMapper.selectAmountForPatientId(patientId,times,tableName);
+    public List<MzDepositFile> queryAllMzDepositFileByTimesInHisData(String patientId, Integer times, String tableName) {
+        return mzDepositFileMapper.selectAllMzDepositFileByTimesInHisData(patientId,times,tableName);
     }
 
+//    @Override
+//    public BigDecimal queryAmountForPatientId(String patientId, Integer times, String tableName) {
+//        return mzDepositFileMapper.selectAmountForPatientId(patientId,times,tableName);
+//    }
+
     private Map<String, String> getStringStringMap(List<MzDepositFile> list, List<Map<String, Object>> resultList, Map<String, String> employeeMap, Set<String> set, YesNoEnum hisData) {
         if (list != null && list.size() > 0) {
             if (employeeMap == null) {

+ 10 - 2
src/main/resources/static/js/mz/clinic.js

@@ -5686,6 +5686,13 @@ function printPrescription(patientId, times, clnicId, payMark) {
                     LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
                     LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
                     LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
+                    //intDispMode:预览比例,数字型,0-适高  1-正常大小  2-适宽
+                    //intToolMode:工具条和按钮,数字型  0-显示(上方)工具栏   1-显示(下方)按钮栏    2-两个都显示   3-两个都不显示
+                    //blDirectPrint: 打印按钮是否“直接打印” 1-是  0-否(弹出界面“选机打印”)
+                    //intWidth,intHeight 窗口的宽和高,整数型,单位是px
+                    //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
+                    //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
+                    LODOP.SET_PREVIEW_WINDOW(0,2,0,700,900,"");
                     //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
                     var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
                     var mzPatientMi = res.mzPatientMi;
@@ -5945,8 +5952,9 @@ function printPrescription(patientId, times, clnicId, payMark) {
                                 LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("guide_card_table").innerHTML);
                                 //LODOP.PRINT();
                                 LODOP.PREVIEW();
-
-                            } else {
+                            } else if(res.code ==-2){
+                                LODOP.PREVIEW();
+                            }else {
                                 errorMesage(res);
                             }
                         }

+ 1 - 1
src/main/resources/templates/mz/clinic.html

@@ -1573,7 +1573,7 @@
      style="width:920px;height: calc(100% - 160px);margin:0 auto;border: 1px solid #337ab7;font-size: 13px;padding: 40px 20px 40px 20px;overflow-y: auto; overflow-x:hidden;">
     <div id="report_table_1">
         <div style="position: relative;"><div style="text-align:center;font-weight: 700;">湖南泰和医院</div>
-            <div style="float: right;color: red;margin-right: 40px;border: 1px solid red;width: 60px;text-align: center;position: absolute;top: 0px;right: 0px;" id="cfTitle"></div></div>
+            <div style="float: right;color: red;margin-right: 30px;border: 1px solid red;width: 60px;text-align: center;position: absolute;top: 0px;right: 0px;" id="cfTitle"></div></div>
         <div style="text-align:center;font-weight: 700;">处方笺</div>
         <!--<h3 style="text-align:center;font-weight: 700;">湖南泰和医院</h3>-->
         <!--<h3 style="text-align:center;font-weight: 700;">处方笺</h3>-->