浏览代码

门诊医生优化

hurugang 3 年之前
父节点
当前提交
615b7c3f23

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

@@ -106,9 +106,12 @@ public class MzBlRecordController {
             mzPatientMi.setGender(GenderEnum.getGenderByCode(mzPatientMi.getSex()).name);
             results.put("mzPatientMi", mzPatientMi);
             MzVisitTable mzVisitTable = mzVisitTableService.queryByPatientIdAndTimes(patientId, times);
+            String icdText=StringUtils.isBlank(mzBlRecord.getTentativeDiagnosis())?"":mzBlRecord.getTentativeDiagnosis();
             if (mzVisitTable != null && mzVisitTable.getIcdText() != null && StringUtils.isNotBlank(mzVisitTable.getIcdText())) {
-                results.put("icdText", StringUtils.isBlank(mzBlRecord.getTentativeDiagnosis())?mzVisitTable.getIcdText():mzVisitTable.getIcdText()+" "+mzBlRecord.getTentativeDiagnosis());
+                icdText+=mzVisitTable.getIcdText();
+                //results.put("icdText", StringUtils.isBlank(mzBlRecord.getTentativeDiagnosis())?mzVisitTable.getIcdText():mzVisitTable.getIcdText()+" "+mzBlRecord.getTentativeDiagnosis());
             }
+            results.put("icdText", icdText);
             return results;
         } catch (Exception e) {
             e.printStackTrace();

+ 2 - 2
src/main/java/cn/hnthyy/thmz/mapper/his/mz/MzChargeDetailMapper.java

@@ -645,7 +645,7 @@ public interface MzChargeDetailMapper {
     List<Map<String, Object>> selectChargeListByPatient(@Param("patientId") String patientId, @Param("name") String name, @Param("serialNo") String serialNo, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);
 
     /**
-     * 查询某个病人当月购买某一药品的总数量
+     * 查询某个病人最近一段时间购买某一药品的总数量
      *
      * @param patientId
      * @param chargeItemCode
@@ -654,7 +654,7 @@ public interface MzChargeDetailMapper {
      * @return
      */
     @Select("select sum(quantity*drug_win) from mz_charge_detail WITH(NOLOCK) where patient_id =#{patientId} and charge_date>=#{beginDate,jdbcType=TIMESTAMP} and pay_mark in (0,1) and charge_item_code=#{chargeItemCode,jdbcType=CHAR} and  serial=#{serial} ")
-    Integer selectTotalQuantityForMonth(@Param("patientId") String patientId, @Param("chargeItemCode") String chargeItemCode, @Param("serial") String serial, @Param("beginDate") Date beginDate);
+    Integer selectTotalQuantityForDate(@Param("patientId") String patientId, @Param("chargeItemCode") String chargeItemCode, @Param("serial") String serial, @Param("beginDate") Date beginDate);
 
     /**
      * 根据病人编码和收费流水号查询缴费明细

+ 3 - 3
src/main/java/cn/hnthyy/thmz/mapper/his/yp/YpZdDictMapper.java

@@ -14,7 +14,7 @@ public interface YpZdDictMapper {
      * @param code
      * @return
      */
-    @Select("select code,name,specification,mz_restrict,bill_item_mz,bill_item_zy,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency,serial,drug_flag,mini_unit,ps_flag,retprice,fix_price,buy_price,isnull(byj_flag,0) byj_flag,national_code from yp_zd_dict WITH(NOLOCK) where code = #{code,jdbcType=VARCHAR} and serial = #{serial}")
+    @Select("select code,name,specification,mz_restrict,bill_item_mz,bill_item_zy,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency,serial,drug_flag,mini_unit,ps_flag,retprice,fix_price,buy_price,isnull(byj_flag,0) byj_flag,national_code,prescription_limit_days from yp_zd_dict WITH(NOLOCK) where code = #{code,jdbcType=VARCHAR} and serial = #{serial}")
     YpZdDict selectYpZdDictByCodeAndSerial(@Param("code") String code,@Param("serial") String serial);
 
     /**
@@ -24,7 +24,7 @@ public interface YpZdDictMapper {
      * @return
      */
     @Select({"<script>",
-            "select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency,serial,drug_flag,mini_unit,ps_flag,retprice,fix_price,buy_price from yp_zd_dict WITH(NOLOCK)",
+            "select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency,serial,drug_flag,mini_unit,ps_flag,retprice,fix_price,buy_price,prescription_limit_days from yp_zd_dict WITH(NOLOCK)",
             "<when test='codes!=null'>",
             " where code in",
             "<foreach item='item' index='index' collection='codes' open='(' separator=',' close=')'>",
@@ -42,7 +42,7 @@ public interface YpZdDictMapper {
      * @param code
      * @return
      */
-    @Select("select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency,serial,drug_flag,mini_unit,ps_flag,retprice,fix_price,buy_price from yp_zd_dict WITH(NOLOCK) where code = #{code,jdbcType=VARCHAR} ")
+    @Select("select code,name,specification,mz_restrict,bill_item_mz,pack_retprice,country_flag,supply_type,pack_unit,weight,volum,weigh_unit,vol_unit,pack_size,manu_code,frequency,serial,drug_flag,mini_unit,ps_flag,retprice,fix_price,buy_price,prescription_limit_days from yp_zd_dict WITH(NOLOCK) where code = #{code,jdbcType=VARCHAR} ")
     List<YpZdDict> selectYpZdDictByCode(@Param("code") String code);
 
     /**

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

@@ -314,7 +314,7 @@ public interface ZdChargeItemMapper {
             "</when>",
             "  code=rtrim(code),name,specification=charge_unit,charge_amount,manufactory=yb_comment,exec_unit,group_no='00' ,type=3  ",
             "    FROM zd_charge_item WITH(NOLOCK)   ",
-            "where  class_code in ('C','E','G','F','J')",
+            "where  class_code in ('C','D','E','G','F','J')",
             "<when test='commonParams!=null'>",
             " and (py_code like #{commonParams} or d_code  like #{commonParams} or code like #{commonParams} or name like #{commonParams} or class_code like #{commonParams}",
             "<when test='letterParamsLowerCase!=null'>",

+ 23 - 13
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzChargeDetailServiceImpl.java

@@ -721,12 +721,12 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         clinic.setTimes(mzDepositFileVo.getTimes());
         clinic.setReceiptNo(receiptNo);
         clinic.setClinicStatus(ClinicStatusEnum.CHARGED.code);
-        try{
+        try {
             clinicMapper.updateClinicByPatientIdAndTimes(clinic);
-        }catch (DuplicateKeyException e){
+        } catch (DuplicateKeyException e) {
             //可能会有同一就诊次数不同缴费次数的数据,老医生系统产生,导致更新的时候索引重复,无法缴费
-            List<Clinic> clinicList=clinicMapper.selectByPatientIdAndTimes(mzDepositFileVo.getPatientId(),mzDepositFileVo.getTimes());
-            if(clinicList!=null && clinicList.size()>0){
+            List<Clinic> clinicList = clinicMapper.selectByPatientIdAndTimes(mzDepositFileVo.getPatientId(), mzDepositFileVo.getTimes());
+            if (clinicList != null && clinicList.size() > 0) {
                 clinicMapper.deleteById(clinicList.get(0).getId());
                 clinicMapper.updateClinicByPatientIdAndTimes(clinic);
             }
@@ -1335,7 +1335,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                     if (mzChargeDetail.getGroupOrder() != null) {
                         name = mzChargeDetail.getGroupOrder() + "." + name;
                     }
-                    String unitDesc=null;
+                    String unitDesc = null;
                     if (mzChargeDetail.getDrugUnit() != null) {
                         unitDesc = UnitTypeEnum.getUnitTypeByCode(mzChargeDetail.getDrugUnit()).name;
                         if (mzChargeDetail.getDrugUnit().equals(ypZdDict.getWeighUnit()) && ypZdDict.getWeight() != null) {
@@ -1343,7 +1343,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                         } else if (mzChargeDetail.getDrugUnit().equals(ypZdDict.getVolUnit()) && ypZdDict.getVolum() != null) {
                             name += " " + ypZdDict.getVolum().doubleValue() + unitDesc;
                         }
-                       // name += " " + mzChargeDetail.getDrugQuan() + unitDesc;
+                        // name += " " + mzChargeDetail.getDrugQuan() + unitDesc;
                     }
                     name += " 共" + mzChargeDetail.getQuantity() + UnitTypeEnum.getUnitTypeByCode(ypZdDict.getPackUnit()).name;
                     if (StringUtils.isNotBlank(mzChargeDetail.getSupplyCode())) {
@@ -1859,7 +1859,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                         //当前处方购药量
                         BigDecimal thisQuantity = BigDecimal.valueOf(mzChargeDetail.getQuantity()).multiply(BigDecimal.valueOf(mzChargeDetail.getDrugWin()));
                         //本月已经购买量
-                        Integer quantityDb = mzChargeDetailMapper.selectTotalQuantityForMonth(mzChargeDetail.getPatientId(), mzChargeDetail.getChargeItemCode(), mzChargeDetail.getSerial(), DateUtil.getFirstSecondForMonth(new Date()));
+                        Integer quantityDb = mzChargeDetailMapper.selectTotalQuantityForDate(mzChargeDetail.getPatientId(), mzChargeDetail.getChargeItemCode(), mzChargeDetail.getSerial(), DateUtil.getFirstSecondForMonth(new Date()));
                         quantityDb = quantityDb == null ? 0 : quantityDb;
                         BigDecimal totalQuantity = thisQuantity.add(BigDecimal.valueOf(quantityDb));
                         if (totalQuantity.compareTo(BigDecimal.valueOf(ypZdDict.getMzRestrict())) == 1) {
@@ -1871,6 +1871,12 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                             throw new MzException("药品【" + ypZdDict.getName() + "】编码【" + ypZdDict.getCode() + "】的药品超过限购量,最大购买量为【" + ypZdDict.getMzRestrict() + "】,本月已购买量为【" + quantityDb + "】,本次最大可购量为【" + tempCount + "】,当前处方购药数量【" + thisQuantity + "】请修改处方限制购药品种的数量");
                         }
                     }
+                    if (ypZdDict.getPrescriptionLimitDays() != null && ypZdDict.getPrescriptionLimitDays() > 0) {
+                        Integer quantityDb = mzChargeDetailMapper.selectTotalQuantityForDate(mzChargeDetail.getPatientId(), mzChargeDetail.getChargeItemCode(), mzChargeDetail.getSerial(), DateUtil.getDateFromNow(-ypZdDict.getPrescriptionLimitDays()));
+                        if (quantityDb != null && quantityDb > 0) {
+                            throw new MzException("药品【" + ypZdDict.getName() + "】编码【" + ypZdDict.getCode() + "】的药品超过限购量,最近"+ypZdDict.getPrescriptionLimitDays()+"天已经购买过该药品!");
+                        }
+                    }
                     String chargeBillCode = Constants.BILL_ITEM_CODE_prev + ypZdDict.getBillItemMz().substring(1);
                     mzChargeDetail.setChargeBillCode(chargeBillCode);
                     mzChargeDetail.setUnitPrice(ypZdDict.getPackRetprice());
@@ -2034,13 +2040,13 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
     @Override
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     public int modifyReceiveFlagAndConfirmFlag(String flag, String opId, Integer reqNo) throws MzException {
-        if(StringUtils.isBlank(flag)){
+        if (StringUtils.isBlank(flag)) {
             throw new MzException("确认标志不能为空");
         }
-        if(StringUtils.isBlank(opId)){
+        if (StringUtils.isBlank(opId)) {
             throw new MzException("确认人ID不能为空");
         }
-        if(reqNo==null){
+        if (reqNo == null) {
             throw new MzException("申请单号不能为空");
         }
         Date now = new Date();
@@ -2061,7 +2067,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
 
     @Override
     public Integer queryPrintFlag(String patientId, String times, Integer orderNo) {
-        return mzChargeDetailMapper.selectPrintFlag(patientId,times,orderNo);
+        return mzChargeDetailMapper.selectPrintFlag(patientId, times, orderNo);
     }
 
     @Override
@@ -2355,10 +2361,14 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         if (mzVisitTable == null) {
             throw new MzException("病人就诊记录不存在!");
         }
+        MzBlRecord mzBlRecord = mzBlRecordMapper.selectMzBlRecordByPatientIdAndTimes(patientId, times);
         mzPrescriptionVo.setFirstOrNot(mzVisitTable.getFirstOrNot());
         mzPrescriptionVo.setIcdCode(mzVisitTable.getIcdCode());
-        mzPrescriptionVo.setIcdText(mzVisitTable.getIcdText());
-        MzBlRecord mzBlRecord = mzBlRecordMapper.selectMzBlRecordByPatientIdAndTimes(patientId, times);
+        String icdText=StringUtils.isBlank(mzBlRecord.getTentativeDiagnosis())?"":mzBlRecord.getTentativeDiagnosis();
+        if (mzVisitTable != null && mzVisitTable.getIcdText() != null && StringUtils.isNotBlank(mzVisitTable.getIcdText())) {
+            icdText+=mzVisitTable.getIcdText();
+        }
+        mzPrescriptionVo.setIcdText(icdText);
         if (mzBlRecord == null) {
             //throw new MzException("病人门诊病历记录不存在!");
             //因为16年前没有病历数据