|
@@ -22,12 +22,22 @@ import java.util.*;
|
|
|
@Service
|
|
|
public class CriticalWebServiceImpl implements CriticalWebService {
|
|
|
private String token = "oI9#ur02cbBHdop87e6Y728Ax30IIlgd";
|
|
|
- MessageService messageService =(MessageServiceImpl)SpringBeanUtils.getBean(MessageServiceImpl.class);
|
|
|
- EmployeeService employeeService=(EmployeeServiceImpl)SpringBeanUtils.getBean(EmployeeServiceImpl.class);
|
|
|
- ZdUnitCodeService zdUnitCodeService=(ZdUnitCodeServiceImpl)SpringBeanUtils.getBean(ZdUnitCodeServiceImpl.class);
|
|
|
+ MessageService messageService = null;
|
|
|
+ EmployeeService employeeService = null;
|
|
|
+ ZdUnitCodeService zdUnitCodeService = null;
|
|
|
+
|
|
|
@Override
|
|
|
public String criticalAccept(String accessToken, String msg) {
|
|
|
- log.info("收到危急值信息:----->"+msg+"<-------");
|
|
|
+ log.info("收到危急值信息:----->" + msg + "<-------");
|
|
|
+ if(messageService==null){
|
|
|
+ messageService = SpringBeanUtils.getBean(MessageServiceImpl.class);
|
|
|
+ }
|
|
|
+ if(employeeService==null){
|
|
|
+ employeeService= SpringBeanUtils.getBean(EmployeeServiceImpl.class);
|
|
|
+ }
|
|
|
+ if(zdUnitCodeService==null){
|
|
|
+ zdUnitCodeService = SpringBeanUtils.getBean(ZdUnitCodeServiceImpl.class);
|
|
|
+ }
|
|
|
Map<String, String> resultMap = new HashMap<>();
|
|
|
if (StringUtils.isBlank(accessToken)) {
|
|
|
resultMap.put("Code", "false");
|
|
@@ -59,7 +69,7 @@ public class CriticalWebServiceImpl implements CriticalWebService {
|
|
|
return jsonObj.toString();
|
|
|
}
|
|
|
String targetDeptCode = myJsonObject.getString("TargetDeptCode");
|
|
|
- if(StringUtils.isBlank(targetDeptCode)){
|
|
|
+ if (StringUtils.isBlank(targetDeptCode)) {
|
|
|
resultMap.put("Code", "false");
|
|
|
resultMap.put("Message", "目标科室为空");
|
|
|
log.error("目标科室为空");
|
|
@@ -67,7 +77,7 @@ public class CriticalWebServiceImpl implements CriticalWebService {
|
|
|
return jsonObj.toString();
|
|
|
}
|
|
|
String content = myJsonObject.getString("Content");
|
|
|
- if(StringUtils.isBlank(content)){
|
|
|
+ if (StringUtils.isBlank(content)) {
|
|
|
resultMap.put("Code", "false");
|
|
|
resultMap.put("Message", "消息内容为空");
|
|
|
log.error("消息内容为空");
|
|
@@ -75,64 +85,67 @@ public class CriticalWebServiceImpl implements CriticalWebService {
|
|
|
return jsonObj.toString();
|
|
|
}
|
|
|
//住院科室
|
|
|
- String zkWard=null;
|
|
|
+ String zkWard = null;
|
|
|
//管床医生
|
|
|
- String referPhysician=null;
|
|
|
+ String referPhysician = null;
|
|
|
//主治医师
|
|
|
- String consultPhysician=null;
|
|
|
+ String consultPhysician = null;
|
|
|
//主任医师
|
|
|
- String deptDirector=null;
|
|
|
- if(content.indexOf("住院号")>0){
|
|
|
+ String deptDirector = null;
|
|
|
+ if (content.indexOf("住院号") > 0) {
|
|
|
//住院病人
|
|
|
- String inpatientNo=content.substring(content.indexOf("住院号")+4,content.indexOf(",姓名"));
|
|
|
- if(StringUtils.isNotBlank(inpatientNo)){
|
|
|
- Map<String,String> map=zdUnitCodeService.queryZkWardByInpatientNo(inpatientNo);
|
|
|
- if(map!=null && map.size()>0){
|
|
|
- zkWard=map.get("zkWard");
|
|
|
- referPhysician=map.get("refer_physician");
|
|
|
- consultPhysician=map.get("consult_physician");
|
|
|
- deptDirector=map.get("dept_director");
|
|
|
+ String inpatientNo = content.substring(content.indexOf("住院号") + 4, content.indexOf(",姓名"));
|
|
|
+ if (StringUtils.isNotBlank(inpatientNo)) {
|
|
|
+ Map<String, String> map = zdUnitCodeService.queryZkWardByInpatientNo(inpatientNo);
|
|
|
+ if (map != null && map.size() > 0) {
|
|
|
+ zkWard = map.get("zkWard");
|
|
|
+ referPhysician = map.get("refer_physician");
|
|
|
+ consultPhysician = map.get("consult_physician");
|
|
|
+ deptDirector = map.get("dept_director");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- List<Employee> employees=employeeService.queryEmployeeByDept(zkWard!=null?zkWard:targetDeptCode.trim());
|
|
|
- String codes=null;
|
|
|
+ List<Employee> employees = employeeService.queryEmployeeByDept(zkWard != null ? zkWard : targetDeptCode.trim());
|
|
|
+ String codes = null;
|
|
|
Set<String> tempSet = new HashSet<>();
|
|
|
- if(StringUtils.isNotBlank(referPhysician)){
|
|
|
+ if (StringUtils.isNotBlank(referPhysician)) {
|
|
|
tempSet.add(referPhysician);
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(referPhysician)){
|
|
|
+ if (StringUtils.isNotBlank(referPhysician)) {
|
|
|
tempSet.add(consultPhysician);
|
|
|
}
|
|
|
- if(StringUtils.isNotBlank(deptDirector)){
|
|
|
+ if (StringUtils.isNotBlank(deptDirector)) {
|
|
|
tempSet.add(deptDirector);
|
|
|
}
|
|
|
- if(tempSet.size()>0){
|
|
|
- for (String str:tempSet){
|
|
|
- if(codes==null){
|
|
|
- codes= str;
|
|
|
- }else {
|
|
|
- codes+=","+str;
|
|
|
+ if (tempSet.size() > 0) {
|
|
|
+ List<Employee> tempsEmps = employeeService.queryByCodes(new ArrayList<>(tempSet));
|
|
|
+ if (tempsEmps != null && tempsEmps.size() > 0) {
|
|
|
+ for (Employee emp : tempsEmps) {
|
|
|
+ if (codes == null) {
|
|
|
+ codes = emp.getCodeRs();
|
|
|
+ } else {
|
|
|
+ codes += "," + emp.getCodeRs();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(employees!=null){
|
|
|
- for (Employee employee:employees){
|
|
|
- if(codes==null){
|
|
|
- codes= employee.getCodeRs();
|
|
|
- }else {
|
|
|
- codes+=","+employee.getCodeRs();
|
|
|
+ if (employees != null) {
|
|
|
+ for (Employee employee : employees) {
|
|
|
+ if (codes == null) {
|
|
|
+ codes = employee.getCodeRs();
|
|
|
+ } else {
|
|
|
+ codes += "," + employee.getCodeRs();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(codes!=null){
|
|
|
+ if (codes != null) {
|
|
|
+ String MsgID= (String) myJsonObject.get("MsgID");
|
|
|
messageService.sendWxMessage(codes, content.replaceAll("=",":").replaceAll(" ",""));
|
|
|
- //messageService.sendWxMessage("3210", content.replaceAll("=",":").replaceAll(" ",""));
|
|
|
+ log.info("消息id=【"+MsgID+"】的危机值消息发布成功,接收人codes=【"+codes+"】");
|
|
|
+ //messageService.sendWxMessage("01387,3210", content.replaceAll("=", ":").replaceAll(" ", ""));
|
|
|
}
|
|
|
resultMap.put("Code", "true");
|
|
|
resultMap.put("Message", "");
|
|
|
- log.info("危机值消息发布成功");
|
|
|
JSONObject jsonObj = new JSONObject(resultMap);
|
|
|
return jsonObj.toString();
|
|
|
}
|