|
@@ -68,8 +68,9 @@ public class PatientCriticalValuesService {
|
|
|
}
|
|
|
String touser = codeRsBuilder.substring(1);
|
|
|
String wxMessage = criticalValue.getContent() +
|
|
|
- "<a href=\"https://emr.hnthyy.cn/hospitalAppsApi/criticalValue/updateState?id=" +
|
|
|
- criticalValue.getId() + "\">点击更新危急值状态</a>";
|
|
|
+ "<a href=\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wwf0b23c8b36012b34&redirect_uri=https://emr.hnthyy.cn/handleCriticalValue?id="
|
|
|
+ + criticalValue.getId()
|
|
|
+ + "&response_type=code&scope=snsapi_privateinfo&state=STATE&agentid=1000052#wechat_redirect\">点击更新危急值状态</a>";
|
|
|
int sendWxRes = wxInfoService.sendCriticalValue(touser, wxMessage);
|
|
|
if (sendWxRes == 0) {
|
|
|
dao.updateSentState(criticalValue.getId());
|
|
@@ -150,11 +151,15 @@ public class PatientCriticalValuesService {
|
|
|
return employeeList;
|
|
|
}
|
|
|
|
|
|
- public CodeName getTargetDept(String patNo, int times, PatientType patientType) {
|
|
|
+ public CodeName getTargetDept(String patNo, String sentDept, PatientType patientType) {
|
|
|
+ CodeName targetDept = null;
|
|
|
if (patientType == PatientType.INPATIENT) {
|
|
|
- return dao.selectTargetDept(patNo);
|
|
|
+ targetDept = dao.selectTargetDept(patNo);
|
|
|
}
|
|
|
- return dao.selectTargetDept2(patNo, times);
|
|
|
+ if (null == targetDept) {
|
|
|
+ targetDept = dao.selectTargetDeptByName(sentDept);
|
|
|
+ }
|
|
|
+ return targetDept;
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> checkTheCriticalValue(CriticalValueFromTest value) {
|
|
@@ -163,18 +168,23 @@ public class PatientCriticalValuesService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR,
|
|
|
"flag 门诊住院标志不存在 1=住院 2=门诊");
|
|
|
}
|
|
|
+ if (StringUtil.isBlank(value.getSentByDepartment())) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "送检科室不能为空。");
|
|
|
+ }
|
|
|
PatientType patientType = value.getFlag() == 1 ?
|
|
|
PatientType.INPATIENT : PatientType.OUTPATIENT;
|
|
|
- CodeName targetDept = getTargetDept(value.getPatNo(), value.getTimes(), patientType);
|
|
|
+ CodeName targetDept = getTargetDept(value.getPatNo(), value.getSentByDepartment(), patientType);
|
|
|
if (null == targetDept) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "没有患者的就诊信息");
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, "无法找到患者的送检科室。");
|
|
|
}
|
|
|
|
|
|
String label = patientType == PatientType.INPATIENT ? "住院号" : "门诊号";
|
|
|
if (StringUtil.isBlank(value.getBednum())) {
|
|
|
value.setBednum("无");
|
|
|
}
|
|
|
- String message = StrUtil.format("在【{}】就诊患者 【{}:{},姓名:{},性别:{},年龄:{},床号:{}】的【{}】检查结果出现危急值情况--【{}】。报告者:{},来自:【{}】。",
|
|
|
+ String message = StrUtil.format("在【{}】就诊患者 【{}:{},姓名:{},性别:{}," +
|
|
|
+ "年龄:{},床号:{}】的【{}】检查结果出现危急值情况--【{}】。报告者:{}," +
|
|
|
+ "来自:【{}】。",
|
|
|
targetDept.getName(), label, value.getPatNo(), value.getPatientName(),
|
|
|
value.getPatientSex(), value.getPatientAge(), value.getBednum(),
|
|
|
value.getReqName(), value.getMessage(), value.getCommitman(),
|
|
@@ -185,7 +195,7 @@ public class PatientCriticalValuesService {
|
|
|
CriticalValue criticalValue = new CriticalValue.Builder()
|
|
|
.patNo(value.getPatNo()).msgId(msgId)
|
|
|
.msgType("dept_critical_msg")
|
|
|
- .sourceCode(value.getSentByDepartment())
|
|
|
+ .sourceCode(value.getRoomcood())
|
|
|
.sourceName(value.getRoomcood())
|
|
|
.targetDeptCode(targetDept.getCode())
|
|
|
.targetDeptName(targetDept.getName())
|