Browse Source

开处方增加挂号费优化

lihong 5 months ago
parent
commit
3d5db15c0f

+ 17 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/zd/ZdChargeItemMapper.java

@@ -377,4 +377,21 @@ public interface ZdChargeItemMapper {
      **/
     @Select(" select rtrim(code) code from  view_mz_zd_yp_ysh where group_no  in (${groupNo}) and  code in (${chargeCode})")
     List<String> selectZyChargeCodes(@Param("groupNo") String groupNo,@Param("chargeCode") String chargeCode);
+    @Select(" select cast(t2.req_fee + t2.clinic_fee + t2.oth_fee as decimal(18, 2)) charge_amount, " +
+            "       t3.code, " +
+            "       t3.exec_unit, " +
+            "       t3.name, " +
+            "       t3.bill_item_mz," +
+            "       t3.charge_unit," +
+            "       t3.group_no"+
+            " from a_employee_mi t1, " +
+            "     mzy_zd_charge_type t2, " +
+            "     zd_charge_item t3 " +
+            " " +
+            " where t1.gh_charge_type = t2.code " +
+            "  and t2.charge_code = t3.code " +
+            "  and isnull(t3.del_flag,'') !=1 " +
+            "  and isnull(t2.del_flag, '') != 1 " +
+            "  and t1.code = #{doctorCode} ")
+    ZdChargeItem selectZdChargeItemGhFeeByEmpCode(String doctorCode);
 }

+ 8 - 0
src/main/java/cn/hnthyy/thmz/service/his/zd/ZdChargeItemService.java

@@ -91,4 +91,12 @@ public interface ZdChargeItemService {
      * @return
      */
     List<Map<String,Object>> queryZlItemByCommonParams(String commonParams);
+    /**
+     * @description: 查询医生的挂号费用
+     * @author: lihong
+     * @date: 2025/5/15 14:45
+     * @param: doctorCode
+     * @return: cn.hnthyy.thmz.entity.his.zd.ZdChargeItem
+     **/
+    ZdChargeItem queryZdChargeItemGhFeeByEmpCode(String doctorCode);
 }

+ 88 - 3
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -1620,6 +1620,90 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         }
         return clinic;
     }
+    /**
+     * @description: 增加挂号费用明细
+     * @author: lihong
+     * @date: 2025/5/15 15:21
+     * @param: mzPrescriptionVo
+     * @param: times
+     * @param: mzPatientMi
+     **/
+    private void setGhFeePrescriptionVo(MzPrescriptionVo mzPrescriptionVo,Integer times,MzPatientMi mzPatientMi)throws MzException {
+        if(StrUtil.isBlank(mzPrescriptionVo.getDoctorCode()) || StrUtil.isBlank(mzPrescriptionVo.getPatientId()) || mzPatientMi == null){
+            return;
+        }
+        if(CollUtil.isNotEmpty(mzPrescriptionVo.getMzChargeDetailList()) && mzPrescriptionVo.getMzChargeDetailList().stream().anyMatch(item->Constants.GHF.equals(item.getBillItemCode()))){
+        //    先删除防止重复
+            List<MzChargeDetail> mzChargeDetailList = mzPrescriptionVo.getMzChargeDetailList();
+            Iterator<MzChargeDetail> iterator = mzChargeDetailList.iterator();
+            while (iterator.hasNext()){
+                MzChargeDetail chargeDetail = iterator.next();
+                if(Constants.GHF.equals(chargeDetail.getBillItemCode())){
+                    iterator.remove();
+                }
+            }
+        }
+        if(NumberEnum.ONE.getCode().equals(mzPrescriptionVo.getGhFeeFlag())){
+           ZdChargeItem zdChargeItem = zdChargeItemService.queryZdChargeItemGhFeeByEmpCode(mzPrescriptionVo.getDoctorCode());
+           if(zdChargeItem == null || zdChargeItem.getChargeAmount() == null || BigDecimal.ZERO.compareTo(zdChargeItem.getChargeAmount()) == 0){
+               throw new MzException("选择收取挂号费,您未配置收取的挂号类别或配置的费用已停用,请先配置!");
+           }
+            Integer maxOrderNo = 1;
+            if(CollUtil.isNotEmpty(mzPrescriptionVo.getMzChargeDetailList())){
+                maxOrderNo = mzPrescriptionVo.getMzChargeDetailList().stream().map(item -> Convert.toInt(item.getOrderNo(), 0)).max(Integer::compareTo).get() + 1;
+            }
+            else {
+                mzPrescriptionVo.setMzChargeDetailList(new ArrayList<>());
+            }
+            MzChargeDetail newMzChargeDetail = new MzChargeDetail();
+            newMzChargeDetail.setPatientId(mzPrescriptionVo.getPatientId());
+            newMzChargeDetail.setTimes(times);
+            newMzChargeDetail.setReceiptNo(0);
+            newMzChargeDetail.setOrderNo(maxOrderNo);
+            newMzChargeDetail.setItemNo(1);
+            newMzChargeDetail.setChargeItemCode(zdChargeItem.getCode());
+            newMzChargeDetail.setDrugUnit(zdChargeItem.getChargeUnit());
+            newMzChargeDetail.setDrugQuan(1D);
+            newMzChargeDetail.setUnitPrice(zdChargeItem.getChargeAmount());
+            newMzChargeDetail.setBillItemCode(Constants.GHF);
+            newMzChargeDetail.setOrigPrice(zdChargeItem.getChargeAmount());
+            newMzChargeDetail.setQuantity(1D);
+            newMzChargeDetail.setPayMark(PayMarkEnum.NO_CHARGE.code);
+            newMzChargeDetail.setSerial("");
+            newMzChargeDetail.setSerialNo(0);
+            newMzChargeDetail.setName(mzPatientMi.getName());
+            newMzChargeDetail.setGroupNo(StrUtil.isBlank(zdChargeItem.getGroupNo())? Constants.YJ_GROUP_NO : zdChargeItem.getGroupNo());
+            newMzChargeDetail.setDrugWin(1);
+            newMzChargeDetail.setPriceId(mzPrescriptionVo.getDoctorCode());
+            newMzChargeDetail.setPriceTime(new Date());
+            newMzChargeDetail.setExecDept(zdChargeItem.getExecUnit());
+            newMzChargeDetail.setPrintFlag(YesNoEnum.NO.code.toString());
+            newMzChargeDetail.setConfirmFlag(ConfirmFlagEnum.NOT_CONFIRM.code);
+            newMzChargeDetail.setWarnDept(mzPrescriptionVo.getVisitDeptCode());
+            newMzChargeDetail.setJzFlag("0");
+            newMzChargeDetail.setDoctorCode(mzPrescriptionVo.getDoctorCode());
+            newMzChargeDetail.setDoctorFlag(YesNoEnum.YES.code.toString());
+            newMzChargeDetail.setInjectRes(Double.valueOf(YesNoEnum.YES.code));
+            newMzChargeDetail.setRealNo(0);
+            newMzChargeDetail.setYbbxFlag(YesNoEnum.NO.code.toString());
+            newMzChargeDetail.setTcNo("");
+            newMzChargeDetail.setOrderDays(1);
+            newMzChargeDetail.setPaySelf("0");
+            newMzChargeDetail.setTcName(zdChargeItem.getName());
+            newMzChargeDetail.setDetailFlag(YesNoEnum.NO.code.toString());
+            newMzChargeDetail.setOrderType(YesNoEnum.YES.code.toString());
+            newMzChargeDetail.setSupplyNo("");
+            newMzChargeDetail.setGroupType(GroupTypeEnum.DIAGNOSIS.code);
+            newMzChargeDetail.setOrderBill(100);
+            String chargeBillCode = Constants.BILL_ITEM_CODE_prev + zdChargeItem.getBillItemMz().substring(1);
+            newMzChargeDetail.setChargeBillCode(chargeBillCode);
+            newMzChargeDetail.setSelfFlag(YesNoEnum.NO.code.toString());
+            newMzChargeDetail.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
+            newMzChargeDetail.setReqYj(YesNoEnum.NO.code.toString());
+            newMzChargeDetail.setGroupId(YesNoEnum.NO.code);
+            mzPrescriptionVo.getMzChargeDetailList().add(newMzChargeDetail);
+        }
+    }
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
@@ -3002,7 +3086,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 patientAllergenInfo.setPatNo(mzPrescriptionVo.getPatientId());
             }
         }
-
+        //收费挂号费处方,增加挂号费
+        setGhFeePrescriptionVo(mzPrescriptionVo,times,mzPatientMi);
       //设置外配药
       if(CollUtil.isNotEmpty(mzPrescriptionVo.getRxDruginfoList())){
           String hospRxno = IdUtil.simpleUUID();
@@ -7410,7 +7495,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
        if(zyActpatientService.checkZaiYuan(mzPrescriptionVo.getPatientId())){
            throw new MzException("病人已经在住院,不能再开门诊处方");
        }
-       if(mzPrescriptionVo.getOrderType() == 5 && CollUtil.isEmpty(mzPrescriptionVo.getWxmallPackagePurchasedItemList())){
+       if(Convert.toInt(mzPrescriptionVo.getOrderType(),1) == 5 && CollUtil.isEmpty(mzPrescriptionVo.getWxmallPackagePurchasedItemList())){
            throw new MzException("开具商城处方,必须选择商城项目明细!");
        }
         if(!wxmallPackagePurchasedItemService.checkWxMallPrescription(mzPrescriptionVo)){
@@ -7437,7 +7522,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 getMzChargeDetailService().chargeFee(Constants.BRZZJF_CODE, mzDepositFileVo, Constants.BRZZJF_CODE);
             }
         }
-        else if(mzPrescriptionVo.getOrderType() == 5){
+        else if(Convert.toInt(mzPrescriptionVo.getOrderType(),1) == 5){
             setMallPrescription(mzPrescriptionVo);
             insertClinic = getMzChargeDetailService().savePrescription(mzPrescriptionVo, dbClinic, false);
             if(insertClinic !=null && insertClinic.getId() != null){

+ 13 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/zd/ZdChargeItemServiceImpl.java

@@ -109,4 +109,17 @@ public class ZdChargeItemServiceImpl implements ZdChargeItemService {
         }
         return zlList;
     }
+
+    /**
+     * @param doctorCode
+     * @description: 查询医生的挂号费用
+     * @author: lihong
+     * @date: 2025/5/15 14:45
+     * @param: doctorCode
+     * @return: cn.hnthyy.thmz.entity.his.zd.ZdChargeItem
+     */
+    @Override
+    public ZdChargeItem queryZdChargeItemGhFeeByEmpCode(String doctorCode) {
+        return zdChargeItemMapper.selectZdChargeItemGhFeeByEmpCode(doctorCode);
+    }
 }

+ 2 - 0
src/main/java/cn/hnthyy/thmz/vo/MzPrescriptionVo.java

@@ -58,6 +58,8 @@ public class MzPrescriptionVo {
     private Integer zgmztczf;
     //处方类型 mz_zd_order_type
     private Integer orderType;
+    //0 不收去挂号费  1 收取挂号费
+    private String ghFeeFlag;
     //号别
     private String reqType;
     private String opspDisecode;

+ 8 - 4
src/main/resources/static/js/mz/clinic.js

@@ -1639,11 +1639,13 @@ function clearUser(flag) {
     $("#patientResponseType").html("");
     $("#first").next().click();
     $("#patientHisData").text("");
+    $('#ghFeeSelect').val('0');
+    $('#ghFeeSelect').selectpicker('refresh');
+    $('#mzOrderTypeSelect').val('1');
+    $('#mzOrderTypeSelect').selectpicker('refresh');
+    $("#mzReqTypeName").text(null);
+    $("#mzReqType").val(null);
     if (flag) {
-        $("#mzReqTypeName").text(null);
-        $("#mzReqType").val(null);
-        $('#mzOrderTypeSelect').val('1');
-        $('#mzOrderTypeSelect').selectpicker('refresh');
         $("#transferTreatment").css("display", "none");
         $("#consultation").css("display", "none");
         $("#mzfzSerialNoInClick").val(null);
@@ -10190,6 +10192,7 @@ function getParamsForpPrescription(type) {
         '"opspDiseName":"",' +
         '"reqType":"",' +
         '"orderType":"",' +
+        '"ghFeeFlag":"",' +
         '"grzhzf":"",' +
         '"readCardResult":"",' +
         '"readCardType":"01"}');
@@ -10258,6 +10261,7 @@ function getParamsForpPrescription(type) {
 
     jsonData.reqType = $("#mzReqType").val();
     jsonData.orderType = $("#mzOrderTypeSelect").val();
+    jsonData.ghFeeFlag = $("#ghFeeSelect").val();
     jsonData.opspDisecode = curOpspDiseCode;
     jsonData.opspDiseName = curOpspDiseName;
 

+ 11 - 1
src/main/resources/templates/mz/clinic.html

@@ -1583,7 +1583,17 @@
                         </select>
                     </div>
                 </div>
-
+                <div style="width: 130px;float: left;margin-right: 10px;height: 60px;" id="ghTypeDiv">
+                    <label style="float: left;font-weight: 400;margin-bottom: -5px;">收挂号费:</label>
+                    <div style="width: 65px;float: left;">
+                        <select class="form-control selectpicker show-tick"
+                                title="请选择"
+                                id="ghFeeSelect" onchange="calculateTotalAmount(true)">
+                            <option value="0" selected>否</option>
+                            <option value="1" >是</option>
+                        </select>
+                    </div>
+                </div>
                 <!-- 读卡返回-->
                 <input type="hidden" id="readCardResult"/>
                 <div style="width: 130px;float: left;margin-right: 10px;height: 60px;"  id="zgmztczfDiv">