Przeglądaj źródła

处方类型优化

lihong 1 rok temu
rodzic
commit
550562b891

+ 7 - 0
src/main/java/cn/hnthyy/thmz/Utils/Tools.java

@@ -717,6 +717,13 @@ public class Tools {
         return result;
     }
 
+    public static String beforeAddZeroStr(String str){
+        if(StrUtil.isNotBlank(str) && str.length() == 1){
+            return "0" + str;
+        }
+        return str;
+    }
+
     public static void main(String[] args) {
         System.out.println(IdcardUtil.getGenderByIdCard("432427197405123611"));
     }

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

@@ -442,6 +442,7 @@ public class CommonController {
     }
 
 
+
     /**
      * 查询所有住院收费码
      *

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

@@ -2573,7 +2573,7 @@ public class MzChargeDetailController {
                 return resultMap;
             }
             Clinic clinic = clinicService.queryByPatientIdAndTimesAndReceiptNo(mzPrescriptionVo.getPatientId(), mzPrescriptionVo.getTimes(), 0);
-            PayInfo payInfo = tsmzService.directRegistration(tokenUser.getUserIdCode(), mzPrescriptionVo.getPatientId(), mzPrescriptionVo.getTimes(), mzPrescriptionVo.getReadCardResult(), mzPrescriptionVo.getGrzhzf(), mzPrescriptionVo.getReadCardType(), clinic == null ? null : clinic.getExpContent());
+            PayInfo payInfo = tsmzService.directRegistration(tokenUser.getUserIdCode(), mzPrescriptionVo.getPatientId(), mzPrescriptionVo.getTimes(), mzPrescriptionVo.getReadCardResult(), mzPrescriptionVo.getGrzhzf(), mzPrescriptionVo.getReadCardType(), clinic == null ? null : clinic.getExpContent(),"11",null,null);
             if (payInfo == null) {
                 resultMap.put("code", -1);
                 resultMap.put("message", "职工门诊统筹试算失败,没有获取到结算信息");

+ 23 - 2
src/main/java/cn/hnthyy/thmz/controller/mz/MzyZdChargeTypeController.java

@@ -2,16 +2,22 @@ package cn.hnthyy.thmz.controller.mz;
 
 import cn.hnthyy.thmz.Utils.PyWbUtil;
 import cn.hnthyy.thmz.Utils.R;
+import cn.hnthyy.thmz.Utils.Tools;
 import cn.hnthyy.thmz.comment.UserLoginToken;
+import cn.hnthyy.thmz.entity.his.mz.MzOrderDetail;
 import cn.hnthyy.thmz.entity.his.mz.MzyZdChargeType;
 import cn.hnthyy.thmz.enums.YesNoEnum;
+import cn.hnthyy.thmz.service.his.mz.MzOrderDetailService;
 import cn.hnthyy.thmz.service.his.mz.MzyZdChargeTypeService;
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.convert.Convert;
 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 javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.*;
 
@@ -20,6 +26,8 @@ import java.util.*;
 public class MzyZdChargeTypeController {
     @Autowired
     private MzyZdChargeTypeService mzyZdChargeTypeService;
+    @Resource
+    private MzOrderDetailService mzOrderDetailService;
     /**
      * 查询所有使用中的号别
      *
@@ -69,7 +77,8 @@ public class MzyZdChargeTypeController {
                 resultMap.put("message", "号别编号不能为空");
                 return resultMap;
             }
-            MzyZdChargeType mzyZdChargeType=mzyZdChargeTypeService.queryByCode(code);
+            //补零
+            MzyZdChargeType mzyZdChargeType=mzyZdChargeTypeService.queryByCode(Tools.beforeAddZeroStr(code));
            if(mzyZdChargeType==null){
                resultMap.put("code", -1);
                resultMap.put("message", "根据号别编号查询号别失败,没有对应的号别信息");
@@ -88,7 +97,19 @@ public class MzyZdChargeTypeController {
         }
     }
 
-
+    @PostMapping("queryMzOrderDetails")
+    public R queryMzOrderDetails(@RequestBody Map<String, Object> param) {
+        String patientId = Convert.toStr(param.get("patientId"));
+        Integer times = Convert.toInt(param.get("times"));
+        List<MzOrderDetail> mzOrderDetails = mzOrderDetailService.queryByEntity(MzOrderDetail.builder().patientId(patientId).times(times).build());
+        MzOrderDetail mzOrderDetail = null;
+        if(CollUtil.isNotEmpty(mzOrderDetails)){
+            mzOrderDetail = mzOrderDetails.get(0);
+            MzyZdChargeType mzyZdChargeType = mzyZdChargeTypeService.queryByCode(Tools.beforeAddZeroStr(mzOrderDetail.getReqType()));
+            mzOrderDetail.setReqTypeName(mzyZdChargeType == null ? "" : mzyZdChargeType.getName());
+        }
+        return R.ok().put("data", mzOrderDetail);
+    }
 
     /**
      * 删除号别

+ 4 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzChargeDetail.java

@@ -39,6 +39,8 @@ public class MzChargeDetail implements Serializable,Comparable<MzChargeDetail> {
     private Double quantity;
     //单价
     private BigDecimal unitPrice;
+    //诊疗单价
+    private BigDecimal zlUnitPrice;
     //退欠标记:0:收;1:退;2:作废;5:未收费 具体看   cn.hnthyy.thmz.enums.PayMarkEnum
     private String payMark;
     //药品序号 拆零 和整装
@@ -239,6 +241,8 @@ public class MzChargeDetail implements Serializable,Comparable<MzChargeDetail> {
     private String realDoctorCode;
     //病人身份名称
     private String visitTypeName;
+    //处方类型
+    private String orderTypeName;
     public MzChargeDetail(String patientId, Integer times) {
         this.patientId = patientId;
         this.times = times;

+ 38 - 0
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzOrderDetail.java

@@ -0,0 +1,38 @@
+package cn.hnthyy.thmz.entity.his.mz;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * @Description: 处方类型表
+ * @Author:lihong
+ * @Date: 2024/4/18
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@TableName("mz_order_detail")
+public class MzOrderDetail {
+    private String patientId;
+    /**号别 mzy_zd_charge_type*/
+    private String reqType;
+    @TableField(exist = false)
+    private String reqTypeName;
+    private Integer times;
+    private Integer receiptNo;
+    /** 处方类型  1 普通处方 2门诊统筹 3特门处方 4 GPC实验   见表mz_zd_order_type  */
+    private Integer orderType;
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date chargeDate;
+
+}

+ 16 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzOrderDetailMapper.java

@@ -0,0 +1,16 @@
+package cn.hnthyy.thmz.mapper.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.MzOrderDetail;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2024/4/18
+ */
+public interface MzOrderDetailMapper extends BaseMapper<MzOrderDetail> {
+    @Select(" select top 1 b.name from mz_order_detail a join mz_zd_order_type b on a.order_type = b.code  where a.patient_id = #{patientId} and a.times = #{times} ")
+    String selectOrderTypeName(@Param("patientId") String patientId, @Param("times") Integer times);
+}

+ 1 - 1
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzZdCommonMapper.java

@@ -108,6 +108,6 @@ public interface MzZdCommonMapper {
     List<CodeNameEntity> selectAllJyZdTube();
     @Select(" select rtrim(code) code , rtrim(name) name  from  zy_zd_admiss_way ")
     List<Map<String, Object>> selectRouteOfAdmission();
-    @Select(" select rtrim(code) code,rtrim(name) name from mz_zd_order_type where del_flag = '0' ")
+    @Select(" select rtrim(code) code,rtrim(name) name from mz_zd_order_type where del_flag = '0' order by code ")
     List<Map<String, Object>> selectMzZdOrderType();
 }

+ 28 - 0
src/main/java/cn/hnthyy/thmz/service/his/mz/MzOrderDetailService.java

@@ -0,0 +1,28 @@
+package cn.hnthyy.thmz.service.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.MzOrderDetail;
+
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2024/4/19
+ */
+public interface MzOrderDetailService {
+
+    int save(MzOrderDetail mzOrderDetail);
+
+    List<MzOrderDetail> queryByEntity(MzOrderDetail mzOrderDetail);
+    /**
+     * @description: 查询处方类型名称
+     * @author: lihong
+     * @date: 2024/4/22 16:35
+     * @param: patientId
+     * @param: times
+     * @return: java.lang.String
+     **/
+    String queryOrderTypeName(String patientId, Integer times);
+
+    MzOrderDetail queryByPatientIdAndTimes(String patientId, Integer times);
+}

+ 44 - 4
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -211,6 +211,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
     private ShareholderCardService shareholderCardService;
     @Resource
     private DictDataService dictDataService;
+    @Resource
+    private MzOrderDetailService mzOrderDetailService;
     //是否加收开关
     @Value("${setUnitPrice}")
     private boolean setUnitPrice;
@@ -1142,6 +1144,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         }
         for (MzChargeDetail mzChargeDetail : mzChargeDetails) {
             if (mzChargeDetail != null) {
+                mzChargeDetail.setOrderTypeName(mzOrderDetailService.queryOrderTypeName(mzChargeDetail.getPatientId(),mzChargeDetail.getTimes()));
                 mzChargeDetail.setVisitTypeName(shareholderCardService.queryVisitTypeName(mzChargeDetail.getPatientId()));
                 mzChargeDetail.setWarnDept(zdUnitCodeService.queryDeptNameByIdInCache(mzChargeDetail.getWarnDept()));
                 if (employeeMap != null) {
@@ -1376,6 +1379,16 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             //如果是当前患者的号子来源是互联网医院的话,处方都算互联网医院
             opId = dbClinic.getOpId();
         }
+        //保存处方类型
+        MzOrderDetail mzOrderDetail = MzOrderDetail.builder()
+                .patientId(mzPatientMi.getPatientId())
+                .times(times)
+                .orderType(mzPrescriptionVo.getOrderType())
+                .chargeDate(new Date())
+                .receiptNo(newMzVisitTable.getReceiptNo())
+                .reqType(Tools.beforeAddZeroStr(mzPrescriptionVo.getReqType()))
+                .build();
+        mzOrderDetailService.save(mzOrderDetail);
         clinic.setOpId(opId);
         clinic.setOpDay(new Date());
         clinic.setIcdCode(realIcdText != null ? mzPrescriptionVo.getIcdCode() : null);
@@ -1391,7 +1404,19 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         }
         haiCiAdapterService.closeUnpaidWxOrder(mzPatientMi.getPatientId()+"_"+times+"_1");
         if (mzPrescriptionVo.getZgmztczf() != null && YesNoEnum.YES.code.equals(mzPrescriptionVo.getZgmztczf())) {
-            tsmzService.directRegistrationAsync(opId, mzPatientMi.getPatientId(), times, mzPrescriptionVo.getReadCardResult(), mzPrescriptionVo.getGrzhzf(), mzPrescriptionVo.getReadCardType(), mzPrescriptionVo.getExpContent());
+            String medType = "11";
+            if(mzPrescriptionVo.getOrderType() != null && mzPrescriptionVo.getOrderType() == 3){
+                medType = "14";
+            }
+            if(StrUtil.isNotBlank(mzPrescriptionVo.getReadCardResult())){
+                PayInfo payInfo =  tsmzService.directRegistration(opId, mzPatientMi.getPatientId(), times, mzPrescriptionVo.getReadCardResult(), mzPrescriptionVo.getGrzhzf(), mzPrescriptionVo.getReadCardType(), mzPrescriptionVo.getExpContent(),medType,mzPrescriptionVo.getOpspDisecode(),mzPrescriptionVo.getOpspDiseName());
+                if(payInfo == null) {
+                    log.error("保存处方,patientId={},times={},医保试算失败,没有获取到结算信息",mzPatientMi.getPatientId(),times);
+                }
+                else if(!Integer.valueOf(0).equals(payInfo.getCode())){
+                    log.error("保存处方,patientId={},times={},医保试算失败,错误信息={}",mzPatientMi.getPatientId(),times,payInfo.getErrorMessage());
+                }
+            }
         }
         //发送处方待缴费MQ
         if(preChargeNotice){
@@ -2587,8 +2612,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                         throw new MzException("保存处方失败,您本次处方是门诊统筹支付,诊疗项目【" + zdChargeItem.getName() + "】没有医保赋码,请待患者本次处方缴费完成后以自费处方开立保存!!");
                     }
                     mzChargeDetail.setChargeBillCode(Constants.BILL_ITEM_CODE_prev + zdChargeItem.getBillItemMz().substring(1));
-                    mzChargeDetail.setUnitPrice(zdChargeItem.getChargeAmount());
-                    mzChargeDetail.setOrigPrice(zdChargeItem.getChargeAmount());
+                    mzChargeDetail.setUnitPrice(Convert.toBigDecimal(zdChargeItem.getChargeAmount(),BigDecimal.ZERO).compareTo(BigDecimal.ZERO) == 0 && Convert.toBigDecimal(mzChargeDetail.getZlUnitPrice(),BigDecimal.ZERO).compareTo(BigDecimal.ZERO) !=0 ? mzChargeDetail.getZlUnitPrice() : zdChargeItem.getChargeAmount());
+                    mzChargeDetail.setOrigPrice(Convert.toBigDecimal(zdChargeItem.getChargeAmount(),BigDecimal.ZERO).compareTo(BigDecimal.ZERO) == 0 && Convert.toBigDecimal(mzChargeDetail.getZlUnitPrice(),BigDecimal.ZERO).compareTo(BigDecimal.ZERO) !=0 ? mzChargeDetail.getZlUnitPrice() : zdChargeItem.getChargeAmount());
                     mzChargeDetail.setCountryFlag("");
                     mzChargeDetail.setSupplyCode("");
                     mzChargeDetail.setBillItemCode(zdChargeItem.getBillItemMz());
@@ -3919,7 +3944,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         //退费后新的收款方式
         List<MzDepositFile> newMzDepositFiles = new ArrayList<>();
         Map<String, Object>  resultMap = getMzChargeDetailService().getDeposFiles(opId, mzDepositFileVo, now, times, serialNo, totalPayable, fullNewMzDepositFiles, false, newMzDepositFiles,true);
-
+        MzOrderDetail mzOrderDetail = mzOrderDetailService.queryByPatientIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
         MzBlRecord  mzBlRecord = mzBlRecordMapper.selectMzBlRecordByPatientIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
         List<String> chargeItemCodeList = mzChargeDetails.stream().filter(u -> StringUtils.isNotBlank(u.getChargeItemCode())).map(u -> u.getChargeItemCode()).collect(Collectors.toList());
 
@@ -3997,6 +4022,11 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             newClinic.setFirstOrNot(dbClinic.getFirstOrNot());
         }
         clinicMapper.insertClinic(newClinic);
+        if(mzOrderDetail !=null ){
+            mzOrderDetail.setReceiptNo(1);
+            mzOrderDetail.setTimes(times);
+            mzOrderDetailService.save(mzOrderDetail);
+        }
         MzPrescriptionVo mzPrescriptionVo = new MzPrescriptionVo();
         mzPrescriptionVo.setMzChargeDetailList(mzChargeDetails);
         mzPrescriptionVo.setMzYjReqList(mzYjReqs);
@@ -4074,7 +4104,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         //是否全退
         boolean allRefund = mzChargeDetails == null || mzChargeDetails.size() == 0;
         MzBlRecord mzBlRecord = null;
+        MzOrderDetail mzOrderDetail = null;
         if (!allRefund) {
+            mzOrderDetail = mzOrderDetailService.queryByPatientIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
             mzBlRecord = mzBlRecordMapper.selectMzBlRecordByPatientIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
         }
         int count = mzPatientMiMapper.countYbZf(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
@@ -4229,6 +4261,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 newClinic.setFirstOrNot(dbClinic.getFirstOrNot());
             }
             clinicMapper.insertClinic(newClinic);
+
+
             MzPrescriptionVo mzPrescriptionVo = new MzPrescriptionVo();
             mzPrescriptionVo.setMzChargeDetailList(mzChargeDetails);
             mzPrescriptionVo.setMzYjReqList(mzYjReqs);
@@ -4239,6 +4273,12 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 MzBlRecord.formatMzBlRecord(mzBlRecord);
                 mzBlRecordMapper.insertMzBlRecord(mzBlRecord);
             }
+            if(mzOrderDetail !=null){
+                mzOrderDetail.setTimes(times);
+                mzOrderDetail.setReceiptNo(1);
+                mzOrderDetailService.save(mzOrderDetail);
+            }
+
         }
         //更新原医技单为退费
         MzYjReq updateMzYjReq = new MzYjReq(mzDepositFileVo.getPatientId(), oriTimes);

+ 75 - 0
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzOrderDetailServiceImpl.java

@@ -0,0 +1,75 @@
+package cn.hnthyy.thmz.service.impl.his.mz;
+
+import cn.hnthyy.thmz.entity.his.mz.MzOrderDetail;
+import cn.hnthyy.thmz.mapper.his.mz.MzOrderDetailMapper;
+import cn.hnthyy.thmz.service.his.mz.MzOrderDetailService;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @Description:
+ * @Author:lihong
+ * @Date: 2024/4/19
+ */
+@Service
+public class MzOrderDetailServiceImpl implements MzOrderDetailService {
+    @Resource
+    private MzOrderDetailMapper dao;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int save(MzOrderDetail mzOrderDetail) {
+        List<MzOrderDetail> mzOrderDetails = queryByEntity(MzOrderDetail.builder()
+                .patientId(mzOrderDetail.getPatientId())
+                .times(mzOrderDetail.getTimes())
+                .build());
+        if(CollUtil.isNotEmpty(mzOrderDetails)){
+            UpdateWrapper<MzOrderDetail> updateWrapper = new UpdateWrapper();
+            updateWrapper.eq("patient_id", mzOrderDetail.getPatientId());
+            updateWrapper.eq("times", mzOrderDetail.getTimes());
+            dao.update(mzOrderDetail, updateWrapper);
+        }
+        return dao.insert(mzOrderDetail);
+    }
+
+    @Override
+    public List<MzOrderDetail> queryByEntity(MzOrderDetail mzOrderDetail) {
+        QueryWrapper<MzOrderDetail> queryWrapper = new QueryWrapper();
+        queryWrapper.eq(StrUtil.isNotBlank(mzOrderDetail.getPatientId()), "patient_id", mzOrderDetail.getPatientId());
+        queryWrapper.eq(mzOrderDetail.getTimes() !=null, "times", mzOrderDetail.getTimes());
+        queryWrapper.eq(mzOrderDetail.getReceiptNo() !=null, "receipt_no", mzOrderDetail.getReceiptNo());
+        queryWrapper.eq(mzOrderDetail.getOrderType() !=null, "order_type", mzOrderDetail.getOrderType());
+        return dao.selectList(queryWrapper);
+    }
+
+    /**
+     * @param patientId
+     * @param times
+     * @description: 查询处方类型名称
+     * @author: lihong
+     * @date: 2024/4/22 16:35
+     * @param: patientId
+     * @param: times
+     * @return: java.lang.String
+     */
+    @Override
+    public String queryOrderTypeName(String patientId, Integer times) {
+        return dao.selectOrderTypeName(patientId, times);
+    }
+
+    @Override
+    public MzOrderDetail queryByPatientIdAndTimes(String patientId, Integer times) {
+        List<MzOrderDetail> mzOrderDetails = queryByEntity(MzOrderDetail.builder().patientId(patientId).times(times).build());
+        if(CollUtil.isNotEmpty(mzOrderDetails)){
+            return mzOrderDetails.get(0);
+        }
+        return null;
+    }
+}

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

@@ -37,6 +37,7 @@ import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.*;
@@ -123,6 +124,8 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
     private MzPatientMiService mzPatientMiService;
     @Autowired
     private HaiCiAdapterService haiCiAdapterService;
+    @Resource
+    private MzOrderDetailMapper mzOrderDetailMapper;
 
     //无需新冠调查的科室
     private List notCovid = Arrays.asList("1040200", "1040000", "1040100", "1070000", "1260000");
@@ -267,7 +270,19 @@ public class MzyReqrecServiceImpl implements MzyReqrecService {
             mzfzPatientOrderMapper.insertMzfzPatientOrder(mzfzPatientOrder);
         }
         //保存处方类型
-
+        Integer orderType = 1;
+        if(Constants.GPC_CODE.equals(mzyZdChargeType.getCode())){
+            orderType = 4;
+        }
+        MzOrderDetail mzOrderDetail = MzOrderDetail.builder()
+                .patientId(mzyReqrec.getPatientId())
+                .chargeDate(new Date())
+                .times(mzfzPatientOrder.getTimes())
+                .receiptNo(newMzVisitTable.getReceiptNo())
+                .orderType(orderType)
+                .reqType(mzyZdChargeType.getCode())
+                .build();
+        mzOrderDetailMapper.insert(mzOrderDetail);
         Clinic clinic = new Clinic();
         clinic.setPatientId(mzyReqrec.getPatientId());
         clinic.setPatientName(mzfzPatientOrder.getName());

+ 9 - 2
src/main/java/cn/hnthyy/thmz/service/impl/thmz/TsmzServiceImpl.java

@@ -379,7 +379,7 @@ public class TsmzServiceImpl implements TsmzService {
     }
 
     @Override
-    public PayInfo directRegistration(String staffId, String patientId, Integer times, String readCardResult, Integer acctUsedFlag, String readCardType, String expContent) {
+    public PayInfo directRegistration(String staffId, String patientId, Integer times, String readCardResult, Integer acctUsedFlag, String readCardType, String expContent,String medType,String opspDisecode,String opspDiseName) {
         log.info("调用职工门诊统筹试算接口,操作人={},病人={},就诊次数={},读卡类型={},读卡返回参数={}", staffId, patientId, times,readCardType,readCardResult);
         String realUrl = tsmzServiceUrl + "/directRegistration";
         Map<String, Object> map = new HashMap<>();
@@ -390,6 +390,9 @@ public class TsmzServiceImpl implements TsmzService {
         map.put("readCardType", readCardType);
         map.put("acctUsedFlag", acctUsedFlag == null ? 0 : acctUsedFlag);
         map.put("readCardResult", readCardResult);
+        map.put("medType", medType);
+        map.put("opspDisecode", opspDisecode);
+        map.put("opspDiseName", opspDiseName);
         if(expContent!=null){
             map.put("expContent", expContent);
         }
@@ -454,6 +457,7 @@ public class TsmzServiceImpl implements TsmzService {
         JSONObject jsonObj = new JSONObject(map);
         try {
             String result = HttpUtil.sendHttpPost(realUrl, jsonObj.toString(), 60000);
+            log.info("调佣医保结算接口[mzgjAfterModifyReceipt],返回结果:{}",result== null ? "": result);
             if (StringUtils.isBlank(result)) {
                 return null;
             }
@@ -483,7 +487,7 @@ public class TsmzServiceImpl implements TsmzService {
 
     @Override
     @Async("asyncServiceExecutor")
-    public void directRegistrationAsync(String staffId, String patientId, Integer times, String readCardResult, Integer acctUsedFlag, String readCardType, String expContent) {
+    public void directRegistrationAsync(String staffId, String patientId, Integer times, String readCardResult, Integer acctUsedFlag, String readCardType, String expContent,String medType,String opspDisecode,String opspDiseName) {
         log.info("调用职工门诊统筹试算接口,操作人={},病人={},就诊次数={},读卡类型={},读卡返回参数={}", staffId, patientId, times,readCardType,readCardResult);
         String realUrl = tsmzServiceUrl + "/directRegistration";
         Map<String, Object> map = new HashMap<>();
@@ -494,6 +498,9 @@ public class TsmzServiceImpl implements TsmzService {
         map.put("readCardType", readCardType);
         map.put("acctUsedFlag", acctUsedFlag == null ? 0 : acctUsedFlag);
         map.put("readCardResult", readCardResult);
+        map.put("medType", medType);
+        map.put("opspDisecode", opspDisecode);
+        map.put("opspDiseName", opspDiseName);
         if(expContent!=null){
             map.put("expContent", expContent);
         }

+ 5 - 2
src/main/java/cn/hnthyy/thmz/service/thmz/TsmzService.java

@@ -106,7 +106,7 @@ public interface TsmzService {
      * @param expContent 门诊统筹额外内容
      * @return
      */
-    PayInfo directRegistration(String staffId, String patientId, Integer times,String readCardResult,Integer acctUsedFlag,String readCardType, String expContent);
+    PayInfo directRegistration(String staffId, String patientId, Integer times,String readCardResult,Integer acctUsedFlag,String readCardType, String expContent,String medType,String opspDisecode,String opspDiseName);
 
     /**
      * @description:
@@ -132,9 +132,12 @@ public interface TsmzService {
      * @param acctUsedFlag 是否使用个人账户余额结算 1使用,0不使用 2使用共济账户
      * @param readCardType 读卡类型 01-电子凭证 02-身份证 03-社保卡
      * @param expContent 门诊统筹额外内容
+     * @param medType 11 普通门诊  14 门诊慢特
+     * @param opspDisecode 慢特病种编码
+     * @param opspDiseName 慢特病种名称
      * @return
      */
-    void directRegistrationAsync(String staffId, String patientId, Integer times,String readCardResult,Integer acctUsedFlag,String readCardType, String expContent);
+    void directRegistrationAsync(String staffId, String patientId, Integer times,String readCardResult,Integer acctUsedFlag,String readCardType, String expContent,String medType,String opspDisecode,String opspDiseName);
 
     /**
      * 根据门诊ID和就诊次数查询门诊统筹报销金额 包含统筹支付和个人账户支付金额

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

@@ -44,6 +44,12 @@ public class MzPrescriptionVo {
     private String opId;
     //是否使用职工统筹支付 1是 0否
     private Integer zgmztczf;
+    //处方类型 mz_zd_order_type
+    private Integer orderType;
+    //号别
+    private String reqType;
+    private String opspDisecode;
+    private String opspDiseName;
     //是否使用个人账户支付 1是 0否
     private Integer grzhzf;
     //读卡返回

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

@@ -29,6 +29,7 @@ var timer;
 var ksjzType = null;
 
 $(function () {
+    initMzOrderTypeSelect();
     initGenderSelect();
     iniAdmissStatus();
     initListDeptSelect();
@@ -1539,6 +1540,10 @@ function clearUser(flag) {
     $("#first").next().click();
     $("#patientHisData").text("");
     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);
@@ -2126,12 +2131,33 @@ function cmrCreate() {
     });
 }
 
+var curOpspDiseCode =null;
+var curOpspDiseName =null;
+
 function openFetchSpcSlwinfoModal() {
     $("#fetchSpcSlwinfoModal").modal();
     $("#fetchSpcSlwinfoTable").html(null);
+    clearOpspDiseData();
+}
+
+/**
+ * 清除特门数据
+ */
+function clearOpspDiseData() {
+    curOpspDiseCode =null;
+    curOpspDiseName =null;
     visitMtCardResult = null;
 }
 
+/**
+ * 关闭门特窗口
+ */
+function closeFetchSpcSlwinfoModal() {
+    $("#fetchSpcSlwinfoModal").modal("hide");
+    clearOpspDiseData();
+}
+
+
 /**
  * 特门详情
  * @param patientId
@@ -2170,7 +2196,14 @@ function fetchSpcSlwinfo() {
                     if (ideFixmedinsName == null || ideFixmedinsName == "null") {
                         ideFixmedinsName = "";
                     }
-                    $("<tr><td>" + begndate + "</td><td>" + enddate + "</td><td>" + opspDiseCode + "</td><td>" + opspDiseName + "</td><td>" + ideFixmedinsName + "</td></tr>").appendTo("#fetchSpcSlwinfoTable");
+                    $("<tr data-target-opspDiseCode='" + opspDiseCode + "'  data-target-opspDiseName='" + opspDiseName + "'  data-target-ideFixmedinsName='" + ideFixmedinsName + "'><td>" + begndate + "</td><td>" + enddate + "</td><td>" + opspDiseCode + "</td><td>" + opspDiseName + "</td><td>" + ideFixmedinsName + "</td></tr>").appendTo("#fetchSpcSlwinfoTable").bind('click',function () {
+                        $("#fetchSpcSlwinfoModal").modal("hide");
+                        curOpspDiseCode = $(this).attr("data-target-opspDiseCode");
+                        curOpspDiseName = $(this).attr("data-target-opspDiseName");
+                        //设置特殊门诊值
+                        $("#mzOrderTypeSelect").val('3')
+                        $('#mzOrderTypeSelect').selectpicker('refresh');
+                    });
                 }
             } else {
                 errorMesage(res);
@@ -2224,6 +2257,7 @@ function readVisitPatientCard() {
             }
             if (res.code == 200) {
                 visitMtCardResult = res.data
+                fetchSpcSlwinfo()
             } else {
                 errorMesage(res);
             }
@@ -2288,6 +2322,7 @@ function realClinicalReception(patientId, serialNo, reqType) {
             }
             if (res.code == 0) {
                 if (res.data != null) {
+                    setMzReqType(null,null,reqType);
                     var mzPatientMi = res.data;
                     setMzPatientInfo(mzPatientMi);
                     setMzSmtz(res);
@@ -2343,6 +2378,13 @@ function queryInsuinfo(patientId) {
                 if (ybCode != null && ybCode != "" && ybCode.length > 0) {
                     $("#zgmztczf").selectpicker('val', 1);
                     $("#zgmztczf").selectpicker('refresh');
+                    if($("#mzOrderTypeSelect").val() !='4'){
+                        $("#mzOrderTypeSelect").selectpicker('val', '2');
+                        $("#mzOrderTypeSelect").selectpicker('refresh');
+                    }else {
+                        $("#zgmztczf").selectpicker('val', 0);
+                        $("#zgmztczf").selectpicker('refresh');
+                    }
                     postAjaxJsonHttpRequst("/thmz/queryVisitTypeName",{patientId:patientId},true,function (res) {
                         if(res.code ==0){
                             if(!stringIsBlank(res.data)){
@@ -2477,6 +2519,7 @@ function clearWorkSpaceExcludeUser(source) {
         clearApidAcceptsModal();
         clearTurnToConsultationInput();
         clearZgtczfInput();
+        clearOpspDiseData();
         clearExpContentRequired();
         gropuIdAndOrderNoMap = null;
         //prevCategoriesFlag = null;
@@ -5930,6 +5973,12 @@ function saveChineseMedicine(calculateTotalAmountFlag) {
         errorMesageSimaple("未选择任何药品!");
         return;
     }
+    //颗粒 剂量只能为整数
+    if(zyClassType == '83' && !(/(^[1-9]\d*$)/.test(drugWin))){
+        errorMesageSimaple("颗粒剂处方剂量只能为大于等于1的正整数!");
+        return;
+    }
+
     var html = '<div class="form-group" style="float: left;">';
     html += chineseMedicineNamme;
     if (zyInstruction != null && zyInstruction != '') {
@@ -7875,6 +7924,7 @@ function loadZlItemList(event) {
             $("#zlItem").val(row.name);
             $("#zlItem").blur();
             $("#zlItemPrice").val(row.chargeAmount);
+            zlItemPriceIsReadonly(row.chargeAmount);
             $("#chargeUnit").val(row.specification);
             $("#zl_current_code").val(row.code);
             $("#itemQuantity").val(1);
@@ -7891,6 +7941,17 @@ function loadZlItemList(event) {
     });
 }
 
+/**
+ * 诊疗单价输入框是否只读
+ */
+function zlItemPriceIsReadonly(val) {
+    if(val !=null && Number(val) > 0 ){
+        $("#zlItemPrice").attr("readonly","readonly")
+    }else {
+        $("#zlItemPrice").removeAttr("readonly")
+    }
+}
+
 
 /**
  * 诊疗与医技选中
@@ -9255,6 +9316,10 @@ function getParamsForpPrescription(type) {
         '"opRecordList": [],' +
         '"patientAllergenInfoList": [],' +
         '"zgmztczf":"",' +
+        '"opspDisecode":"",' +
+        '"opspDiseName":"",' +
+        '"reqType":"",' +
+        '"orderType":"",' +
         '"grzhzf":"",' +
         '"readCardResult":"",' +
         '"readCardType":"01"}');
@@ -9319,6 +9384,11 @@ function getParamsForpPrescription(type) {
     jsonData.grzhzf = $("#grzhzf").val();
     jsonData.readCardResult = $("#readCardResult").val();
 
+    jsonData.reqType = $("#mzReqType").val();
+    jsonData.orderType = $("#mzOrderTypeSelect").val();
+    jsonData.opspDisecode = curOpspDiseCode;
+    jsonData.opspDiseName = curOpspDiseName;
+
     //设置过敏源
     var zdAllergen = $("#zdAllergen").val();
     var ypDitList = $("#ypDitList").val();
@@ -9465,11 +9535,12 @@ function getParamsForpPrescription(type) {
             //执行科室
             var execUnit = $(zlTabContents[i]).find("input.temporary_items_execUnit").val();
             //诊疗,放入药品类型中入库,因为诊疗是与药品一样直接入明细库,但是是与医技在同一处方开立页面开立
-            tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "1","drugQuan": "1","drugUnit": "","frequency": "","orderDays": "1","paySelf": "0","drugWin": "1","instructionCode":"","instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":"00","execDept":""}');
+            tempJson = JSON.parse('{"unitPrice": "0","chargeItemCode": "","serial": "","quantity": "1","drugQuan": "1","drugUnit": "","frequency": "","orderDays": "1","paySelf": "0","drugWin": "1","instructionCode":"","instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":"00","execDept":""}');
             tempJson.chargeItemCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
             tempJson.instructionText = $(zlTabContents[i]).find("input.temporary_items_remark").val();
             tempJson.quantity = $(zlTabContents[i]).find("input.temporary_items_totalNumZl").val();
             tempJson.drugQuan = $(zlTabContents[i]).find("input.temporary_items_itemQuantity").val();
+            tempJson.zlUnitPrice = $(zlTabContents[i]).find("input.temporary_items_amount").val();
             //因为收费表里的单位长度限制,无法存入库
             //tempJson.drugUnit = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
             tempJson.frequency = $(zlTabContents[i]).find("input.temporary_items_orderFrequencyZl").val();
@@ -9952,6 +10023,7 @@ function getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId) {
             }
             if (res.code == 0) {
                 clearWorkSpace();
+                setMzReqType(patientId,times,null)
                 setMzPatientInfo(res.mzPatientMi);
                 editPrescription(res.data, 0)
                 //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
@@ -10120,6 +10192,7 @@ function repeatAcceptsCommon(patientId, times, clnicId) {
             }
             if (res.code == 0) {
                 clearWorkSpace();
+                setMzReqType(patientId,times,null);
                 setMzPatientInfo(res.mzPatientMi);
                 editPrescription(res.data, 0)
                 //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
@@ -13195,12 +13268,88 @@ function initEmployee() {
     });
 }
 
+/**
+ * 设置挂号号别
+ * @param patientId
+ * @param times
+ * @param reqType
+ */
+function setMzReqType(patientId,times,reqType) {
+   if(stringIsBlank(reqType)){
+        postAjaxJsonHttpRequst("/thmz/queryMzOrderDetails",{patientId:patientId,times:times},true,function (res) {
+             if(res.code == 0 && res.data != null){
+                 $("#mzReqTypeName").text(res.data.reqTypeName)
+                 $("#mzReqType").val(res.data.reqType)
+                 if(res.data.reqType == '45') {
+                     $("#mzOrderTypeSelect").val('4');
+                     $('#mzOrderTypeSelect').selectpicker('refresh');
+                 }
+
+             }
+        })
+   }else {
+        getAjaxRequst("/thmz/getMzChargeTypeByCode",{code:reqType},true,function (res) {
+          if(res.code == 0 && res.data != null){
+              $("#mzReqType").val(reqType)
+              $("#mzReqTypeName").text(res.data.name)
+              if(reqType == '45'){
+                  $("#mzOrderTypeSelect").val('4');
+                  $('#mzOrderTypeSelect').selectpicker('refresh');
+              }
+          }
+        })
+   }
+}
+
+
+/**
+ * 选择处方类型进行效验
+ */
+function verifyMzOrderType() {
+    let mzOrderTypeSelectVal = $("#mzOrderTypeSelect").val();
+    if(mzOrderTypeSelectVal == '3'){
+        if(stringIsBlank(curOpspDiseCode)){
+            errorMesageSimaple('不是特门病人,请先点击[查询特门]并选中特门编码!')
+            $("#mzOrderTypeSelect").val('1');
+            $('#mzOrderTypeSelect').selectpicker('refresh');
+            return
+        }
+    }
+    let mzReqTypeVal =  $("#mzReqType").val()
+    if(mzOrderTypeSelectVal == '4' && mzReqTypeVal != '45'){
+        errorMesageSimaple('当前病人不是GCP实验类型,不能选择该选项!')
+        $("#mzOrderTypeSelect").val('1');
+        $('#mzOrderTypeSelect').selectpicker('refresh');
+        return
+    }
+}
+
+/**
+ * 初始化门诊处方类型下拉框
+ */
+function initMzOrderTypeSelect() {
+   getAjaxRequst("/thmz/queryMzOrderType",{},true,function (res) {
+       let html = ''
+       $.each(res.data, function (commentIndex, comment) {
+           html += '<option value="' + comment.code + '">' + comment.name + '</option>';
+       });
+       $('#mzOrderTypeSelect').empty();
+       $('#mzOrderTypeSelect').html(html);
+       $('#mzOrderTypeSelect').selectpicker('destroy').selectpicker('refresh');
+       $('#mzOrderTypeSelect').val('1');
+       $('#mzOrderTypeSelect').selectpicker('refresh');
+   })
+}
+
+
 /**
  * 选择门诊统筹支付时校验门诊诊断是否是标准诊断,校验医生是否具有医保编码
  */
 function verifyInsuranceInfo() {
     var zgmztczf = $("#zgmztczf").val();
     if (zgmztczf != null && (zgmztczf == 1 || zgmztczf == "1")) {
+        $('#mzOrderTypeSelect').val('2');
+        $('#mzOrderTypeSelect').selectpicker('refresh');
         postAjaxJsonHttpRequst("/thmz/queryVisitTypeName",{patientId:$("#patientId").text()},true,function (res) {
             if(res.code ==0){
                 if(!stringIsBlank(res.data)){
@@ -13229,6 +13378,11 @@ function verifyInsuranceInfo() {
             // $("#zgmztczf").selectpicker('refresh');
             return false;
         }
+    }else {
+        if($('#mzOrderTypeSelect').val() =='2'){
+            $('#mzOrderTypeSelect').val('1');
+            $('#mzOrderTypeSelect').selectpicker('refresh');
+        }
     }
     return true;
 }

+ 6 - 0
src/main/resources/static/js/mz/toll_administration.js

@@ -412,6 +412,12 @@ function initFeeTable() {
                 align: "center",
                 valign: 'middle',
             },
+            {
+                field: 'orderTypeName',
+                title: '处方类型',
+                align: "center",
+                valign: 'middle',
+            },
             {
                 field: 'receiptNo',
                 title: '结算次数',

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

@@ -348,6 +348,10 @@
                             <span id="notSpan" style="cursor: pointer;" onclick="{
                               $('#not').next().click();
                             }">&nbsp;复诊</span>
+                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                            <input id="mzReqType" type="hidden"/>
+                            <span>挂号类别:</span>
+                            <span id="mzReqTypeName"></span>
                         </p>
                     </div>
                     <div class="col-md-8 col-sm-8 col-xs-12" style="text-align: right;">
@@ -1359,6 +1363,16 @@
                 合计:<span style="color: #2E69EB;"><span id="totalAmount">0.00</span>元</span>
             </div>
             <div style="float: right;height: 60px;">
+                <div style="width: 170px;float: left;margin-right: 10px;height: 60px;" id="mzOrderTypeDiv">
+                    <label style="float: left;font-weight: 400;margin-bottom: -5px;">处方类型:</label>
+                    <div style="width: 100px;float: left;">
+                        <select class="form-control selectpicker show-tick"
+                                title="请选择" onchange="verifyMzOrderType()"
+                                id="mzOrderTypeSelect">
+                        </select>
+                    </div>
+                </div>
+
                 <!-- 读卡返回-->
                 <input type="hidden" id="readCardResult"/>
                 <div style="width: 130px;float: left;margin-right: 10px;height: 60px;" class="hide" id="zgmztczfDiv">
@@ -3350,7 +3364,7 @@
             <div class="modal-footer">
                 <button type="button" class="btn btn-success" onclick="readVisitPatientCard()" >读取电子凭证</button>
                 <button type="button" class="btn btn-primary" onclick="fetchSpcSlwinfo()" >查询</button>
-                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
+                <button type="button" class="btn btn-default" onclick="closeFetchSpcSlwinfoModal()">关闭</button>
             </div>
         </div>
     </div>