Procházet zdrojové kódy

优化医技收费

hurugang před 5 roky
rodič
revize
039e2db5f9

+ 18 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/MzReceiptSerialMapper.java

@@ -291,4 +291,22 @@ public interface MzReceiptSerialMapper {
     @Update("update mz_receipt_serial set pay_id =operator_id,charge_dcount_date=dcount_date,charge_dcount_no=dcount_no where operator_id in ('01893','01894','01895','01942') and charge_dcount_date is null  ")
     int updateMzService();
 
+
+
+    /**
+     * 根据病人编号和就诊次数查询其当前就诊次数对应的本院记账退费的发票
+     *
+     * @param patientId
+     * @param times
+     * @return
+     */
+    @Select({"<script>",
+            "select rtrim(patient_id) patient_id,times,receipt_no,serial_no,rtrim(operator_id) operator_id,charge1,charge2,charge3,charge4,charge5,charge6,charge7,charge8,charge9,",
+            "charge10,charge11,charge12,charge13,charge14,charge15,charge16,charge17,charge18,charge19,charge20,rtrim(pay_mark) pay_mark,total_charge,charge_date,rtrim(receipt_bill) receipt_bill,",
+            "receipt_sn,dcount_date,rtrim(windows_no) windows_no,dcount_no,serial_yb,rtrim(fp_flag) fp_flag,rtrim(responce_type) responce_type,rtrim(cheque_type) cheque_type,cheque_no," +
+                    "rtrim(tf_flag) tf_flag,dept_no,rtrim(pay_id) pay_id,charge_dcount_date,charge_dcount_no",
+            "from mz_receipt_serial where  patient_id=#{patientId,jdbcType=CHAR} and times = #{times,jdbcType=INTEGER} and cheque_type ='Y' and tf_flag = 1 ",
+            "</script>"})
+    List<MzReceiptSerial> selectSerialForJzTfThisTime(@Param(value = "patientId") String patientId, @Param("times") Integer times);
+
 }

+ 38 - 9
src/main/java/cn/hnthyy/thmz/service/impl/his/MzChargeDetailServiceImpl.java

@@ -249,6 +249,10 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 }
             }
             List<JcJyItemCharge> jcJyItemCharges = null;
+            //医生有可能同一个检验检查反复开,需要记录每种开了几次
+            Map<String, Integer> jyjcCount = new HashMap<>();
+            countSameYjCode(jianYans, jyjcCount);
+            countSameYjCode(jianChas, jyjcCount);
             if (jianYans.size() > 0) {
                 jcJyItemCharges = jcJyItemChargeService.queryJcItemChargeByCodeList(jianYans, ReqTypeEnum.JIAN_YAN.code);
                 itemNo = formatCxFeeItem(mzChargeDetail, mzChargeDetails, mzPatientMi, maxOrderNo, itemNo, mzYjReqMap, jianYans, tcNoMap, priceId, priceTime, receiptNo);
@@ -263,7 +267,10 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             }
             if (jcJyItemCharges != null && jcJyItemCharges.size() > 0) {
                 for (JcJyItemCharge jcJyItemCharge : jcJyItemCharges) {
-                    itemNo = formatYjDetailChargeDetail(mzChargeDetail, mzChargeDetails, maxOrderNo, mzPatientMi, itemNo, mzYjReqMap, jcJyItemCharge, tcNoMap, priceId, priceTime, receiptNo);
+                    Integer count = jyjcCount.get(jcJyItemCharge.getCode());
+                    for (int i = 0; i < count; i++) {
+                        itemNo = formatYjDetailChargeDetail(mzChargeDetail, mzChargeDetails, maxOrderNo, mzPatientMi, itemNo, mzYjReqMap, jcJyItemCharge, tcNoMap, priceId, priceTime, receiptNo);
+                    }
                 }
             }
         }
@@ -275,6 +282,17 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         return mzChargeDetails;
     }
 
+    private void countSameYjCode(List<String> jianChas, Map<String, Integer> jyjcCount) {
+        for (String str : jianChas) {
+            Integer count = jyjcCount.get(str);
+            if (count == null) {
+                count = 0;
+            }
+            count++;
+            jyjcCount.put(str, count);
+        }
+    }
+
     /**
      * 将未缴费的处方转成完整的收费明细
      *
@@ -464,10 +482,21 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
 
     @Override
     public List<Map<String, Object>> queryChargeListByPatient(YesNoEnum hisDate, String patientId, String name, String serialNo, Date beginDate, Date endDate) {
+        List<Map<String, Object>> chargeListByPatient;
         if (YesNoEnum.YES.equals(hisDate)) {
-            return mzChargeDetailMapper.selectHisChargeListByPatient(patientId, name, serialNo, beginDate, endDate);
+            chargeListByPatient = mzChargeDetailMapper.selectHisChargeListByPatient(patientId, name, serialNo, beginDate, endDate);
+        }else {
+            chargeListByPatient = mzChargeDetailMapper.selectChargeListByPatient(patientId, name, serialNo, beginDate, endDate);
+        }
+        for (Map<String, Object> map : chargeListByPatient) {
+            String patientIdTemp = (String) map.get("patient_id");
+            Integer times = (Integer) map.get("times");
+            List<MzReceiptSerial> lists = mzReceiptSerialMapper.selectSerialForJzTfThisTime(patientIdTemp, times);
+            if (lists != null && lists.size() > 0) {
+                map.put("cheque_type", "本院记账已结算");
+            }
         }
-        return mzChargeDetailMapper.selectChargeListByPatient(patientId, name, serialNo, beginDate, endDate);
+        return chargeListByPatient;
     }
 
     @Override
@@ -704,7 +733,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         List<MzDepositFile> fullNewMzDepositFiles = new ArrayList<>();
         int times = 0;
         if (allRefund) {
-            getDeposFiles(opId, mzDepositFileVo, now, 0, 0, null, null, fullNewMzDepositFiles, allRefund,null);
+            getDeposFiles(opId, mzDepositFileVo, now, 0, 0, null, null, fullNewMzDepositFiles, allRefund, null);
             //新增收费方式记录
             mzDepositFileMapper.batchInsertMzDepositFile(fullNewMzDepositFiles);
             times = 0;
@@ -752,7 +781,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             //退费后新的收款方式
             List<MzDepositFile> newMzDepositFiles = new ArrayList<>();
             String payWay = Constants.CASH;
-            payWay = getDeposFiles(opId, mzDepositFileVo, now, times, serialNo, totalPayable, payWay, fullNewMzDepositFiles, allRefund,newMzDepositFiles);
+            payWay = getDeposFiles(opId, mzDepositFileVo, now, times, serialNo, totalPayable, payWay, fullNewMzDepositFiles, allRefund, newMzDepositFiles);
             //setMzReceiptSerial(opId, mzDepositFileVo.getPatientId(), times, windows, mzChargeDetails.get(0).getResponceType(), feeMap, now, serialNo, mzReceiptSerial, payWay, totalPayable, 1);
             MzPatientMi mzPatientMi = mzPatientMiService.queryByPatientId(mzDepositFileVo.getPatientId());
             mzDepositFileVo.setMzDepositFiles(newMzDepositFiles);
@@ -814,9 +843,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             mz.setCharge18(BigDecimal.ZERO.subtract(mz.getCharge18()));
             mz.setCharge19(BigDecimal.ZERO.subtract(mz.getCharge19()));
             mz.setCharge20(BigDecimal.ZERO.subtract(mz.getCharge20()));
-            if(Constants.BYJZ.equals(mz.getChequeType())){
+            if (Constants.BYJZ.equals(mz.getChequeType())) {
                 mz.setChequeType(Constants.BYJZ);
-            }else {
+            } else {
                 mz.setChequeType(Constants.CASH);
             }
             mz.setDcountNo(YesNoEnum.NO.code);
@@ -876,7 +905,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
      * @param newMzDepositFiles
      * @return
      */
-    private String getDeposFiles(String opId, MzDepositFileVo mzDepositFileVo, Date now, int times, int serialNo, BigDecimal totalPayable, String payWay, List<MzDepositFile> fullNewMzDepositFiles, boolean allRefund,List<MzDepositFile> newMzDepositFiles) {
+    private String getDeposFiles(String opId, MzDepositFileVo mzDepositFileVo, Date now, int times, int serialNo, BigDecimal totalPayable, String payWay, List<MzDepositFile> fullNewMzDepositFiles, boolean allRefund, List<MzDepositFile> newMzDepositFiles) {
         List<MzDepositFile> mzDepositFiles = mzDepositFileMapper.selectMzDepositFileByTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
         if (mzDepositFiles != null || mzDepositFiles.size() > 0) {
             //本院记账总额
@@ -1296,7 +1325,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         //排除本院记账的金额
         BigDecimal excludeByjzPay = BigDecimal.ZERO;
         for (MzDepositFile m : mzDepositFileVo.getMzDepositFiles()) {
-            if(m.getPatientId()==null){
+            if (m.getPatientId() == null) {
                 //此时是直接收费,需要设置相关参数
                 m.setPatientId(mzDepositFileVo.getPatientId());
                 m.setTimes(mzDepositFileVo.getTimes());

+ 5 - 1
src/main/resources/static/js/registration.js

@@ -791,7 +791,11 @@ function queryUserInfoByCardNo() {
                         $("#userName").val(res.data.name);
                         $("#userName").blur();
                         $("#userNameReadOnly").val(res.data.name);
-                        $("#age").val(res.data.age);
+                        var age =jsGetAge(res.data.birthDayStr);
+                        if(age==null){
+                            age=res.data.age;
+                        }
+                        $("#age").val(age);
                         $("#age").blur();
                         $("#gender").selectpicker('val', res.data.sex);
                         $("#gender").selectpicker('refresh');