|
@@ -8,6 +8,7 @@ import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.constants.Message;
|
|
|
import thyyxxk.webserver.dao.his.zhuyuanyisheng.PatientCriticalValuesDao;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
+import thyyxxk.webserver.entity.criticalValue.ExamineCriticalValue;
|
|
|
import thyyxxk.webserver.entity.inpatient.patient.Patient;
|
|
|
import thyyxxk.webserver.entity.login.UserInfo;
|
|
|
import thyyxxk.webserver.entity.socketmessage.ApiMessageBody;
|
|
@@ -17,15 +18,31 @@ import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
import thyyxxk.webserver.utils.SocketMsg;
|
|
|
import thyyxxk.webserver.utils.StringUtil;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
public class PatientCriticalValuesService {
|
|
|
-
|
|
|
private final PatientCriticalValuesDao dao;
|
|
|
private final RedisLikeService redisLikeService;
|
|
|
private final WebSocketService socketService;
|
|
|
+ /**
|
|
|
+ * 住院
|
|
|
+ */
|
|
|
+ private final Integer INHOSPITAL = 1;
|
|
|
+ /**
|
|
|
+ * 门诊
|
|
|
+ */
|
|
|
+ private final Integer OUTPATIENT = 2;
|
|
|
+ /**
|
|
|
+ * 检验
|
|
|
+ */
|
|
|
+ private final Integer TEST = 1;
|
|
|
+ /**
|
|
|
+ * 检查
|
|
|
+ */
|
|
|
+ private final Integer EXAMINE = 2;
|
|
|
|
|
|
public PatientCriticalValuesService(PatientCriticalValuesDao dao, RedisLikeService redisLikeService, WebSocketService socketService) {
|
|
|
this.dao = dao;
|
|
@@ -44,7 +61,7 @@ public class PatientCriticalValuesService {
|
|
|
if (p == null) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "未查询到该住院患者信息。");
|
|
|
}
|
|
|
- dao.insertAMessage(patNo, p.getAdmissTimes(), message);
|
|
|
+ dao.insertAMessage(patNo, p.getAdmissTimes(), message, INHOSPITAL, TEST);
|
|
|
List<String> codeList = dao.selectDoctorByDept(p.getDeptCode());
|
|
|
JSONObject js = new JSONObject();
|
|
|
js.put("message", message);
|
|
@@ -54,7 +71,48 @@ public class PatientCriticalValuesService {
|
|
|
messageBody.setUserCode(item);
|
|
|
socketService.sendMessageByUserCode(messageBody);
|
|
|
});
|
|
|
+ return ResultVoUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查危急值推送
|
|
|
+ *
|
|
|
+ * @param param 数据
|
|
|
+ * @return 提示
|
|
|
+ */
|
|
|
+ public ResultVo<String> checkTheCriticalValue(ExamineCriticalValue param) {
|
|
|
+ if (INHOSPITAL.equals(param.getFlag())) {
|
|
|
+ return checkInHospital(param);
|
|
|
+ }
|
|
|
+ if (OUTPATIENT.equals(param.getFlag())) {
|
|
|
+ return checkOutPatient(param);
|
|
|
+ }
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "flag 门诊住院标志不存在 1=住院 2=门诊");
|
|
|
+ }
|
|
|
+
|
|
|
+ ResultVo<String> checkOutPatient(ExamineCriticalValue param) {
|
|
|
+ dao.insertAMessage(param.getPatNo(), param.getTimes(), param.getMessage(), OUTPATIENT, EXAMINE);
|
|
|
+ return ResultVoUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ ResultVo<String> checkInHospital(ExamineCriticalValue param) {
|
|
|
+ Patient p = dao.selectPatientInfoByPatNo(param.getPatNo());
|
|
|
|
|
|
+ if (p == null) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "患者出院或住院号错误。");
|
|
|
+ }
|
|
|
+ dao.insertAMessage(param.getPatNo(), param.getTimes(), param.getMessage(), INHOSPITAL, EXAMINE);
|
|
|
+ List<String> codeList = dao.selectDoctorByDept(p.getDeptCode());
|
|
|
+
|
|
|
+ JSONObject js = new JSONObject();
|
|
|
+ js.put("message", param.getMessage());
|
|
|
+ String msg = SocketMsg.socketVo(Message.critical_value, js);
|
|
|
+ ApiMessageBody messageBody = new ApiMessageBody(msg);
|
|
|
+
|
|
|
+ for (String s : codeList) {
|
|
|
+ messageBody.setUserCode(s);
|
|
|
+ socketService.sendMessageByUserCode(messageBody);
|
|
|
+ }
|
|
|
return ResultVoUtil.success();
|
|
|
}
|
|
|
|