|
|
|
@ -92,6 +92,52 @@ public class MzsyBusinessServiceImpl implements MzsyBusinessService {
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public MessageResponse nurseSubmitHandle(Message message) {
|
|
|
|
|
try {
|
|
|
|
|
CollectTaskConfig.TaskConfig taskConfig = CollectTaskConfig.getTaskConfig("WS_NURS_SUBMIT");
|
|
|
|
|
if (taskConfig == null || Func.isEmpty(taskConfig.getCollectorIds())) {
|
|
|
|
|
throw new RuntimeException("任务配置未配置采集器id,WS_NURS_SUBMIT");
|
|
|
|
|
}
|
|
|
|
|
NkRecordSubmitDTO dto = NkWsRecordSubmitMessageConvert.convert(message.getMessage());
|
|
|
|
|
NkRecordSubmitValidate.verifyRecordSubmitDTO(dto);
|
|
|
|
|
TbasicQrPreciseCondition condition = MzsyWsRecordSubmitMessageConvert.convert(dto);
|
|
|
|
|
List<String> patientIds = tBasicMapper.getMzsyPatientIdByPreciseConditions(condition);
|
|
|
|
|
verifyPatientIds(patientIds);
|
|
|
|
|
|
|
|
|
|
String submitDate = dto.getSubmitDate();
|
|
|
|
|
tBasicMapper.insertOrUpdateNurseSubmitTime(patientIds.get(0), Func.parseDate(submitDate, DateUtil.PATTERN_DATETIME));
|
|
|
|
|
|
|
|
|
|
compensateTask("护理提交",patientIds, taskConfig.getCollectorIds());
|
|
|
|
|
tBasicMapper.updateNursCollectState(patientIds.get(0), 1);
|
|
|
|
|
|
|
|
|
|
String submitName = dto.getSubmitName();
|
|
|
|
|
String submitNo = dto.getSubmitNo();
|
|
|
|
|
// 添加提交记录
|
|
|
|
|
HospitalSubmitNodeLogAddDTO nodeLogAddDTO = new HospitalSubmitNodeLogAddDTO();
|
|
|
|
|
nodeLogAddDTO.setPatientId(patientIds.get(0));
|
|
|
|
|
nodeLogAddDTO.setContent(new String[]{submitDate});
|
|
|
|
|
nodeLogAddDTO.setSubmitNodeEnum(HospitalSubmitNodeEnum.NURSE);
|
|
|
|
|
nodeLogAddDTO.setCreater(submitName+"("+submitNo+")");
|
|
|
|
|
nodeLogAddDTO.setCreaterName(submitName+"("+submitNo+")");
|
|
|
|
|
hospitalSubmitNodeServiceApi.addLog(nodeLogAddDTO);
|
|
|
|
|
return new MessageResponse(ResultCode.SUCCESS.getCode(), success());
|
|
|
|
|
} catch (BaseException baseException) {
|
|
|
|
|
log.error(baseException.getMessage(), baseException);
|
|
|
|
|
// 业务异常,不希望重试,直接消息返回错误
|
|
|
|
|
MessageResponse response = new MessageResponse(ResultCode.FAILED.getCode(), fail(baseException.getMessage()));
|
|
|
|
|
response.setRetry(0);
|
|
|
|
|
return response;
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error(ex.getMessage(), ex);
|
|
|
|
|
// 不可知的错误,希望重试
|
|
|
|
|
MessageResponse response = new MessageResponse(ResultCode.FAILED.getCode(), fail("系统错误"));
|
|
|
|
|
response.setRetry(1);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void verifyPatientIds(List<String> patientIds) {
|
|
|
|
|
if (Func.isEmpty(patientIds)) {
|
|
|
|
|
throw new BaseException("系统无此患者!");
|
|
|
|
|