shiyue 4 лет назад
Родитель
Сommit
05c2ab5924

+ 6 - 5
src/main/java/com/diagbot/facade/QcClientFacade.java

@@ -44,12 +44,13 @@ public class QcClientFacade {
 
     public Response<OutputInfo> analyseField(QueryVo queryVo) {
         URI uri = null;
-        String code = "active_profiles_" + SpringContextUtil.getActiveProfile();
-        String url = sysHospitalSetFacade.getValue(Long.valueOf(queryVo.getHospitalId()), code);
-        if (StringUtil.isBlank(url)) {
-            throw new CommonException(CommonErrorCode.NOT_EXISTS, "配置表内找不到评分接口地址数据!");
-        }
+//        String code = "active_profiles_" + SpringContextUtil.getActiveProfile();
+//        String url = sysHospitalSetFacade.getValue(Long.valueOf(queryVo.getHospitalId()), code);
+//        if (StringUtil.isBlank(url)) {
+//            throw new CommonException(CommonErrorCode.NOT_EXISTS, "配置表内找不到评分接口地址数据!");
+//        }
         try {
+            String url = "http://127.0.0.1:6010";
             uri = new URI(url);
         } catch (Exception e) {
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR);

+ 4 - 3
src/main/java/com/diagbot/facade/data/ABehospitalInfoFacade.java

@@ -9,6 +9,7 @@ import com.diagbot.entity.BehospitalInfo;
 import com.diagbot.entity.MedicalRecord;
 import com.diagbot.entity.QcType;
 import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.facade.BehospitalInfoFacade;
 import com.diagbot.facade.QcAbnormalFacade;
 import com.diagbot.facade.QcTypeFacade;
 import com.diagbot.service.impl.BehospitalInfoServiceImpl;
@@ -130,12 +131,12 @@ public class ABehospitalInfoFacade extends BehospitalInfoServiceImpl {
                     .eq("is_deleted",IsDeleteEnum.N), false);
             if (behospitalInfo != null) {
                 s.setGmtModified(new Date());
-                s.setQcTypeId(initQcTypeId(s));
+//                s.setQcTypeId(initQcTypeId(s));
                 updateE.add(s);
             } else {
                 s.setGmtCreate(new Date());
-                s.setQcTypeId(initQcTypeId(s));
-                addE.add(s);
+//                s.setQcTypeId(initQcTypeId(s));
+                this.save(s);
             }
         });
         if(addE.size()>0){

+ 20 - 10
src/main/java/com/diagbot/facade/data/AMedicalRecordFacade.java

@@ -381,17 +381,18 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
                         qcAbnormal.setDescription(s.getRecTitle());
                         qcAbnormal.setGmtCreate(new Date());
                         qcAbnormalList.add(qcAbnormal);
-                    } else if (modeId == Long.valueOf("1")) {
-                        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 (modeId == Long.valueOf("1")) {
+//                        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);
+//                        }
+//                    }
                     s.setModeId(modeId);
                     //新增或修改
                     MedicalRecord mRecord = this.getOne(new QueryWrapper<MedicalRecord>()
@@ -475,6 +476,15 @@ public class AMedicalRecordFacade extends MedicalRecordServiceImpl {
         } else {
             modeId = Long.valueOf("0");
         }
+        if (modeId==Long.valueOf("0")){
+            if (medicalRecord.getRecTitle().contains("24小时")){
+                modeId=Long.valueOf("0");
+            }
+        }else if (modeId==Long.valueOf("5")){
+            if (medicalRecord.getRecTitle().contains("死亡")){
+                modeId=Long.valueOf("24");
+            }
+        }
         return modeId;
     }
 

+ 22 - 19
src/main/java/com/diagbot/facade/data/SendDataDealFacade.java

@@ -37,19 +37,19 @@ public class SendDataDealFacade {
 
     public void sendDataDeal(String startDate,String stopDate){
         //根据时间得到历史病人登记数据
-        List<BehospitalInfo> behospitalInfoList =sendDataDealABehospitalInfo(startDate,stopDate);
+        sendDataDealABehospitalInfo(startDate,stopDate);
         //根据的到的病人登记数据来获取病人的其他信息
-        if (behospitalInfoList.size()>0){
-            behospitalInfoList.forEach(s->{
-                sendDataDealADoctorAdvice(s.getBehospitalCode());
-                sendDataDealAMedicalRecord(s.getBehospitalCode());
-//                sendDataDealAHomePage(s.getBehospitalCode());
-//                sendDataDealAHomeDiagnoseInfo(s.getBehospitalCode());
-//                sendDataDealAHomeOperationInfo(s.getBehospitalCode());
-            });
-        }else {
-            System.out.println("没有该时间点的病人登记信息");
-        }
+//        if (behospitalInfoList.size()>0){
+//            behospitalInfoList.forEach(s->{
+//                sendDataDealADoctorAdvice(s.getBehospitalCode());
+//                sendDataDealAMedicalRecord(s.getBehospitalCode());
+////                sendDataDealAHomePage(s.getBehospitalCode());
+////                sendDataDealAHomeDiagnoseInfo(s.getBehospitalCode());
+////                sendDataDealAHomeOperationInfo(s.getBehospitalCode());
+//            });
+//        }else {
+//            System.out.println("没有该时间点的病人登记信息");
+//        }
 
     }
 
@@ -62,11 +62,12 @@ public class SendDataDealFacade {
     public List<BehospitalInfo> sendDataDealABehospitalInfo(String startDate,String stopDate) {
         List<BehospitalInfo> behospitalInfos =new ArrayList<>();
         try {
-            String sql = "select * from   登记视图 t where t.";
+            String sql = "select * from   v_jkcdss_zy_bingrenjbxx t where to_char(t.behospitalDate,'yyyymmdd')>= '"+startDate+" ' " +
+                    " and to_char(t.behospitalDate,'yyyymmdd')<= '"+stopDate+" '";
             behospitalInfos = tzDBConn.getBehospitalInfo(sql);
             aBehospitalInfoFacade.execute(behospitalInfos);
         } catch (Exception e) {
-            aMedAbnormalInfoFacade.saveAbnormalInfo("获取病人住院登记历史数据", startDate+"--"+stopDate, "", "", e.getMessage());
+            aMedAbnormalInfoFacade.saveAbnormalInfo("获取病人住院登记历史数据", startDate+"--"+stopDate, JSON.toJSONString(behospitalInfos), "", e.getMessage());
         }
         return behospitalInfos;
     }
@@ -76,7 +77,7 @@ public class SendDataDealFacade {
      */
     public void sendDataDealADoctorAdvice(String behospitalCode) {
         try {
-            String sql = "select * from   医嘱视图  where BEHOSPITALCODE= '"+behospitalCode+" '";
+            String sql = "select * from   v_jkcdss_yz_order  where behospitalCode= '"+behospitalCode+" '";
             List<DoctorAdvice> doctorAdviceList = tzDBConn.getDoctorAdvice(sql);
             aDoctorAdviceFacade.execute(doctorAdviceList);
         } catch (Exception e) {
@@ -90,11 +91,13 @@ public class SendDataDealFacade {
      */
     public void sendDataDealAMedicalRecord(String behospitalCode) {
         try {
-            String sql = "select * from  文书信息视图   where BEHOSPITALCODE= '"+behospitalCode+" '";
+            String sql = "select * from  v_jkcdss_bl_bingli   where behospitalCode= '"+behospitalCode+" '";
             List<MedicalRecord> medicalRecords = tzDBConn.getMedicalRecord(sql);
             aMedicalRecordFacade.execute(medicalRecords);
             medicalRecords.forEach(medicalRecord -> {
-                sendDataDealAMedicalRecordContent(medicalRecord.getRecId());
+                String tableName =medicalRecord.getRecId().substring(0,2);
+                String recId=medicalRecord.getRecId().substring(3);
+                sendDataDealAMedicalRecordContent(recId,tableName);
             });
         } catch (Exception e) {
             aMedAbnormalInfoFacade.saveAbnormalInfo("获取文书历史数据", behospitalCode, "", "", e.getMessage());
@@ -104,9 +107,9 @@ public class SendDataDealFacade {
     /**
      * 获取文书详情历史数据
      */
-    public void sendDataDealAMedicalRecordContent(String recId) {
+    public void sendDataDealAMedicalRecordContent(String recId,String tableName) {
         try {
-            String sql = "select RECID,XMLTEXT from v_jkcdss_bl_bingli where RECID= '"+recId+" '";
+            String sql = "select * from v_jkcdss_bl_binglijlnr where RECID= '"+recId+" ' and tableName = '"+tableName+"'";
             List<MedicalRecordContent> medicalRecordContents = tzDBConn.getMedicalRecordContent(sql);
             aMedicalRecordContentFacade.execute(medicalRecordContents);
         } catch (Exception e) {

+ 56 - 53
src/main/java/com/diagbot/util/TZDBConn.java

@@ -389,27 +389,31 @@ public class TZDBConn {
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
 				BehospitalInfo behospitalInfo=new BehospitalInfo();
-				behospitalInfo.setBehospitalCode(rs.getString("BRZYID"));//病人住院ID
+				behospitalInfo.setBehospitalCode(rs.getString("behospitalCode"));//病人住院ID
 				behospitalInfo.setHospitalId(HOSPITAL_ID);//医院ID
-				behospitalInfo.setName(rs.getString("BRDAXM"));//姓名
-				behospitalInfo.setSex(rs.getString("BRDAXB").equals("M")?"男":"女");//性别
-				behospitalInfo.setBirthday(rs.getDate("BRCSRQ"));//出生日期
-				behospitalInfo.setFileCode(rs.getString("BRDABH"));//档案号
-				behospitalInfo.setWardCode(rs.getString("ZYBQID"));//病区编码
-				behospitalInfo.setWardName(rs.getString("ZYBQMC"));//病区名称
-				behospitalInfo.setBehDeptId(rs.getString("ZYKSID"));//住院科室ID
-				behospitalInfo.setBehDeptName(rs.getString("ZYKSMC"));//住院科室名称
-				behospitalInfo.setBedCode(rs.getString("ZYCWID"));//床位号
-				behospitalInfo.setBedName(rs.getString("ZYCWHM"));//床位名称
-				behospitalInfo.setInsuranceName(rs.getString("BRLBID"));//医保类别
-				behospitalInfo.setJobType(rs.getString("BRXZID"));//职业
-				behospitalInfo.setBehospitalDate(rs.getDate("BRRYRQ"));//入院时间
-				behospitalInfo.setLeaveHospitalDate(rs.getDate("BRCYRQ"));//出院时间
-				behospitalInfo.setDiagnoseIcd(rs.getString("JBDMID"));//疾病ICD编码
-				behospitalInfo.setDiagnose(rs.getString("JBMSXX"));//疾病名称
-				behospitalInfo.setDoctorId(rs.getString("ZZYSID"));//医生ID
-				behospitalInfo.setDoctorName(rs.getString("ZZYSXM"));//医生姓名
-				
+				behospitalInfo.setName(rs.getString("name"));//姓名
+				behospitalInfo.setSex(rs.getString("sex"));//性别
+				behospitalInfo.setBirthday(rs.getDate("birthday"));//出生日期
+				behospitalInfo.setFileCode(rs.getString("fileCode"));//档案号
+				behospitalInfo.setWardCode(rs.getString("wardCode"));//病区编码
+				behospitalInfo.setWardName(rs.getString("wardName"));//病区名称
+				behospitalInfo.setBehDeptId(rs.getString("behDeptId"));//住院科室ID
+				behospitalInfo.setBehDeptName(rs.getString("behDeptName"));//住院科室名称
+				behospitalInfo.setBedCode(rs.getString("bedCode"));//床位号
+				behospitalInfo.setBedName(rs.getString("bedName"));//床位名称
+				behospitalInfo.setInsuranceName(rs.getString("insuranceName"));//医保类别
+				behospitalInfo.setJobType(rs.getString("jobType"));//职业
+				behospitalInfo.setBehospitalDate(rs.getDate("behospitalDate"));//入院时间
+				behospitalInfo.setLeaveHospitalDate(rs.getDate("leaveHospitalDate"));//出院时间
+				behospitalInfo.setDiagnoseIcd(rs.getString("diagnoseIcd"));//疾病ICD编码
+				behospitalInfo.setDiagnose(rs.getString("diagnose"));//疾病名称
+				behospitalInfo.setBehDoctorId(rs.getString("behDoctorId"));//住院医生ID
+				behospitalInfo.setBehDoctorName(rs.getString("behDoctorName"));//住院医生姓名
+				behospitalInfo.setDirectorDoctorId(rs.getString("directorDoctorId"));//主任医师ID
+				behospitalInfo.setDirectorDoctorName(rs.getString("directorDoctorName"));//主任医师姓名
+				behospitalInfo.setDoctorId(rs.getString("doctorId"));//主治医生ID
+				behospitalInfo.setDoctorName(rs.getString("doctorName"));//主治医生姓名
+
 				behospitalInfoList.add(behospitalInfo);
 			}
 		} catch (Exception e) {
@@ -432,30 +436,31 @@ public class TZDBConn {
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
 				DoctorAdvice doctorAdviceVO=new DoctorAdvice();
-				doctorAdviceVO.setDoctorAdviceId(rs.getString("BRYZID"));//病人医嘱ID
+				doctorAdviceVO.setDoctorAdviceId(rs.getString("doctorAdviceId"));//病人医嘱ID
 				doctorAdviceVO.setHospitalId(HOSPITAL_ID);//医院ID
-				doctorAdviceVO.setBehospitalCode(rs.getString("BRZYID"));//病人ID
-				doctorAdviceVO.setOrderDoctorName(rs.getString("YSKDPB"));//医生开单判别
-				doctorAdviceVO.setFrequency(rs.getString("YZPLPB"));//医嘱频率判别
-				doctorAdviceVO.setParentTypeId(rs.getString("FLYZID"));//父类医嘱ID
-				doctorAdviceVO.setDoctorAdviceType(rs.getString("YZLXPB"));//医嘱类型判别
-				doctorAdviceVO.setUsageNum(rs.getString("YCSYSL"));//一次使用数量
-				doctorAdviceVO.setUsageUnit(rs.getString("YCYLDW"));//一次用量单位
-				doctorAdviceVO.setDose(rs.getString("YZDCJL"));//医嘱单次剂量
-				doctorAdviceVO.setDoseUnit(rs.getString("DCJLDW"));//单次剂量单位
-				doctorAdviceVO.setMedModeType(rs.getString("GYFSID"));//给药方式
-				doctorAdviceVO.setDaFrequency(rs.getString("YZPLID"));//医嘱频率
-				doctorAdviceVO.setDaDealType(rs.getString("YZCLLX"));//医嘱处理类型
-				doctorAdviceVO.setDaStartDate(rs.getDate("YZKSSJ"));//医嘱开始时间
-				doctorAdviceVO.setDaItemName(rs.getString("YZXMMC"));//医嘱项目名称
-				doctorAdviceVO.setDaStatus(rs.getString("YZZTPB"));//医嘱状态判别
-				doctorAdviceVO.setDaStopDate(rs.getDate("YZJSSJ"));//医嘱结束时间
-				doctorAdviceVO.setDaGroupNo(rs.getString("YZTZXH"));//医嘱同组序号
-				doctorAdviceVO.setDaPrescriptionType(rs.getString("YZCFLX"));//医嘱处方类型
-				doctorAdviceVO.setDaMedType(rs.getString("YZLYLX"));//医嘱领药类型
-				doctorAdviceVO.setDoctorNotice(rs.getString("YSZTSM"));//医生嘱托
-				doctorAdviceVO.setDoctorId(rs.getString("KDYSID"));//开单医生ID
-				doctorAdviceVO.setDoctorName(rs.getString("KDYSMC"));//开单医生姓名
+				doctorAdviceVO.setBehospitalCode(rs.getString("behospitalCode"));//病人ID
+				doctorAdviceVO.setOrderDoctorName(rs.getString("orderDoctorName"));//医生开单判别
+				doctorAdviceVO.setFrequency(rs.getString("frequency"));//医嘱频率判别
+				doctorAdviceVO.setParentTypeId(rs.getString("parentTypeId"));//父类医嘱ID
+				doctorAdviceVO.setDoctorAdviceType(rs.getString("doctorAdviceType"));//医嘱类型判别
+				doctorAdviceVO.setUsageNum(rs.getString("usageNum"));//一次使用数量
+				doctorAdviceVO.setUsageUnit(rs.getString("usageUnit"));//一次用量单位
+				doctorAdviceVO.setDose(rs.getString("dose"));//医嘱单次剂量
+				doctorAdviceVO.setDoseUnit(rs.getString("doseUnit"));//单次剂量单位
+				doctorAdviceVO.setMedModeType(rs.getString("medModeType"));//给药方式
+				doctorAdviceVO.setMedicineType(rs.getString("medicineType"));//药品类别
+				doctorAdviceVO.setDaFrequency(rs.getString("daFrequency"));//医嘱频率
+				doctorAdviceVO.setDaDealType(rs.getString("daDealType"));//医嘱处理类型
+				doctorAdviceVO.setDaStartDate(rs.getDate("daStartDate"));//医嘱开始时间
+				doctorAdviceVO.setDaItemName(rs.getString("daItemName"));//医嘱项目名称
+				doctorAdviceVO.setDaStatus(rs.getString("daStatus"));//医嘱状态判别
+				doctorAdviceVO.setDaStopDate(rs.getDate("daStopDate"));//医嘱结束时间
+				doctorAdviceVO.setDaGroupNo(rs.getString("daGroupNo"));//医嘱同组序号
+				doctorAdviceVO.setDaPrescriptionType(rs.getString("daPrescriptionType"));//医嘱处方类型
+				doctorAdviceVO.setDaMedType(rs.getString("daMedType"));//医嘱领药类型
+				doctorAdviceVO.setDoctorNotice(rs.getString("doctorNotice"));//医生嘱托
+				doctorAdviceVO.setDoctorId(rs.getString("doctorId"));//开单医生ID
+				doctorAdviceVO.setDoctorName(rs.getString("doctorName"));//开单医生姓名
 
 				doctorAdviceList.add(doctorAdviceVO);
 			}
@@ -478,15 +483,13 @@ public class TZDBConn {
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
 				MedicalRecord medicalRecord=new MedicalRecord();
-				medicalRecord.setRecId(rs.getString("BLJLID"));
+				medicalRecord.setRecId(rs.getString("recId"));
 				medicalRecord.setHospitalId(HOSPITAL_ID);//医院ID
-				medicalRecord.setBehospitalCode(rs.getString("BRZYID"));//病人住院ID
-				medicalRecord.setOrgCode(rs.getString("ZZJGDM"));//组织机构代码
-				medicalRecord.setRecTypeId(rs.getString("BLMBID"));//对应his模板ID
-
-				medicalRecord.setRecDate(rs.getString("BCJLSJ")!=null?DateUtil.parseDateTime(rs.getString("BCJLSJ")):null);//病历日期
-				medicalRecord.setRecTitle(rs.getString("BLJLMC"));//病历标题
-				medicalRecord.setModeId(Long.valueOf(rs.getString("BLLBID")));//对应his类别ID
+				medicalRecord.setBehospitalCode(rs.getString("behospitalCode"));//病人住院ID
+				medicalRecord.setOrgCode(rs.getString("orgCode"));//组织机构代码
+				medicalRecord.setRecTypeId(rs.getString("recTypeId"));//对应his模板ID
+				medicalRecord.setRecDate(rs.getString("recDate")!=null?DateUtil.parseDateTime(rs.getString("recDate")):null);//病历日期
+				medicalRecord.setRecTitle(rs.getString("recTitle"));//病历标题
 				
 				medicalRecordList.add(medicalRecord);
 			}
@@ -510,8 +513,8 @@ public class TZDBConn {
 			ResultSet rs =dbconn.Query(sql, null);
 			while(rs.next()){
 				MedicalRecordContent mrContent=new MedicalRecordContent();
-				mrContent.setRecId(rs.getString("RECID"));
-				mrContent.setHospitalId(rs.getLong(14));
+				mrContent.setRecId(rs.getString("tableName")+"_"+rs.getString("RECID"));
+				mrContent.setHospitalId(HOSPITAL_ID);//医院ID
 				mrContent.setXmlText(rs.getString("XMLTEXT"));
 
 				mrContentList.add(mrContent);

+ 2 - 2
src/main/resources/application-dev.yml

@@ -59,7 +59,7 @@ spring:
     druid:
       driver-class-name: com.mysql.cj.jdbc.Driver
       platform: mysql
-      url: jdbc:mysql://192.168.2.236:3306/qc?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
+      url: jdbc:mysql://192.168.2.236:3306/qc_qy?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
       username: root
       password: lantone
       # 连接池的配置信息
@@ -164,7 +164,7 @@ oath.self.address: http://${myhost}:${server.port}
 
 # 加解密开关
 encrypt:
-  enable: true
+  enable: false
 
 swagger:
   enable: true

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -2,7 +2,7 @@ spring:
   application:
     name: mrqc-sys
   profiles:
-    active: local
+    active: dev
   main:
     allow-bean-definition-overriding: true