Преглед изворни кода

湘雅新增人工质控条目查找对应医生姓名(未上线)

shiyue пре 3 година
родитељ
комит
c67b426998

+ 11 - 14
src/main/java/com/diagbot/facade/QcresultInfoFacade.java

@@ -309,29 +309,26 @@ public class QcresultInfoFacade extends QcresultInfoServiceImpl {
                         sentEntryRecordDTO.setModeName(qcMode.getName());
                     }
                 }
-                //获取患者的科室id和病人的主治医师
+                //获取患者的科室id
                 BehospitalInfo behospitalInfo = behospitalInfoFacade.getOne(new QueryWrapper<BehospitalInfo>()
                         .eq("behospital_code", sentEntryRecordDTO.getBehospitalCode())
                         .eq("is_deleted", IsDeleteEnum.N.getKey()));
                 if (null != behospitalInfo) {
                     sentEntryRecordDTO.setDeptId(behospitalInfo.getBehDeptId());
-                    if (StringUtil.isNotEmpty(behospitalInfo.getDoctorName()) && !behospitalInfo.getDoctorName().equals("-")) {
-                        sentEntryRecordDTO.setDoctorName(behospitalInfo.getDoctorName());
-                    } else {
-                        HomePage homePage = aHomePageFacade.getOne(new QueryWrapper<HomePage>()
-                                .eq("behospital_code", sentEntryRecordDTO.getBehospitalCode())
-                                .eq("is_deleted", IsDeleteEnum.N.getKey()));
-                        sentEntryRecordDTO.setDoctorName(homePage.getAttendingDoctor());
-                    }
             }
         //根据his新增相应的数据
         try {
+            //根据behospitalCode截取patientId和visitId
+            String patientId=sentEntryRecordDTO.getBehospitalCode().split("_")[0];
+            String visitId=sentEntryRecordDTO.getBehospitalCode().split("_")[1];
+            //获取on_line表中的医生姓名
+            String sql ="select * from doctor_hos where user_id = (select request_doctor_id from mr_on_line where patient ='" +
+                    patientId+"' and visit_id= '"+visitId+"' and status='0') and dept_code= '"+sentEntryRecordDTO.getDeptId()+"'" ;
+            List<String> doctorNames=tzDBConnForHis.getdoctorName(sql);
+            if (doctorNames!=null && doctorNames.size() > 0){
+                sentEntryRecordDTO.setDoctorName(doctorNames.get(0));
+            }
             Integer i = tzDBConnForHis.setQcMessAge(sentEntryRecordDTO);
-//            if (i == 0) {
-//                aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员新增人工缺陷到his系统失败", "", "", JSON.toJSONString(sentEntryRecordDTO), "");
-//            }
-            //插入方法
-//                    qcClientFacade.sentEntryRecord(sentEntryRecordDTO);
         } catch (Exception e) {
             e.printStackTrace();
             aMedAbnormalInfoFacade.saveAbnormalInfo("发送质控人员新增人工缺陷到his系统失败", "", "", JSON.toJSONString(sentEntryRecordDTO), e.getMessage());

+ 21 - 0
src/main/java/com/diagbot/util/TZDBConnForHis.java

@@ -688,6 +688,27 @@ public class TZDBConnForHis {
 		return medicalRecordList;
 	}
 
+	/**
+	 * 从视图中获取医生姓名
+	 * @return
+	 */
+	public List<String> getdoctorName(String sql){
+		List<String> names=Lists.newLinkedList();
+		try {
+			TZDBConnForHis dbconn=new TZDBConnForHis();
+			ResultSet rs =dbconn.Query(sql, null);
+			while(rs.next()){
+				String doctorName =rs.getString("name");//医生姓名
+				names.add(doctorName);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally {
+			close();
+		}
+		return names;
+	}
+
 	/**
 	 * 关闭数据库
 	 * @param conn