Browse Source

修复老系统并行运行的时候导致的病历号和医技申请号重复问题

hurugang 3 years ago
parent
commit
ccb783838b

+ 2 - 3
src/main/java/cn/hnthyy/thmz/entity/his/mz/MzBaRecord.java

@@ -1,6 +1,5 @@
 package cn.hnthyy.thmz.entity.his.mz;
 
-import cn.hnthyy.thmz.vo.MzPrescriptionVo;
 import lombok.Data;
 
 import java.util.Date;
@@ -15,7 +14,7 @@ public class MzBaRecord {
     //就诊次数
     private Integer times;
     //病历编号
-    private Integer blCode;
+    private String blCode;
     //创建日期
     private Date createDate;
     //创建人
@@ -49,7 +48,7 @@ public class MzBaRecord {
 
 
 
-    public static MzBaRecord getMzBaRecord(String patientId,String createCode,String deptCode, int times, Date now, int blNo) {
+    public static MzBaRecord getMzBaRecord(String patientId,String createCode,String deptCode, int times, Date now, String blNo) {
         MzBaRecord mzBaRecord = new MzBaRecord();
         mzBaRecord.setPatientId(patientId);
         mzBaRecord.setTimes(times);

+ 2 - 2
src/main/java/cn/hnthyy/thmz/service/his/mz/MzYshConfigService.java

@@ -14,13 +14,13 @@ public interface MzYshConfigService {
      * @return
      * @throws MzException
      */
-    int getReqPageNo() throws MzException;
+    String getReqPageNo() throws MzException;
 
     /**
      * 获取病历号
      * @return
      * @throws MzException
      */
-    int getBlNo() throws MzException;
+    String getBlNo() throws MzException;
 
 }

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

@@ -905,13 +905,13 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         updateMzPatientMi.setLvDate(now);
         mzPatientMiMapper.updateMzPatientMi(updateMzPatientMi);
 
-        int blNo = mzYshConfigService.getBlNo();
+        String blNo = mzYshConfigService.getBlNo();
         MzBaRecord mzBaRecord = MzBaRecord.getMzBaRecord(mzPrescriptionVo.getPatientId(), mzPrescriptionVo.getDoctorCode(), mzPrescriptionVo.getVisitDeptCode(), times, now, blNo);
         mzBaRecordMapper.insertMzBaRecord(mzBaRecord);
         MzBlRecord mzBlRecord = mzPrescriptionVo.getMzBlRecord();
         mzBlRecord.setPatientId(mzPrescriptionVo.getPatientId());
         mzBlRecord.setTimes(times);
-        mzBlRecord.setEmrNo(String.valueOf(blNo));
+        mzBlRecord.setEmrNo(blNo);
         mzBlRecord.setEmrType(YesNoEnum.YES.code.toString());
         mzBlRecord.setVisitDate(now);
         mzBlRecord.setDoctorCode(mzPrescriptionVo.getDoctorCode());
@@ -929,6 +929,9 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
         //保存医技入库
         if (mzPrescriptionVo.getMzYjReqList() != null && mzPrescriptionVo.getMzYjReqList().size() > 0) {
             for (MzYjReq mzYjReq : mzPrescriptionVo.getMzYjReqList()) {
+                mzYjReq.setReqNo(mzYshConfigService.getReqNo());
+                mzYjReq.setPageNo(mzYshConfigService.getReqPageNo());
+                mzYjReq.setReqDate(now);
                 mzYjReqMapper.insertMzYjReq(mzYjReq);
             }
         }
@@ -1493,9 +1496,6 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
                 if (StringUtils.isBlank(mzYjReq.getOrderCode())) {
                     throw new MzException("保存处方失败,医技项目编码不能为空");
                 }
-                mzYjReq.setReqNo(mzYshConfigService.getReqNo());
-                mzYjReq.setPageNo(String.valueOf(mzYshConfigService.getReqPageNo()));
-                mzYjReq.setReqDate(now);
                 mzYjReq.setItemNo(0);
                 mzYjReq.setReceiptNo(0);
                 mzYjReq.setPatientId(mzPrescriptionVo.getPatientId());

+ 6 - 5
src/main/java/cn/hnthyy/thmz/service/impl/his/mz/MzYshConfigServiceImpl.java

@@ -36,7 +36,8 @@ public class MzYshConfigServiceImpl implements MzYshConfigService {
         if (num == 0) {
             throw new MzException("获取医技申请单号失败,请重试!");
         }
-        return mzYshConfig.getReqNo();
+        //老系统和新系统并行时的折中办法
+        return 2000000000+mzYshConfig.getReqNo();
     }
 
     /**
@@ -46,7 +47,7 @@ public class MzYshConfigServiceImpl implements MzYshConfigService {
      */
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     @Override
-    public int getReqPageNo() throws MzException {
+    public String getReqPageNo() throws MzException {
         mzYshConfigMapper.updateForBlock();
         MzYshConfig mzYshConfig = mzYshConfigMapper.selectMzYshConfig();
         if (mzYshConfig == null) {
@@ -59,7 +60,7 @@ public class MzYshConfigServiceImpl implements MzYshConfigService {
         if (num == 0) {
             throw new MzException("获取医技申请单号失败,请重试!");
         }
-        return mzYshConfig.getReqPageNo();
+        return "N"+mzYshConfig.getReqPageNo();
     }
 
     /**
@@ -69,7 +70,7 @@ public class MzYshConfigServiceImpl implements MzYshConfigService {
      */
     @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, timeout = 36000, rollbackFor = Exception.class)
     @Override
-    public int getBlNo() throws MzException {
+    public String getBlNo() throws MzException {
         mzYshConfigMapper.updateForBlock();
         MzYshConfig mzYshConfig = mzYshConfigMapper.selectMzYshConfig();
         if (mzYshConfig == null) {
@@ -82,6 +83,6 @@ public class MzYshConfigServiceImpl implements MzYshConfigService {
         if (num == 0) {
             throw new MzException("获取病历单号失败,请重试!");
         }
-        return mzYshConfig.getBlNo();
+        return "N"+mzYshConfig.getBlNo();
     }
 }