Browse Source

手机端实现儿童挂号费用上调

hurugang 4 năm trước cách đây
mục cha
commit
381e4c93c9

+ 1 - 1
src/main/java/cn/hnthyy/thmz/controller/MzyRequestController.java

@@ -493,7 +493,7 @@ public class MzyRequestController {
             }
             MzyZdChargeType mzyZdChargeType=mzyRequestService.calculateAddition(mzyRequestId,birthDayD);
             resultMap.put("code", 0);
-            resultMap.put("message", "根据号别编号查询号别成功");
+            resultMap.put("message", "根据排班主键和生日查询挂号费用成功");
             resultMap.put("data", mzyZdChargeType);
             return resultMap;
         } catch (Exception e) {

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

@@ -1162,6 +1162,11 @@ public class MedicalViewApiController {
     }
 
 
+
+
+
+
+
     /**
      * 查询可以挂号的医生号源信息
      *
@@ -1283,6 +1288,61 @@ public class MedicalViewApiController {
 
 
 
+
+    /**
+     * 根据排班主键和生日查询挂号费用  (费用确认低于7岁儿童增加挂号费 上调50%)
+     *
+     * @return
+     */
+    @RequestMapping(value = "/getMzChargeTypeByRequestIdForHaiCi", method = {RequestMethod.GET})
+    public Map<String, Object> getMzChargeTypeByRequestIdForHaiCi(@RequestParam("mzyRequestId") Long mzyRequestId,@RequestParam("patientId") String patientId) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if (mzyRequestId==null) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "排班主键不能为空");
+                return resultMap;
+            }
+            if (StringUtils.isBlank(patientId)) {
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人门诊ID不能为空");
+                return resultMap;
+            }
+            MzPatientMi mzPatientMi=mzPatientMiService.queryByPatientId(patientId);
+            if(mzPatientMi==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "病人不存在");
+                return resultMap;
+            }
+            Date birthDayD =mzPatientMi.getBirthDay();
+            MzyZdChargeType mzyZdChargeType=mzyRequestService.calculateAddition(mzyRequestId,birthDayD);
+            BigDecimal fee = BigDecimal.ZERO;
+            if(mzyZdChargeType.getReqFee()!=null){
+                fee=fee.add(mzyZdChargeType.getReqFee());
+            }
+            if(mzyZdChargeType.getClinicFee()!=null){
+                fee=fee.add(mzyZdChargeType.getClinicFee());
+            }
+            if(mzyZdChargeType.getOthFee()!=null){
+                fee=fee.add(mzyZdChargeType.getOthFee());
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "根据排班主键和生日查询挂号费用功");
+            resultMap.put("data", fee);
+            resultMap.put("message", mzyZdChargeType.getMessage());
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("根据排班主键和生日查询挂号费用失败,错误信息{}", e.getMessage());
+            resultMap.put("code", -1);
+            resultMap.put("message", "根据排班主键和生日查询挂号费用失败");
+            return resultMap;
+        }
+    }
+
+
+
+
     /**
      * 门诊挂号支付
      *

+ 0 - 1
src/main/java/cn/hnthyy/thmz/entity/his/MzyReqrec.java

@@ -5,7 +5,6 @@ import lombok.Data;
 
 import java.math.BigDecimal;
 import java.util.Date;
-import java.util.List;
 
 /**
  * 门诊挂号记录

+ 2 - 0
src/main/java/cn/hnthyy/thmz/entity/his/MzyZdChargeType.java

@@ -31,5 +31,7 @@ public class MzyZdChargeType {
     private Integer sortNo;
     //打印标志
     private Integer printFlag;
+    //费用条件原因消息
+    private String message;
 
 }

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

@@ -3,6 +3,7 @@ package cn.hnthyy.thmz.pageDto;
 import cn.hnthyy.thmz.entity.his.MzyReqrec;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -30,4 +31,6 @@ public class MzyReqrecPageDto {
     private String phoneNo;
     //病人编号ID集合 (小孩子可能会留大人的电话,大人也有可能有就诊信息)
     private List<String> patientIds;
+    //总付款费用
+    private BigDecimal totalFee;
 }

+ 28 - 3
src/main/java/cn/hnthyy/thmz/service/impl/his/MzyReqrecServiceImpl.java

@@ -135,6 +135,19 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
         MzVisitTable newMzVisitTable = getMzVisitTable(mzyReqrecPageDto, mzyReqrec, mzPatientMi, windows, times, serialNo, now);
         mzVisitTableMapper.insertMzVisitTable(newMzVisitTable);
         fomartReqrec(mzyReqrec, mzPatientMi, windows, mzyZdChargeType, times, serialNo, now, mzyRequest);
+        BigDecimal tempFee =BigDecimal.ZERO;
+        if(mzyReqrec.getOthFee()!=null){
+            tempFee=tempFee.add(mzyReqrec.getOthFee());
+        }
+        if(mzyReqrec.getReqFee()!=null){
+            tempFee=tempFee.add(mzyReqrec.getReqFee());
+        }
+        if(mzyReqrec.getClinicFee()!=null){
+            tempFee=tempFee.add(mzyReqrec.getClinicFee());
+        }
+        if(tempFee.compareTo(mzyReqrecPageDto.getTotalFee())!=0){
+            throw new MzException("当前病人已经挂号失败,实缴费用与实际费用不一致!");
+        }
         //不需要做重复挂号的校验id集合 ,只有入库的时候需要该参数
         mzyReqrec.setCanRepeatedly((jsyChargeTypes.contains(mzyReqrec.getChargeType()) && patientIds.contains(mzyReqrec.getPatientId())) ? YesNoEnum.YES.code : YesNoEnum.NO.code);
         int num = mzyReqrecMapper.insertMzyReqrec(mzyReqrec);
@@ -298,6 +311,18 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
         return mzfzPatientOrder;
     }
 
+    /**
+     *
+     * @param mzyReqrec 挂号对象
+     * @param mzPatientMi 门诊病人
+     * @param windows 窗口记录
+     * @param mzyZdChargeType 收费类型
+     * @param times 挂号次数
+     * @param serialNo 流水号
+     * @param now 当前时间
+     * @param mzyRequest 挂号记录
+     * @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());
@@ -325,9 +350,9 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
             mzyReqrec.setReqFee(BigDecimal.ZERO);
         } else {
             BigDecimal checkFee=BigDecimal.ZERO;
-            if(mzyRequest.getCheckFee()!=null){
-                checkFee=mzyRequest.getCheckFee();
-            }
+//            if(mzyRequest.getCheckFee()!=null){
+//                checkFee=mzyRequest.getCheckFee();
+//            }
             if(mzyZdChargeType.getOthFee()!=null){
                 checkFee=checkFee.add(mzyZdChargeType.getOthFee());
             }

+ 10 - 7
src/main/java/cn/hnthyy/thmz/service/impl/his/MzyRequestServiceImpl.java

@@ -225,23 +225,26 @@ public class MzyRequestServiceImpl implements MzyRequestService {
         if(mzyZdChargeType==null){
             throw new MzException("根据号别编号查询号别失败,没有对应的号别信息");
         }
+        BigDecimal checkFee=mzyRequest.getCheckFee();
+        checkFee=checkFee==null?BigDecimal.ZERO:checkFee;
+        //检查费挂号表没有字段保存,故借用其他费用存放
+        if(mzyZdChargeType.getOthFee()!=null){
+            checkFee=checkFee.add(mzyZdChargeType.getOthFee());
+        }
+        mzyZdChargeType.setOthFee(checkFee);
         if (birthDay!=null) {
             int age=DateUtil.getAge(birthDay);
-            //小于7岁的挂号费上调50%
-            if(age<7){
-                BigDecimal checkFee=mzyRequest.getCheckFee();
-                checkFee=checkFee==null?BigDecimal.ZERO:checkFee;
+            //6岁以内的小朋友挂号费上调50%
+            if(age<=6){
                 if(mzyZdChargeType.getReqFee()!=null){
                     checkFee=checkFee.add(mzyZdChargeType.getReqFee());
                 }
                 if(mzyZdChargeType.getClinicFee()!=null){
                     checkFee=checkFee.add(mzyZdChargeType.getClinicFee());
                 }
-                if(mzyZdChargeType.getOthFee()!=null){
-                    checkFee=checkFee.add(mzyZdChargeType.getOthFee());
-                }
                 BigDecimal tempFee = checkFee.multiply(BigDecimal.valueOf(0.5));
                 mzyZdChargeType.setOthFee(mzyZdChargeType.getOthFee().add(tempFee));
+                mzyZdChargeType.setMessage("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友挂号费上调50%!");
             }
         }
         return mzyZdChargeType;

+ 4 - 3
src/main/resources/static/js/registration.js

@@ -580,8 +580,8 @@ function fitFee() {
             }
             $("#registrationFee").val(res.data.reqFee);
             $("#hospitalFee").val(res.data.clinicFee);
-            $("#othFee").val(res.data.othFee);
-            checkFee = parseFloat(checkFee) + parseFloat(res.data.reqFee) + parseFloat(res.data.clinicFee)+ parseFloat(res.data.othFee);
+            $("#othFee").val(parseFloat(res.data.othFee)-parseFloat(checkFee));
+            checkFee =parseFloat(res.data.reqFee) + parseFloat(res.data.clinicFee)+ parseFloat(res.data.othFee);
             $("#amountMoney").text(checkFee);
             $("#amountMoneyConfirm").text(checkFee);
             $("#realMoney").val(checkFee);
@@ -1448,6 +1448,7 @@ function modifyPatient() {
 function saveMzyReqrec() {
     var mzyRequestId = $('#doctor').find("option:selected").attr('data-mzyRequestId');
     var patientId = $("#patientId").val();
+    var totalFee = $("#realMoney").val();
     $.ajax({
         type: "POST",
         url: '/thmz/saveMzyReqrec',
@@ -1460,7 +1461,7 @@ function saveMzyReqrec() {
                 "unitCode": $("#deptNo").val(),
                 "chargeType": $("#chargeType").val(),
                 "paymode": $("#payType").val(),
-            }, "responceType": $("#patientsNature").val(), "mzyRequestId": mzyRequestId
+            }, "responceType": $("#patientsNature").val(), "mzyRequestId": mzyRequestId, "totalFee": totalFee
         }),
         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
         success: function (res) {