ソースを参照

退费还原号表

hurugang 5 年 前
コミット
bad87b22f3

+ 3 - 3
src/main/java/cn/hnthyy/thmz/controller/ChargeFeeVoController.java

@@ -702,9 +702,9 @@ public class ChargeFeeVoController {
                 resultMap.put("message", "存在退费后发票未重打的发票信息,请 处理后再结账!");
                 return resultMap;
             }
-           // Date dcountDate = chargeFeeVoService.dcountCharge(tokenUser.getUserIdCode());
-            //resultMap.put("dcountDate", dcountDate);
-            resultMap.put("dcountDate", new Date());
+            Date dcountDate = chargeFeeVoService.dcountCharge(tokenUser.getUserIdCode());
+            resultMap.put("dcountDate", dcountDate);
+            //resultMap.put("dcountDate", new Date());
             resultMap.put("code", 0);
             resultMap.put("message", "费用结算成功");
             return resultMap;

+ 26 - 0
src/main/java/cn/hnthyy/thmz/entity/thmz/ReqrecRequestRelation.java

@@ -0,0 +1,26 @@
+package cn.hnthyy.thmz.entity.thmz;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 挂号与号表关系
+ */
+@Data
+public class ReqrecRequestRelation {
+    //主键
+    private Long id;
+    //号表主键
+    private Long requestId;
+    //挂号流水号
+    private Integer serialNo;
+    //操作时间
+    private Date opDate;
+
+    public ReqrecRequestRelation(Long requestId, Integer serialNo) {
+        this.requestId = requestId;
+        this.serialNo = serialNo;
+        this.opDate=new Date();
+    }
+}

+ 9 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/MzyRequestMapper.java

@@ -141,4 +141,13 @@ public interface MzyRequestMapper {
             "</when>",
             "</script>"})
     List<MzyRequest> selectOldRequestByRequestDay(@Param("requestDay") String requestDay, @Param("unitCode") String unitCode, @Param("ampm") String ampm, @Param("chargeType") String chargeType, @Param("doctorCode") String doctorCode);
+
+    /**
+     * 退号时需要将号表数据返回
+     * @param id
+     * @return
+     */
+    @Update("update mzy_request_new set bespeak_no=bespeak_no-1,left_num=left_num+1 where id=#{id}")
+    int updateLeftNumById(@Param("id") Long id);
+
 }

+ 26 - 0
src/main/java/cn/hnthyy/thmz/mapper/thmz/ReqrecRequestRelationMapper.java

@@ -0,0 +1,26 @@
+package cn.hnthyy.thmz.mapper.thmz;
+
+import cn.hnthyy.thmz.entity.thmz.ReqrecRequestRelation;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+public interface ReqrecRequestRelationMapper {
+    /**
+     * 新增挂号关系
+     *
+     * @param reqrecRequestRelation
+     * @return
+     */
+    @Insert("INSERT INTO t_reqrec_request_relation(request_id,serial_no,op_date) VALUES (#{requestId,jdbcType=BIGINT}," +
+            "#{serialNo,jdbcType=INTEGER},#{opDate,jdbcType=TIMESTAMP})")
+    int insertReqrecRequestRelation(ReqrecRequestRelation reqrecRequestRelation);
+
+    /**
+     * 根据流水号查询关系记录
+     * @param serialNo
+     * @return
+     */
+    @Select("select * from t_reqrec_request_relation where serial_no =#{serialNo,jdbcType=INTEGER}")
+    ReqrecRequestRelation selectReqrecRequestRelation(@Param("serialNo") Integer serialNo);
+}

+ 16 - 4
src/main/java/cn/hnthyy/thmz/service/impl/his/MzyReqrecServiceImpl.java

@@ -4,11 +4,13 @@ import cn.hnthyy.thmz.common.Constants;
 import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.*;
 import cn.hnthyy.thmz.entity.thmz.Receipt;
+import cn.hnthyy.thmz.entity.thmz.ReqrecRequestRelation;
 import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.entity.thmz.Windows;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.mapper.his.*;
 import cn.hnthyy.thmz.mapper.thmz.ReceiptMapper;
+import cn.hnthyy.thmz.mapper.thmz.ReqrecRequestRelationMapper;
 import cn.hnthyy.thmz.mapper.thmz.WindowsMapper;
 import cn.hnthyy.thmz.service.his.MzSerialNoService;
 import cn.hnthyy.thmz.service.his.MzfzConfigService;
@@ -55,12 +57,16 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
     @SuppressWarnings("all")
     @Autowired
     private MzReceiptSerialMapper mzReceiptSerialMapper;
+    @SuppressWarnings("all")
+    @Autowired
+    private ReqrecRequestRelationMapper reqrecRequestRelationMapper;
     @Autowired
     private MzyRequestService mzyRequestService;
     @Autowired
     private MzSerialNoService mzSerialNoService;
     @Autowired
     private MzfzConfigService mzfzConfigService;
+
     @Override
     @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,timeout=36000,rollbackFor=Exception.class)
     public int saveMzyReqrec(MzyReqrecPageDto mzyReqrecPageDto) throws MzException {
@@ -88,10 +94,11 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
         }
         times++;
         int serialNo=mzSerialNoService.getMzSerialNo();
+        MzyRequest mzyRequest=mzyRequestMapper.selectMzyRequestById(mzyReqrecPageDto.getMzyRequestId());
         Date now = new Date();
         MzVisitTable newMzVisitTable = getMzVisitTable(mzyReqrecPageDto, mzyReqrec, mzPatientMi, windows, times, serialNo, now);
         mzVisitTableMapper.insertMzVisitTable(newMzVisitTable);
-        fomartReqrec(mzyReqrecPageDto, mzyReqrec, mzPatientMi, windows, mzyZdChargeType, times, serialNo, now);
+        fomartReqrec(mzyReqrec, mzPatientMi, windows, mzyZdChargeType, times, serialNo, now, mzyRequest);
         mzyReqrecMapper.insertMzyReqrec(mzyReqrec);
         MzfzPatientOrder mzfzPatientOrder = getMzfzPatientOrder(mzyReqrec, mzPatientMi, times, serialNo, now);
         mzfzPatientOrderMapper.insertMzfzPatientOrder(mzfzPatientOrder);
@@ -100,6 +107,8 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
         updateMzPatientMi.setTimes(times);
         updateMzPatientMi.setLvDate(now);
         mzPatientMiMapper.updateMzPatientMi(updateMzPatientMi);
+        ReqrecRequestRelation reqrecRequestRelation = new ReqrecRequestRelation(mzyRequest.getId(),serialNo);
+        reqrecRequestRelationMapper.insertReqrecRequestRelation(reqrecRequestRelation);
         return 1;
     }
 
@@ -120,11 +129,10 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
         return mzfzPatientOrder;
     }
 
-    private void fomartReqrec(MzyReqrecPageDto mzyReqrecPageDto, MzyReqrec mzyReqrec, MzPatientMi mzPatientMi, Windows windows, MzyZdChargeType mzyZdChargeType, int times, int serialNo, Date now) throws MzException {
+    private void fomartReqrec( MzyReqrec mzyReqrec, MzPatientMi mzPatientMi, Windows windows, MzyZdChargeType mzyZdChargeType, int times, int serialNo, Date now,MzyRequest mzyRequest) throws MzException {
         mzyReqrec.setTimes(times);
         mzyReqrec.setName(mzPatientMi.getName());
         mzyReqrec.setRequestDay(now);
-        MzyRequest mzyRequest=mzyRequestMapper.selectMzyRequestById(mzyReqrecPageDto.getMzyRequestId());
         Integer reqOrder= mzyRequestService.getReqOrder(mzyRequest);
         mzyReqrec.setReqOrder(reqOrder);
         mzyReqrec.setReqFee(mzyZdChargeType.getReqFee());
@@ -195,6 +203,10 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
             mzVisitTableMapper.updateMzVisitTable(mzVisitTable);
             //将原记录查出,并设置相关字段为负数,新增该记录,用于费用统计
             MzyReqrec dbMzyReqrec=mzyReqrecMapper.selectMzyReqrecByPatientIdAndTimes(mzyReqrec.getPatientId(),mzyReqrec.getTimes());
+            ReqrecRequestRelation reqrecRequestRelation=reqrecRequestRelationMapper.selectReqrecRequestRelation(dbMzyReqrec.getSerialNo());
+            if(reqrecRequestRelation!=null && reqrecRequestRelation.getRequestId()!=null){
+                mzyRequestMapper.updateLeftNumById(reqrecRequestRelation.getRequestId());
+            }
             dbMzyReqrec.setTimes(-dbMzyReqrec.getTimes());
             dbMzyReqrec.setReqFee(BigDecimal.ZERO.subtract(dbMzyReqrec.getReqFee()));
             dbMzyReqrec.setClinicFee(BigDecimal.ZERO.subtract(dbMzyReqrec.getClinicFee()));
@@ -207,7 +219,7 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
             dbMzyReqrec.setClosingDate(null);
             dbMzyReqrec.setChargeType(Constants.CASH);
             mzyReqrecMapper.insertMzyReqrec(dbMzyReqrec);
-
+            reqrecRequestRelationMapper.selectReqrecRequestRelation(dbMzyReqrec.getSerialNo());
         }
         return mzyReqrecMapper.updateMzyReqrec(mzyReqrec);
     }

+ 8 - 7
src/main/resources/static/js/daily.js

@@ -82,18 +82,19 @@ function extractedSf (res,flag) {
     if (res.chargeCountVo.yhkss != null) {
         $("#yhkss").html(res.chargeCountVo.yhkss.toFixed(2));
     }
-    //医保卡卡收款
-    $("#ybjzbs").html(res.chargeCountVo.ybjzbs);
+    //医保卡记账收款
+    //医保卡记账卡收款
+    $("#ybkjzbs").html(res.chargeCountVo.ybjzbs);
     if (res.chargeCountVo.ybjzsk != null) {
-        $("#ybjzsk").html(res.chargeCountVo.ybjzsk.toFixed(2));
+        $("#ybkjzsk").html(res.chargeCountVo.ybjzsk.toFixed(2));
     }
-    $("#ybjztfbs").html(res.chargeCountVo.ybjztfbs);
+    $("#ybkjztfbs").html(res.chargeCountVo.ybjztfbs);
     if (res.chargeCountVo.ybjztf != null) {
-        $("#ybjztf").html(res.chargeCountVo.ybjztf.toFixed(2));
+        $("#ybkjztf").html(res.chargeCountVo.ybjztf.toFixed(2));
     }
-    $("#ybjzssbs").html(res.chargeCountVo.ybjzssbs);
+    $("#ybkjzssbs").html(res.chargeCountVo.ybjzssbs);
     if (res.chargeCountVo.ybjzss != null) {
-        $("#ybjzss").html(res.chargeCountVo.ybjzss.toFixed(2));
+        $("#ybkjzss").html(res.chargeCountVo.ybjzss.toFixed(2));
     }
     if(flag){
         //支付宝自助收款

+ 6 - 6
src/main/resources/static/js/daily_repeat_print.js

@@ -89,17 +89,17 @@ function extractedSf (res,flag) {
         $("#yhkss").html(res.chargeCountVo.yhkss.toFixed(2));
     }
     //医保卡记账卡收款
-    $("#ybjzbs").html(res.chargeCountVo.ybjzbs);
+    $("#ybkjzbs").html(res.chargeCountVo.ybjzbs);
     if (res.chargeCountVo.ybjzsk != null) {
-        $("#ybjzsk").html(res.chargeCountVo.ybjzsk.toFixed(2));
+        $("#ybkjzsk").html(res.chargeCountVo.ybjzsk.toFixed(2));
     }
-    $("#ybjztfbs").html(res.chargeCountVo.ybjztfbs);
+    $("#ybkjztfbs").html(res.chargeCountVo.ybjztfbs);
     if (res.chargeCountVo.ybjztf != null) {
-        $("#ybjztf").html(res.chargeCountVo.ybjztf.toFixed(2));
+        $("#ybkjztf").html(res.chargeCountVo.ybjztf.toFixed(2));
     }
-    $("#ybjzssbs").html(res.chargeCountVo.ybjzssbs);
+    $("#ybkjzssbs").html(res.chargeCountVo.ybjzssbs);
     if (res.chargeCountVo.ybjzss != null) {
-        $("#ybjzss").html(res.chargeCountVo.ybjzss.toFixed(2));
+        $("#ybkjzss").html(res.chargeCountVo.ybjzss.toFixed(2));
     }
     if(flag){
         //支付宝自助收款