lihong 1 tahun lalu
induk
melakukan
9951dc9ba5

+ 10 - 1
src/main/java/cn/hnthyy/thmz/controller/api/MedicalViewApiController.java

@@ -824,7 +824,8 @@ public class MedicalViewApiController {
                 setAllDepositFile(mzDepositFiles,haiciCharge, Constants.YBJZ,haiciCharge.getFundpayAmt());
             }
             if (haiciCharge.getCouponAmt() !=null && haiciCharge.getCouponAmt().compareTo(BigDecimal.ZERO) == 1) {
-                setAllDepositFile(mzDepositFiles,haiciCharge, Constants.DJZ,haiciCharge.getCouponAmt());
+                BigDecimal tempCouponAmt = calcuCouponAmt(haiciCharge);
+                setAllDepositFile(mzDepositFiles,haiciCharge, Constants.DJZ,tempCouponAmt);
             }
             mzChargeDetailService.chargeFee(whiteList.getOpId(), mzDepositFileVo, whiteList.getOpId());
             results.put("resultCode", 0);
@@ -846,6 +847,14 @@ public class MedicalViewApiController {
         }
     }
 
+    private BigDecimal calcuCouponAmt(HaiciCharge haiciCharge) {
+        BigDecimal temp = haiciCharge.getPayAmt().subtract(Convert.toBigDecimal(haiciCharge.getAcctpayAmt(), BigDecimal.ZERO)).subtract(Convert.toBigDecimal(haiciCharge.getCashpayAmt(), BigDecimal.ZERO)).subtract(Convert.toBigDecimal(haiciCharge.getFundpayAmt(), BigDecimal.ZERO));
+        if(temp.compareTo(haiciCharge.getCouponAmt()) < 0 ){
+            return temp;
+        }
+        return haiciCharge.getCouponAmt();
+    }
+
     private void setAllDepositFile(List<MzDepositFile> mzDepositFiles,HaiciCharge haiciCharge,String chequeType,BigDecimal amount) {
         MzDepositFile mzDepositFile = new MzDepositFile();
         mzDepositFile.setChequeType(chequeType);

+ 12 - 9
src/main/java/cn/hnthyy/thmz/controller/mz/TemplateController.java

@@ -7,20 +7,21 @@ import cn.hnthyy.thmz.entity.MzException;
 import cn.hnthyy.thmz.entity.his.mz.Employee;
 import cn.hnthyy.thmz.entity.thmz.Template;
 import cn.hnthyy.thmz.entity.thmz.User;
-import cn.hnthyy.thmz.entity.thmz.UserRoleRelation;
 import cn.hnthyy.thmz.enums.TemplateKindTypeEnum;
 import cn.hnthyy.thmz.enums.TemplateTypeEnum;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.service.his.mz.EmployeeService;
-import cn.hnthyy.thmz.service.his.zd.DictDataService;
 import cn.hnthyy.thmz.service.thmz.ButtonService;
 import cn.hnthyy.thmz.service.thmz.TemplateService;
-import cn.hnthyy.thmz.service.thmz.UserRoleRelationService;
-import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
@@ -134,10 +135,12 @@ public class TemplateController {
                 return resultMap;
             }
             Template dbTemplate = templateService.queryById(template.getId());
-            if(!buttonService.hasButton(TokenUtil.getUser().getId(),"template_permission")){
-                resultMap.put("code", -1);
-                resultMap.put("message", "您没有停用套餐模板的权限!");
-                return resultMap;
+            if(TemplateKindTypeEnum.TCYH.code.equals(dbTemplate.getTemplateKindType())){
+                if(!buttonService.hasButton(TokenUtil.getUser().getId(),"template_permission")){
+                    resultMap.put("code", -1);
+                    resultMap.put("message", "您没有停用套餐模板的权限!");
+                    return resultMap;
+                }
             }
             dbTemplate.setTemplateStatus(YesNoEnum.YES.code);
             User tokenUser = TokenUtil.getUser(httpServletRequest);

+ 1 - 1
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzyReqrecServiceImpl.java

@@ -248,7 +248,7 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
             tempFee = tempFee.add(mzyReqrec.getBlbFee());
         }
         BigDecimal tempTotalFee = mzyReqrecPageDto.getCouponAmt() != null && mzyReqrecPageDto.getCouponAmt().compareTo(BigDecimal.ZERO) == 1 ? mzyReqrecPageDto.getTotalFee().subtract(mzyReqrecPageDto.getCouponAmt()) : mzyReqrecPageDto.getTotalFee();
-        if (PayMarkEnum.CHARGED.code.equals(mzyReqrecPageDto.getPayMark()) && tempFee.compareTo(tempTotalFee) != 0) {
+        if (PayMarkEnum.CHARGED.code.equals(mzyReqrecPageDto.getPayMark()) && tempTotalFee.compareTo(BigDecimal.ZERO) > 0 &&  tempFee.compareTo(tempTotalFee) != 0) {
             throw new MzException("当前病人已经挂号失败,实缴费用与实际费用不一致!");
         }
         //不需要做重复挂号的校验id集合 ,只有入库的时候需要该参数

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

@@ -4099,8 +4099,11 @@ function initTemplateTypeSelect(templateTypeId) {
                     $('#' + templateTypeId).append(html);
                 });
                 $('#' + templateTypeId).selectpicker('refresh');
-                // $('#'+templateTypeId).selectpicker('val', "0");
-                // $('#'+templateTypeId).selectpicker('refresh');
+                if(templateTypeId =='templateTypeForm'){
+                    $('#'+templateTypeId).selectpicker('val', "0");
+                    $('#'+templateTypeId).selectpicker('refresh');
+                    fitTemplateData()
+                }
             } else {
                 errorMesage(res);
             }