Преглед на файлове

病例保存返回url新增,入院记录时没有入院登记会先拉取入院登记

shiyue преди 3 години
родител
ревизия
2f42aca2a9
променени са 1 файла, в които са добавени 32 реда и са изтрити 13 реда
  1. 32 13
      src/main/java/com/diagbot/facade/data/AMedicalRecordFacade.java

+ 32 - 13
src/main/java/com/diagbot/facade/data/AMedicalRecordFacade.java

@@ -297,19 +297,34 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
                 //更新文书详情
                 aMedicalRecordContentFacade.executeMrRecordContent(s.getContents());
             });
-            respDto.put("ret","0");respDto.put("mag","true");
-            String code="";
-            if (StringUtils.isNotEmpty(aMrContentVO.getRecords().get(0).getBehospitalCode())){
-                code="住院号"+aMrContentVO.getRecords().get(0).getBehospitalCode();
-            }else if (StringUtils.isNotEmpty(aMrContentVO.getRecords().get(0).getRecId())){
-                code="文书id"+aMrContentVO.getRecords().get(0).getRecId();
+            //参数取值,判断modeId
+            String behospitalCode = aMrContentVO.getRecords().get(0).getBehospitalCode();
+            Long hospitalId = aMrContentVO.getRecords().get(0).getHospitalId();
+            MedicalRecord medicalRecord = new MedicalRecord();
+            BeanUtil.copyProperties(aMrContentVO.getRecords().get(0), medicalRecord);
+            Long modeId = initModeId(medicalRecord);
+
+            //页面url拼接
+            String indexUrl = readProperties.getProcessQcUrl() + "?behospitalCode=" + behospitalCode + "&hospitalId=" + hospitalId + "&modeId=" + modeId;
+            String totalUrl ="http://132.147.253.31:1489/total.html"+ "?behospitalCode=" + behospitalCode + "&hospitalId=" + hospitalId;
+
+            //判断文书是否为入院记录或者是出院记录
+            if (modeId.equals(Long.valueOf("1"))){
+                respDto.put("ret","1");respDto.put("mag",indexUrl);
+            }else if (modeId.equals(Long.valueOf("5"))){
+                respDto.put("ret","1");respDto.put("mag",totalUrl);
+            }else {
+                respDto.put("ret","0");respDto.put("mag","true");
             }
+
             aMedAbnormalInfoFacade.saveAbnormalInfo("文书信息入參",
-                    code,
+                    behospitalCode,
                     JSON.toJSONString(aMrContentVO),
                     JSON.toJSONString(respDto),
                     "");
 
+
+
             return respDto;
 
 //            //数据解析,评分规则等还未完整时不解析
@@ -407,18 +422,22 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
                         BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
                                 .eq("behospital_code", s.getBehospitalCode())
                                 .eq("hospital_id", s.getHospitalId()), false);
-                        if (behospitalInfo != null) {
-                            //如果病人住院信息存在,更新对应的qc_type_id
-                            Long qcTypeId = initQcTypeId(behospitalInfo);
-                            behospitalInfo.setQcTypeId(qcTypeId);
-                            behospitalInfoList.add(behospitalInfo);
-                        }else {
+                        if (behospitalInfo == null) {
                             //如果不存在则取视图上查询并添加
                             String code =s.getBehospitalCode();
                             String hospitalCode = code.substring(0, code.indexOf("_"));
                             String hospitalNum = code.substring(hospitalCode.length() + 1, code.length());
                             String infoSql = "select * from admission_pat_regist where behospitalCode = '" + hospitalCode + "' and behospitalNum = '" + hospitalNum + "'";
                             viewFacade.getInfo(infoSql);
+                            behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
+                                    .eq("behospital_code", s.getBehospitalCode())
+                                    .eq("hospital_id", s.getHospitalId()), false);
+                        }
+                        if (behospitalInfo != null){
+                            //如果病人住院信息存在,更新对应的qc_type_id
+                            Long qcTypeId = initQcTypeId(behospitalInfo);
+                            behospitalInfo.setQcTypeId(qcTypeId);
+                            behospitalInfoList.add(behospitalInfo);
                         }
                     }
                     s.setModeId(modeId);