Bläddra i källkod

解决历史数据清洗问题

hurugang 4 år sedan
förälder
incheckning
9a6df3bfef

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

@@ -1413,48 +1413,48 @@ public class MzChargeDetailController {
 
 
 
-    /**
-     * 同步备份库数据到正式库 修复记账的数据
-     * @param mzChargeDetail 新收费方式
-     * @return
-     */
-    @UserLoginToken
-    @RequestMapping(value = "/reSaveDetailForByjz", method = {RequestMethod.POST})
-    public Map<String, Object> reSaveDetailForByjz(@RequestBody MzChargeDetail mzChargeDetail) {
-        Map<String, Object> resultMap = new HashMap<>();
-        try {
-            if(mzChargeDetail==null){
-                resultMap.put("code", -1);
-                resultMap.put("message", "参数不能为空");
-                return resultMap;
-            }
-            if(StringUtils.isBlank(mzChargeDetail.getPatientId())){
-                resultMap.put("code", -1);
-                resultMap.put("message", "患者ID不能为空");
-                return resultMap;
-            }
-            if(mzChargeDetail.getTimes()==null){
-                resultMap.put("code", -1);
-                resultMap.put("message", "就诊次数不能为空");
-                return resultMap;
-            }
-            if (mzChargeDetail.getReceiptNo()==null) {
-                resultMap.put("code", -1);
-                resultMap.put("message", "缴费次数不能为空");
-                return resultMap;
-            }
-            mzChargeDetailService.reSaveDetailFromBak(mzChargeDetail);
-            resultMap.put("code", 0);
-            resultMap.put("message", "同步备份库数据到正式库成功");
-            return resultMap;
-        } catch (Exception e) {
-            e.printStackTrace();
-            resultMap.put("code", -1);
-            resultMap.put("message", e.getMessage());
-            log.error("同步备份库数据到正式库失败,系统异常,错误信息{}", e.getMessage());
-            return resultMap;
-        }
-    }
+//    /**
+//     * 同步备份库数据到正式库 修复记账的数据
+//     * @param mzChargeDetail 新收费方式
+//     * @return
+//     */
+//    @UserLoginToken
+//    @RequestMapping(value = "/reSaveDetailForByjz", method = {RequestMethod.POST})
+//    public Map<String, Object> reSaveDetailForByjz(@RequestBody MzChargeDetail mzChargeDetail) {
+//        Map<String, Object> resultMap = new HashMap<>();
+//        try {
+//            if(mzChargeDetail==null){
+//                resultMap.put("code", -1);
+//                resultMap.put("message", "参数不能为空");
+//                return resultMap;
+//            }
+//            if(StringUtils.isBlank(mzChargeDetail.getPatientId())){
+//                resultMap.put("code", -1);
+//                resultMap.put("message", "患者ID不能为空");
+//                return resultMap;
+//            }
+//            if(mzChargeDetail.getTimes()==null){
+//                resultMap.put("code", -1);
+//                resultMap.put("message", "就诊次数不能为空");
+//                return resultMap;
+//            }
+//            if (mzChargeDetail.getReceiptNo()==null) {
+//                resultMap.put("code", -1);
+//                resultMap.put("message", "缴费次数不能为空");
+//                return resultMap;
+//            }
+//            mzChargeDetailService.reSaveDetailFromBak(mzChargeDetail);
+//            resultMap.put("code", 0);
+//            resultMap.put("message", "同步备份库数据到正式库成功");
+//            return resultMap;
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//            resultMap.put("code", -1);
+//            resultMap.put("message", e.getMessage());
+//            log.error("同步备份库数据到正式库失败,系统异常,错误信息{}", e.getMessage());
+//            return resultMap;
+//        }
+//    }
 
 
 

+ 6 - 6
src/main/java/cn/hnthyy/thmz/service/his/mz/MzChargeDetailService.java

@@ -304,10 +304,10 @@ public interface MzChargeDetailService {
     int modifyChequType( String chequeType,Integer receiptSn,String oldChequeType) throws MzException;
 
 
-    /**
-     * 同步备份库数据到正式库 修复记账的数据
-     * @param mzChargeDetail
-     * @return
-     */
-    int reSaveDetailFromBak(MzChargeDetail mzChargeDetail);
+//    /**
+//     * 同步备份库数据到正式库 修复记账的数据
+//     * @param mzChargeDetail
+//     * @return
+//     */
+//    int reSaveDetailFromBak(MzChargeDetail mzChargeDetail);
 }

+ 19 - 13
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -559,20 +559,26 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
     public int chargeFeeForByjz(String opId, MzDepositFileVo mzDepositFileVo) throws MzException {
         Date now = new Date();
         int serialNo = mzSerialNoService.getSerialNo();
-        //如果有欠费记账的收费,新增退费重收记录
-//        List<MzChargeDetail> newMzChargeDetailList = getMzChargeDetails(opId, mzDepositFileVo, now, serialNo);
-//        getMzChargeDetailService().saveMzChargeDetail(newMzChargeDetailList);
         List<MzDepositFile> newMzDepositFileList = getMzDepositFiles(mzDepositFileVo, now, serialNo, opId);
         if (newMzDepositFileList.size() > 0 && mzDepositFileMapper.selectBySameParams(newMzDepositFileList.get(0)) > 0) {
             throw new MzException("当前病人本次处方已经成功缴费,无需重复缴费");
         }
-        //本院记账需要把原缴费记录保存
+        //如果当前数据是在备份库中,那么久会还原到正式库
         List<MzChargeDetail> mzChargeDetailList = mzChargeDetailMapper.selectByPatientIdAndTimesAndReceiptNo(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
+        MzChargeDetail mzChargeDetail = new MzChargeDetail(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
+        mzChargeDetail.setReceiptNo(mzDepositFileVo.getReceiptNo());
+        if(mzChargeDetailList==null || mzChargeDetailList.size()==0){
+            mzChargeDetailMapper.reInsertDetail(mzChargeDetail);
+            mzChargeDetailMapper.deleteFromBak(mzChargeDetail);
+            mzChargeDetail.setChequType(Constants.BYJZ);
+            mzChargeDetailMapper.updateMzChargeDetailFull(mzChargeDetail);
+        }
+        //本院记账需要把原缴费记录保存
+        mzChargeDetailList = mzChargeDetailMapper.selectByPatientIdAndTimesAndReceiptNo(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes(), mzDepositFileVo.getReceiptNo());
         mzDepositFileService.batchSaveMzDepositFile(newMzDepositFileList);
         List<MzReceiptSerial> newMzReceiptSerialList = getMzReceiptSerials(opId, mzDepositFileVo, now, serialNo);
         mzReceiptSerialService.batchSaveMzReceiptSerial(newMzReceiptSerialList);
         //将新生成的收费流水号设置到收费明细
-        MzChargeDetail mzChargeDetail = new MzChargeDetail(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
         mzChargeDetail.setSerialNo(serialNo);
         mzChargeDetail.setRealNo(serialNo);
         mzChargeDetail.setReceiptNo(mzDepositFileVo.getReceiptNo());
@@ -958,14 +964,14 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         return 1;
     }
 
-    @Override
-    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
-    public int reSaveDetailFromBak(MzChargeDetail mzChargeDetail) {
-        mzChargeDetailMapper.reInsertDetail(mzChargeDetail);
-        mzChargeDetailMapper.deleteFromBak(mzChargeDetail);
-        mzChargeDetail.setChequType(Constants.BYJZ);
-        return  mzChargeDetailMapper.updateMzChargeDetailFull(mzChargeDetail);
-    }
+//    @Override
+//    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
+//    public int reSaveDetailFromBak(MzChargeDetail mzChargeDetail) {
+//        mzChargeDetailMapper.reInsertDetail(mzChargeDetail);
+//        mzChargeDetailMapper.deleteFromBak(mzChargeDetail);
+//        mzChargeDetail.setChequType(Constants.BYJZ);
+//        return  mzChargeDetailMapper.updateMzChargeDetailFull(mzChargeDetail);
+//    }
 
 
     /**

+ 4 - 4
src/main/resources/static/js/actpatient.js

@@ -350,10 +350,10 @@ function initFeeTable() {
                 // sortable: true,
                 formatter: function (value, row, index) {
                     var str = '';
-                    str += '<button type="button" class="registration-no-color-foot-button"title="出院结算" onclick="settlement(\'' + row.inpatientNo + '\',' + row.admissTimes + ')"><i class="fa fa-credit-card"></i></button>';
-                    // if (row.settleType == 0){
-                    //     str += '<button type="button" class="registration-no-color-foot-button"title="出院结算" onclick="settlement(\'' + row.inpatientNo + '\',' + row.admissTimes + ')"><i class="fa fa-credit-card"></i></button>';
-                    // }
+                   // str += '<button type="button" class="registration-no-color-foot-button"title="出院结算" onclick="settlement(\'' + row.inpatientNo + '\',' + row.admissTimes + ')"><i class="fa fa-credit-card"></i></button>';
+                    if (row.settleType == 0){
+                        str += '<button type="button" class="registration-no-color-foot-button"title="出院结算" onclick="settlement(\'' + row.inpatientNo + '\',' + row.admissTimes + ')"><i class="fa fa-credit-card"></i></button>';
+                    }
                     var payMarkGroup = getIndex("pay_mark_group");
                     if (payMarkGroup == 0) {
                         //  str += '<button type="button" class="registration-no-color-foot-button"title="出院结算" onclick="settlement(\'' + row.inpatientNo + '\',' + row.admissTimes + ')"><i class="fa fa-credit-card"></i></button>';

+ 46 - 45
src/main/resources/static/js/toll_administration.js

@@ -1208,16 +1208,17 @@ function initTallyDetailTable() {
                 formatter: function (value, row, index) {
                     return format(value, "yyyy-MM-dd HH:mm:ss");
                 }
-            }, {
-                title: '操作',
-                align: "center",
-                valign: 'middle',
-                // sortable: true,
-                formatter: function (value, row, index) {
-                    var str = '<button type="button" class="registration-no-color-foot-button" title="同步费用明细" onclick="reInsertDetailModal(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ')"><i class="fa fa-exchange"></i></button>';
-                    return str;
-                }
             }
+            // , {
+            //     title: '操作',
+            //     align: "center",
+            //     valign: 'middle',
+            //     // sortable: true,
+            //     formatter: function (value, row, index) {
+            //         var str = '<button type="button" class="registration-no-color-foot-button" title="同步费用明细" onclick="reInsertDetailModal(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ')"><i class="fa fa-exchange"></i></button>';
+            //         return str;
+            //     }
+            // }
         ],
         /**
          * @param {点击列的 field 名称} field
@@ -2486,39 +2487,39 @@ function clearEditPayMode() {
     $("#chequType").val(null);
 }
 
-
-/**
- * 反写备份表的数据到正式表中,记账的数据在备分表
- * @param patientId
- * @param times
- * @param receiptNo
- */
-function reInsertDetailModal(patientId,times ,receiptNo) {
-    $.ajax({
-        type: "POST",
-        url: '/thmz/reSaveDetailForByjz',
-        contentType: "application/json;charset=UTF-8",
-        dataType: "json",
-        data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
-        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
-        async: false,
-        success: function (res) {
-            if (res == '401' || res == 401) {
-                window.location.href = '/thmz/login/view'
-                return;
-            }
-            if (res.code == 0) {
-               successMesage(res);
-               initFeeTable();
-            } else {
-                new PNotify({
-                    title: '错误提示',
-                    text: res.message,
-                    type: 'error',
-                    hide: true,
-                    styling: 'bootstrap3'
-                });
-            }
-        }
-    });
-}
+//
+// /**
+//  * 反写备份表的数据到正式表中,记账的数据在备分表
+//  * @param patientId
+//  * @param times
+//  * @param receiptNo
+//  */
+// function reInsertDetailModal(patientId,times ,receiptNo) {
+//     $.ajax({
+//         type: "POST",
+//         url: '/thmz/reSaveDetailForByjz',
+//         contentType: "application/json;charset=UTF-8",
+//         dataType: "json",
+//         data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
+//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+//         async: false,
+//         success: function (res) {
+//             if (res == '401' || res == 401) {
+//                 window.location.href = '/thmz/login/view'
+//                 return;
+//             }
+//             if (res.code == 0) {
+//                successMesage(res);
+//                initFeeTable();
+//             } else {
+//                 new PNotify({
+//                     title: '错误提示',
+//                     text: res.message,
+//                     type: 'error',
+//                     hide: true,
+//                     styling: 'bootstrap3'
+//                 });
+//             }
+//         }
+//     });
+// }