Quellcode durchsuchen

处方开立后未缴费可以支持删除处方

hurugang vor 3 Jahren
Ursprung
Commit
d50c1ce824

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

@@ -1693,6 +1693,49 @@ public class MzChargeDetailController {
     }
 
 
+
+    /**
+     * 删除病人某次处方信息
+     *
+     * @param clnicId        就诊记录id
+     * @return
+     */
+    @UserLoginToken
+    @RequestMapping(value = "/deletePrescription", method = {RequestMethod.GET})
+    public Map<String, Object> deletePrescription(@RequestParam("clnicId") Long clnicId,HttpServletRequest httpServletRequest) {
+        Map<String, Object> resultMap = new HashMap<>();
+        try {
+            if(clnicId==null){
+                resultMap.put("code", -1);
+                resultMap.put("message", "请求参数为空");
+                return resultMap;
+            }
+            User tokenUser = TokenUtil.getUser(httpServletRequest);
+            int num = mzChargeDetailService.deletePrescription(clnicId,tokenUser);
+            if(num<=0){
+                resultMap.put("code", -1);
+                resultMap.put("message", "删除处方失败");
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "删除本次处方成功");
+            return resultMap;
+        } catch (MzException e) {
+            resultMap.put("code", -1);
+            resultMap.put("message", e.getMessage());
+            log.error("删除本次处方失败,错误信息{}", e);
+            return resultMap;
+        } catch (Exception e) {
+            e.printStackTrace();
+            resultMap.put("code", -1);
+            resultMap.put("message", "删除本次处方失败,请联系管理员");
+            log.error("系统异常,错误信息{}", e);
+            return resultMap;
+        }
+    }
+
+
+
     /**
      * 门诊缴费指引单查询
      *

+ 12 - 0
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzBaRecordMapper.java

@@ -2,7 +2,9 @@ package cn.hnthyy.thmz.mapper.his.mz;
 
 
 import cn.hnthyy.thmz.entity.his.mz.MzBaRecord;
+import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 病历字典数据库操作
@@ -14,4 +16,14 @@ public interface MzBaRecordMapper {
             ",#{keyword1,jdbcType=CHAR},#{keyword2,jdbcType=CHAR},#{keyword3,jdbcType=CHAR},#{keyword4,jdbcType=CHAR},#{keyword5,jdbcType=CHAR},#{recordDate,jdbcType=TIMESTAMP}" +
             ",#{archiveDate,jdbcType=TIMESTAMP},#{archiveCode,jdbcType=CHAR},#{lastModifier,jdbcType=CHAR},#{deptCode,jdbcType=CHAR},#{wardCode,jdbcType=CHAR},#{remarkText,jdbcType=VARCHAR}) ")
     int insertMzBaRecord(MzBaRecord mzBaRecord);
+
+
+    /**
+     * 根据病人就诊次数和ID删除本次记录
+     * @param patientId
+     * @param times
+     * @return
+     */
+    @Delete("delete from mz_ba_record where patient_id= #{patientId,jdbcType=VARCHAR} and times = #{times} ")
+    int deleteByPatientIdAndTimes(@Param("patientId") String patientId, @Param("times") Integer times);
 }

+ 10 - 4
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzVisitTableMapper.java

@@ -1,10 +1,7 @@
 package cn.hnthyy.thmz.mapper.his.mz;
 
 import cn.hnthyy.thmz.entity.his.mz.MzVisitTable;
-import org.apache.ibatis.annotations.Insert;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
+import org.apache.ibatis.annotations.*;
 
 import java.util.Date;
 import java.util.List;
@@ -103,4 +100,13 @@ public interface MzVisitTableMapper {
     @Select("select icd_code=isnull(nullif(icd_code_new,''), rtrim(icd_code)),count(1) num from ${tableName} WITH(NOLOCK) GROUP BY icd_code")
     List<Map<String,Object>> selectIcdNum(@Param("tableName") String tableName);
 
+    /**
+     * 根据病人就诊次数和ID删除本次记录
+     * @param patientId
+     * @param times
+     * @return
+     */
+    @Delete("delete from mz_visit_table where patient_id= #{patientId,jdbcType=VARCHAR} and times = #{times} ")
+    int deleteByPatientIdAndTimes(@Param("patientId") String patientId,@Param("times") Integer times);
+
 }

+ 9 - 0
src/main/java/cn/hnthyy/thmz/service/his/mz/MzChargeDetailService.java

@@ -7,6 +7,7 @@ import cn.hnthyy.thmz.entity.his.mz.MzReceiptSerial;
 import cn.hnthyy.thmz.entity.his.mz.MzYjReq;
 import cn.hnthyy.thmz.entity.thmz.Clinic;
 import cn.hnthyy.thmz.entity.thmz.ReceiptSerialFee;
+import cn.hnthyy.thmz.entity.thmz.User;
 import cn.hnthyy.thmz.enums.YesNoEnum;
 import cn.hnthyy.thmz.pageDto.MzChargeDetailPageDto;
 import cn.hnthyy.thmz.vo.MzDepositFileVo;
@@ -289,6 +290,14 @@ public interface MzChargeDetailService {
      */
     Clinic savePrescription(MzPrescriptionVo mzPrescriptionVo,Clinic dbClinic) throws MzException;
 
+    /**
+     * 删除处方
+     * @param clnicId 就诊记录主键
+     * @param tokenUser 当前操作人
+     * @return
+     */
+    int deletePrescription(Long clnicId,User tokenUser) throws MzException;
+
     /**
      * 核酸检测(单人)
      * @param patientId

+ 54 - 31
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -14,7 +14,6 @@ import cn.hnthyy.thmz.entity.his.zd.JcZdItem;
 import cn.hnthyy.thmz.entity.his.zd.JyZdItem;
 import cn.hnthyy.thmz.entity.his.zd.MzZdYpYsh;
 import cn.hnthyy.thmz.entity.his.zd.ZdChargeItem;
-import cn.hnthyy.thmz.entity.jy.InspectionsIndex;
 import cn.hnthyy.thmz.entity.thmz.*;
 import cn.hnthyy.thmz.enums.*;
 import cn.hnthyy.thmz.mapper.his.mz.*;
@@ -657,12 +656,13 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 returnMzChargeDetails.add(mzChargeDetail1);
             }
             //按时间倒序排序
-            Collections.sort(returnMzChargeDetails, new Comparator(){
+            Collections.sort(returnMzChargeDetails, new Comparator() {
                 final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
                 @Override
                 public int compare(Object o1, Object o2) {
-                    MzChargeDetail i1 =(MzChargeDetail)o1;
-                    MzChargeDetail i2 =(MzChargeDetail)o2;
+                    MzChargeDetail i1 = (MzChargeDetail) o1;
+                    MzChargeDetail i2 = (MzChargeDetail) o2;
                     return (i2.getPriceTime()).compareTo(i1.getPriceTime());
                 }
             });
@@ -1134,8 +1134,31 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         return clinic;
     }
 
+    @Override
+    @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
+    public int deletePrescription(Long clnicId,User tokenUser) throws MzException {
+        Clinic clinic = clinicMapper.selectById(clnicId);
+        if (clinic == null) {
+            throw new MzException("删除处方失败,患者就诊记录不存在!");
+        }
+        if (!ClinicStatusEnum.HAD_CLINIC.code.equals(clinic.getClinicStatus())) {
+            throw new MzException("删除处方失败,处方当前状态非未缴费状态,禁止删除!");
+        }
+        if(!clinic.getOpId().equals(tokenUser.getUserIdCode())){
+            throw new MzException("删除处方失败,禁止删除非本人开立处方!");
+        }
+        int num = clinicMapper.deleteById(clnicId);
+        mzVisitTableMapper.deleteByPatientIdAndTimes(clinic.getPatientId(), clinic.getTimes());
+        mzBaRecordMapper.deleteByPatientIdAndTimes(clinic.getPatientId(), clinic.getTimes());
+        mzBlRecordMapper.deleteNotPayBlRecordByPatientId(clinic.getPatientId(), clinic.getTimes());
+        mzChargeDetailMapper.deleteNotPayMzChargeDetailByPatientId(clinic.getPatientId(), clinic.getTimes());
+        mzYjReqMapper.deleteNotPayYjReByPatientId(clinic.getPatientId(), clinic.getTimes());
+        return num;
+    }
+
     /**
      * 判断当前患者的本次挂号是否是急诊号子
+     *
      * @param mzPrescriptionVo
      * @param mzPatientMi
      * @return
@@ -1145,13 +1168,13 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         mzfzPatientOrder.setTableName(MzfzPatientOrder.MZFZ_PATIENT_ORDER);
         mzfzPatientOrder.setPatientId(mzPatientMi.getPatientId());
         mzfzPatientOrder.setDeptCode(mzPrescriptionVo.getVisitDeptCode());
-        List<String> jzCodes=mzyZdChargeTypeService.queryCodesByReqType(Constants.JZ_CODE);
-        if(jzCodes!=null && jzCodes.size()>0){
+        List<String> jzCodes = mzyZdChargeTypeService.queryCodesByReqType(Constants.JZ_CODE);
+        if (jzCodes != null && jzCodes.size() > 0) {
             mzfzPatientOrder.setReqTypes(jzCodes);
         }
         mzfzPatientOrder.setEndTime(DateUtil.fomart(DateUtil.getLastSecond(new Date()), "yyyy-MM-dd HH:mm:ss"));
         Integer total = mzfzPatientOrderService.querycountUnClinic(mzfzPatientOrder);
-        return total>0?YesNoEnum.YES.code:YesNoEnum.NO.code;
+        return total > 0 ? YesNoEnum.YES.code : YesNoEnum.NO.code;
     }
 
     /**
@@ -1272,7 +1295,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                         tempMap.put("frequency", orderFrequencyEnum != null ? orderFrequencyEnum.name : "");
                         tempMap.put("cyJssm", mzChargeDetail.getCyJssm() != null ? mzChargeDetail.getCyJssm() : "");
                         //SupplyTypeEnum supplyTypeEnum = SupplyTypeEnum.getSupplyTypeByCode(mzChargeDetail.getCyDj());
-                        MzZdSupplyType mzZdSupplyType=mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getCyDj());
+                        MzZdSupplyType mzZdSupplyType = mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getCyDj());
                         tempMap.put("cyDj", mzZdSupplyType != null ? mzZdSupplyType.getSupplyName() : "");
                         CyFysmEnum cyFysmEnum = CyFysmEnum.geteCyFysmByCode(mzChargeDetail.getCyFysm() == null ? null : mzChargeDetail.getCyFysm().toString());
                         tempMap.put("cyFysm", cyFysmEnum != null ? cyFysmEnum.name : "");
@@ -1406,7 +1429,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                     name += mzChargeDetail.getQuantity() + UnitTypeEnum.getUnitTypeByCode(ypZdDict.getPackUnit()).name;
                     // name += " 共" + mzChargeDetail.getQuantity() + UnitTypeEnum.getUnitTypeByCode(ypZdDict.getPackUnit()).name;
                     if (StringUtils.isNotBlank(mzChargeDetail.getSupplyCode())) {
-                        MzZdSupplyType mzZdSupplyType=mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getSupplyCode());
+                        MzZdSupplyType mzZdSupplyType = mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getSupplyCode());
                         //SupplyTypeEnum supplyTypeEnum = SupplyTypeEnum.getSupplyTypeByCode(mzChargeDetail.getSupplyCode());
                         if (mzZdSupplyType != null) {
                             name += " 用法:" + mzZdSupplyType.getSupplyName();
@@ -1962,11 +1985,11 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                             throw new MzException("保存处方失败,第" + itemNo + "行药品频率不能为空");
                         }
                         if (needVerify) {
-                            String groupNo=Constants.XY_ZCY_GROUP_NO;
+                            String groupNo = Constants.XY_ZCY_GROUP_NO;
                             if (Constants.CLF.equals(ypZdDict.getBillItemMz())) {
-                                groupNo=Constants.YC_GROUP_NO;
+                                groupNo = Constants.YC_GROUP_NO;
                             }
-                            YpBaseYf ypBaseYf = ypBaseYfMapper.selectYpBaseYf(ypZdDict.getCode(), ypZdDict.getSerial(), groupNo,YesNoEnum.NO.code.toString());
+                            YpBaseYf ypBaseYf = ypBaseYfMapper.selectYpBaseYf(ypZdDict.getCode(), ypZdDict.getSerial(), groupNo, YesNoEnum.NO.code.toString());
                             if (ypBaseYf == null) {
                                 throw new MzException("无药品【" + ypZdDict.getName() + "】编码【" + ypZdDict.getCode() + "】的库存信息!");
                             }
@@ -1975,7 +1998,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                             }
                         }
                         if (Constants.CLF.equals(ypZdDict.getBillItemMz())) {
-                            YpBaseYf ycBaseYf = ypBaseYfMapper.selectYpBaseYf(ypZdDict.getCode(), ypZdDict.getSerial(), Constants.YC_GROUP_NO,YesNoEnum.NO.code.toString());
+                            YpBaseYf ycBaseYf = ypBaseYfMapper.selectYpBaseYf(ypZdDict.getCode(), ypZdDict.getSerial(), Constants.YC_GROUP_NO, YesNoEnum.NO.code.toString());
                             if (ycBaseYf != null) {
                                 mzChargeDetail.setGroupNo(Constants.YC_GROUP_NO);
                                 mzChargeDetail.setExecDept(Constants.YC_EXEC_CODE);
@@ -1986,7 +2009,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                         mzChargeDetail.setSupplyAmount(mzChargeDetail.getOrderDays() * OrderFrequencyEnum.getOrderFrequencyByCode(mzChargeDetail.getFrequency()).times);
                         if (setEmrProcess) {
                             xyIndex++;
-                            MzZdSupplyType mzZdSupplyType=mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getSupplyCode());
+                            MzZdSupplyType mzZdSupplyType = mzZdSupplyTypeMapper.selectMzZdSupplyTypeByCode(mzChargeDetail.getSupplyCode());
                             //SupplyTypeEnum supplyType = SupplyTypeEnum.getSupplyTypeByCode(mzChargeDetail.getSupplyCode());
                             OrderFrequencyEnum orderFrequency = OrderFrequencyEnum.getOrderFrequencyByCode(mzChargeDetail.getFrequency());
                             String value = xyIndex + "." + mzChargeDetail.getTcName() + " " + mzChargeDetail.getQuantity() + ypZdDict.getPackUnit() + " 用法:" + (mzZdSupplyType != null ? mzZdSupplyType.getSupplyName() : "") + " 频次:" + (orderFrequency != null ? orderFrequency.name : "") + " ";
@@ -2064,7 +2087,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 mzChargeDetail.setGlPercent(BigDecimal.ONE);
                 mzChargeDetail.setDoctorCode(mzPrescriptionVo.getDoctorCode());
                 mzChargeDetail.setName(mzPatientMi.getName());
-                mzChargeDetail.setResponceType(mzPatientMi==null?Constants.SELF_PAYING_RESPONCE_TYPE:mzPatientMi.getResponseType());
+                mzChargeDetail.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
                 mzChargeDetail.setYbbxFlag("");
                 mzChargeDetail.setTcNo("");
                 mzChargeDetail.setDetailFlag(YesNoEnum.NO.code.toString());
@@ -2094,19 +2117,19 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             mzZyReq.setIcdTextNew(mzPrescriptionVo.getIcdText());
             if (mzZyReq.getIcdCodeNew() != null && mzZyReq.getIcdCodeNew().length() > 10) {
                 mzZyReq.setIcdCode(mzZyReq.getIcdCodeNew().substring(0, 9));
-            }else {
+            } else {
                 mzZyReq.setIcdCode(mzZyReq.getIcdCodeNew());
             }
             if (mzZyReq.getIcdTextNew() != null && mzZyReq.getIcdTextNew().length() > 25) {
                 mzZyReq.setIcdText(mzZyReq.getIcdTextNew().substring(0, 20));
-            }else {
+            } else {
                 mzZyReq.setIcdText(mzZyReq.getIcdTextNew());
             }
             if (StringUtils.isBlank(mzZyReq.getIcdText())) {
-                if(StringUtils.isNotBlank(mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis())){
+                if (StringUtils.isNotBlank(mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis())) {
                     mzZyReq.setIcdTextNew(mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis());
                     mzZyReq.setIcdText(mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis());
-                    if(mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis().length()>25){
+                    if (mzPrescriptionVo.getMzBlRecord().getTentativeDiagnosis().length() > 25) {
                         mzZyReq.setIcdText(mzZyReq.getIcdTextNew().substring(0, 20));
                     }
                 }
@@ -2171,7 +2194,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
 
     @Override
     public Integer queryCountMzChargeDetailByPatientIdAndChargeItemCode(String patientId, String chargeItemCode) {
-        return mzChargeDetailMapper.selectCountMzChargeDetailByPatientIdAndChargeItemCode(patientId,chargeItemCode);
+        return mzChargeDetailMapper.selectCountMzChargeDetailByPatientIdAndChargeItemCode(patientId, chargeItemCode);
     }
 
     @Override
@@ -2181,7 +2204,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             throw new MzException("当前挂号的病人信息不存在,请先保存病人信息!");
         }
         //自助开核酸的时候更新病人年龄
-        if(mzPatientMi.getBirthDay()!=null){
+        if (mzPatientMi.getBirthDay() != null) {
             int age = DateUtil.getAge(mzPatientMi.getBirthDay());
             mzPatientMi.setAge(age);
             mzPatientMiMapper.updateMzPatientMi(mzPatientMi);
@@ -2230,7 +2253,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             throw new MzException("当前挂号的病人信息不存在,请先保存病人信息!");
         }
         //自助开核酸的时候更新病人年龄
-        if(mzPatientMi.getBirthDay()!=null){
+        if (mzPatientMi.getBirthDay() != null) {
             int age = DateUtil.getAge(mzPatientMi.getBirthDay());
             mzPatientMi.setAge(age);
             mzPatientMiMapper.updateMzPatientMi(mzPatientMi);
@@ -2498,8 +2521,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             icdText += mzVisitTable.getIcdText();
         }
         //诊断太长导致处方分页
-        if(icdText.length()>60){
-            icdText=icdText.substring(0,60);
+        if (icdText.length() > 60) {
+            icdText = icdText.substring(0, 60);
         }
         mzPrescriptionVo.setIcdText(icdText);
         mzPrescriptionVo.setMzBlRecord(mzBlRecord);
@@ -2533,9 +2556,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                     //是给药方式产生的诊疗项目,不添加进构造的处方
                     if (supplyChargeItemCodeSet != null && supplyChargeItemCodeSet.contains(mzChargeDetail.getChargeItemCode())) {
                         supplyList.add(mzChargeDetail);
-                    }else {
+                    } else {
                         YpZdDict ypZdDict = ypZdDictService.queryYpZdDictByCodeAndSerial(mzChargeDetail.getChargeItemCode(), mzChargeDetail.getSerial());
-                        if(ypZdDict!=null && StringUtils.isNotBlank(ypZdDict.getName())){
+                        if (ypZdDict != null && StringUtils.isNotBlank(ypZdDict.getName())) {
                             mzChargeDetail.setTcName(ypZdDict.getName());
                         }
                     }
@@ -4086,7 +4109,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 newMzChargeDetail.setOrderBill(0);
                 newMzChargeDetail.setChargeBillCode(Constants.SSWR_BILL_ITEM_CODE);
                 newMzChargeDetail.setSelfFlag(YesNoEnum.NO.code.toString());
-                newMzChargeDetail.setResponceType(mzPatientMi==null?Constants.SELF_PAYING_RESPONCE_TYPE:mzPatientMi.getResponseType());
+                newMzChargeDetail.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
                 newMzChargeDetail.setGlPercentFt(BigDecimal.ONE);
                 newMzChargeDetail.setOrigPrice(newMzChargeDetail.getUnitPrice());
                 newMzChargeDetail.setTcName("四舍五入");
@@ -4180,7 +4203,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             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.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
             newMzChargeDetail.setGlPercentFt(BigDecimal.ONE);
             newMzChargeDetail.setReqYj(YesNoEnum.YES.code.toString());
             newMzChargeDetail.setGroupId(YesNoEnum.NO.code);
@@ -4269,7 +4292,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
             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.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
             newMzChargeDetail.setGlPercentFt(BigDecimal.ONE);
             newMzChargeDetail.setReqYj(YesNoEnum.YES.code.toString());
             newMzChargeDetail.setGroupId(YesNoEnum.YES.code);
@@ -4582,7 +4605,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         newMzChargeDetail.setOrderBill(0);
         newMzChargeDetail.setChargeBillCode(newMzChargeDetail.getChargeItemCode());
         newMzChargeDetail.setSelfFlag(YesNoEnum.NO.code.toString());
-        newMzChargeDetail.setResponceType(mzPatientMi==null?Constants.SELF_PAYING_RESPONCE_TYPE:mzPatientMi.getResponseType());
+        newMzChargeDetail.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
         newMzChargeDetail.setGlPercentFt(BigDecimal.ONE);
         newMzChargeDetail.setOrigPrice(BigDecimal.ZERO);
         newMzChargeDetail.setReqYj(YesNoEnum.YES.code.toString());
@@ -4669,7 +4692,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         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.setResponceType(mzPatientMi == null ? Constants.SELF_PAYING_RESPONCE_TYPE : mzPatientMi.getResponseType());
         newMzChargeDetail.setGlPercentFt(BigDecimal.ONE);
         newMzChargeDetail.setOrigPrice(zdChargeItem.getChargeAmount());
         newMzChargeDetail.setReqYj(YesNoEnum.YES.code.toString());

+ 44 - 12
src/main/resources/static/js/mz/clinic.js

@@ -7021,6 +7021,8 @@ function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
                 $("#previewYjReq").off("click");
                 $("#previewYjReqAll").removeClass("in").addClass("hide");
                 $("#previewYjReqAll").off("click");
+                $("#deletePrescription").removeClass("in").addClass("hide");
+                $("#deletePrescription").off("click");
                 if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
                     $("#previewYjReq").removeClass("hide").addClass("in");
                     $("#previewYjReq").off("click").on("click", function (t) {
@@ -7080,18 +7082,6 @@ function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
                             });
                         }
                     }
-                    // $("#printBlRecord").removeClass("hide").addClass("in");
-                    // $("#printBlRecord").off("click").on("click", function (t) {
-                    //     printBlRecord(patientId, times, 1);
-                    // });
-                    // $("#printBlRecordSetup").removeClass("hide").addClass("in");
-                    // $("#printBlRecordSetup").off("click").on("click", function (t) {
-                    //     printBlRecord(patientId, times, 2);
-                    // });
-                    // $("#showMzBlRecordModal").removeClass("hide").addClass("in");
-                    // $("#showMzBlRecordModal").off("click").on("click", function (t) {
-                    //     showMzBlRecordModal(patientId, times, 1);
-                    // });
                     if (jsonData.mzZyReq == null || jsonData.mzZyReq.reqDept == null || jsonData.mzZyReq.reqDept == "") {
                         $("#printZyReq").removeClass("in").addClass("hide");
                         $("#printZyReq").off("click");
@@ -7107,6 +7097,13 @@ function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
                             printZyReq(patientId, 2);
                         });
                     }
+                    //未缴费状态的时候可以删除处方
+                    if(oriPayMark==5 || oriPayMark=="5"){
+                        $("#deletePrescription").removeClass("hide").addClass("in");
+                        $("#deletePrescription").off("click").on("click", function (t) {
+                            deletePrescription(clnicId);
+                        });
+                    }
                 } else {
                     $("#printPrescription").removeClass("in").addClass("hide");
                     $("#printZyReq").removeClass("in").addClass("hide");
@@ -8009,6 +8006,41 @@ function previewYjReq(patientId, times) {
     initJcJyTable();
 }
 
+/**
+ * 删除本次处方
+ * @param clnicId 就诊记录id
+ */
+function deletePrescription(clnicId) {
+    $("#visitingDetailModal").modal("hide");
+    $("#messageModal").modal();
+    $("#messageContent").html("确认要删除本次处方信息吗?");
+    $("#messageButton").off("click").on("click", function (t) {
+        $("#messageModal").modal("hide");
+        $.ajax({
+            type: "GET",
+            url: '/thmz/deletePrescription?clnicId=' + clnicId,
+            contentType: "application/json;charset=UTF-8",
+            dataType: "json",
+            headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
+            success: function (res) {
+                if (res == '401' || res == 401) {
+                    window.location.href = '/thmz/login/view'
+                    return;
+                }
+                if (res.code == 0) {
+                    successMesage(res);
+                    $("#tb_table_clinic").bootstrapTable('refresh');
+                } else {
+                    errorMesage(res);
+                }
+            }
+        });
+    });
+    $("#cancelButton").off("click").on("click", function (t) {
+        $("#visitingDetailModal").modal();
+    });;
+}
+
 
 /**
  * 检查检验列表类型按钮切换事件

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

@@ -1310,6 +1310,7 @@
                 <button type="button" class="btn btn-primary hide" id="showMzBlRecordModal">病历编辑</button>
                 <button type="button" class="btn btn-primary hide" id="previewYjReq">检查检验报告</button>
                 <button type="button" class="btn btn-primary hide" id="previewYjReqAll">检查检验报告(含往期)</button>
+                <button type="button" class="btn btn-primary hide" id="deletePrescription">删除处方</button>
                 <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                 <div class="x_panel_mine" style="background: #EBEBE4;">
                     <div class="x_title">