提交 4d67f70e authored 作者: 杨凯's avatar 杨凯

feat:家庭医生初始化

上级 32be867f
...@@ -214,7 +214,7 @@ ...@@ -214,7 +214,7 @@
<dependency> <dependency>
<groupId>com.ihospital</groupId> <groupId>com.ihospital</groupId>
<artifactId>doctor-basedata-api</artifactId> <artifactId>doctor-basedata-api</artifactId>
<version>2.0.0</version> <version>${doctoruser-api.version}</version>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -154,88 +154,188 @@ public class ImChatTemplateImpl implements ImChatTemplate { ...@@ -154,88 +154,188 @@ public class ImChatTemplateImpl implements ImChatTemplate {
if (!componentsList.isEmpty()) { if (!componentsList.isEmpty()) {
log.info("componentsList={}", componentsList); log.info("componentsList={}", componentsList);
String reportResult = ""; String reportResult = "";
PatientSignInfo patientSignInfo = getPatientSignInfo(sendImMsgDTO.getAdmId());
// 报告推送 // 报告推送
if (MsgTempTypeEnum.REP_INTER.getValue().equals(sendImMsgDTO.getType())) { if (MsgTempTypeEnum.REP_INTER.getValue().equals(sendImMsgDTO.getType())) {
ReportDetailDTO reportDetailDTO = new ReportDetailDTO(); String msgType = null;
reportDetailDTO.setThirdId(sendImMsgDTO.getThirdId());
reportResult = thirdOrderPushUtil.getReportDetail(reportDetailDTO);
// reportResult = "{\"code\":\"200\",\"message\":\"success\",\"data\":{\"reportType\":1,\"institution\":\"瑞金医院\",\"reportFileList\":[{\"fileUrl\":\"https://pension.home.komect.com/ac-health-oss/health-container/K4aW5uWQToWj0Ty7rCUlqw?AWSAccessKeyId=82A0955SWSXVITYRB1Z4&Expires=4070880000&Signature=Efrj6X4BI%2BtYlcdjoGboaJhedE0%3D\",\"fileType\":1}],\"reportName\":\"验血报告\",\"createTime\":\"2024-03-26 19:29:28\",\"examinationTime\":\"2024-03-26\"},\"time\":1711530711174}";
}
for (int i = 0; i < componentsList.size(); i++) {
String content = componentsList.get(i).getContent();
List<MessageInfo> messageInfos = new ArrayList<>(); List<MessageInfo> messageInfos = new ArrayList<>();
PatientSignInfo patientSignInfo = getPatientSignInfo(sendImMsgDTO.getAdmId());
MessageInfo messageInfo = new MessageInfo(); MessageInfo messageInfo = new MessageInfo();
// 报告解读 for (int i = 0; i < componentsList.size(); i++) {
String msgType = null; List<String> contentStr = new ArrayList<>();
if (MsgTempTypeEnum.REP_INTER.getValue().equals(sendImMsgDTO.getType())) { String content = componentsList.get(i).getContent();
ReportDetailDTO reportDetailDTO = new ReportDetailDTO();
reportDetailDTO.setThirdId(sendImMsgDTO.getThirdId());
reportResult = thirdOrderPushUtil.getReportDetail(reportDetailDTO);
reportResult = "{\"code\":\"200\",\"message\":\"success\",\"data\":{\"reportType\":1,\"institution\":\"瑞金医院\",\"reportFileList\":[{\"fileUrl\":\"https://pension.home.komect.com/ac-health-oss/health-container/K4aW5uWQToWj0Ty7rCUlqw?AWSAccessKeyId=82A0955SWSXVITYRB1Z4&Expires=4070880000&Signature=Efrj6X4BI%2BtYlcdjoGboaJhedE0%3D\",\"fileType\":1},{\"fileUrl\":\"https://pension.home.komect.com/ac-health-oss/health-container/K4aW5uWQToWj0Ty7rCUlqw?AWSAccessKeyId=82A0955SWSXVITYRB1Z4&Expires=4070880000&Signature=Efrj6X4BI%2BtYlcdjoGboaJhedE0%3D\",\"fileType\":1},{\"fileUrl\":\"https://pension.home.komect.com/ac-health-oss/health-container/K4aW5uWQToWj0Ty7rCUlqw?AWSAccessKeyId=82A0955SWSXVITYRB1Z4&Expires=4070880000&Signature=Efrj6X4BI%2BtYlcdjoGboaJhedE0%3D\",\"fileType\":1}],\"reportName\":\"验血报告\",\"createTime\":\"2024-03-26 19:29:28\",\"examinationTime\":\"2024-03-26\"},\"time\":1711530711174}";
if (!StringUtils.isEmpty(reportResult)) { if (!StringUtils.isEmpty(reportResult)) {
Result rrResult = JSON.parseObject(reportResult, Result.class); Result rrResult = JSON.parseObject(reportResult, Result.class);
if (rrResult.isSuccess()) { if (rrResult.isSuccess()) {
ReportDetailVo reportDetailVo = JSON.parseObject(JSONObject.toJSONString(rrResult.getData()), ReportDetailVo.class); ReportDetailVo reportDetailVo = JSON.parseObject(JSONObject.toJSONString(rrResult.getData()), ReportDetailVo.class);
List<ReportDetailItemVo> reportDetailItemVos = reportDetailVo.getReportFileList(); List<ReportDetailItemVo> reportDetailItemVos = reportDetailVo.getReportFileList();
if (i == 0) { if (Objects.nonNull(reportDetailVo)) {
if (Objects.nonNull(reportDetailVo)) { if (i == 0) {
content = MessageFormat.format(content, patientSignInfo.getDoctorName(), ReportTypeEnum.getDesc(reportDetailVo.getReportType())); content = MessageFormat.format(content, patientSignInfo.getDoctorName(), ReportTypeEnum.getDesc(reportDetailVo.getReportType()));
} } else if (i == 1) {
} else if (i == 1) { Map<String, Object> imageMap = new HashMap<>();
Map<String, Object> imageMap = new HashMap<>(); for (ReportDetailItemVo reportDetailItemVo : reportDetailItemVos) {
// if (reportDetailVo.getReportType().equals(1)) { imageMap.put("UserAction", CommonConstants.USER_ACTION);
imageMap.put("UserAction", CommonConstants.USER_ACTION); imageMap.put("applicationCode", IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
imageMap.put("applicationCode", IMInformConstants.IM_SYSTEM_BUSINESS_CODE); imageMap.put("appointmentId", sendImMsgDTO.getAdmId());
imageMap.put("appointmentId", sendImMsgDTO.getAdmId()); imageMap.put("attacheUrl", reportDetailItemVo.getFileUrl());
imageMap.put("attacheUrl", reportDetailItemVos.get(0).getFileUrl()); imageMap.put("businessCode", IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
imageMap.put("businessCode", IMInformConstants.IM_SYSTEM_BUSINESS_CODE); imageMap.put("doctorHeadUrl", patientSignInfo.getDoctorHeadPortrait());
imageMap.put("doctorHeadUrl", patientSignInfo.getDoctorHeadPortrait()); imageMap.put("doctorName", patientSignInfo.getDoctorName());
imageMap.put("doctorName", patientSignInfo.getDoctorName()); imageMap.put("msgId", UUIDUtil.getUUID());
imageMap.put("msgId", UUIDUtil.getUUID()); imageMap.put("msgType", CommonConstants.MSG_TYPE);
imageMap.put("msgType", CommonConstants.MSG_TYPE); imageMap.put("senderName", patientSignInfo.getDoctorName());
imageMap.put("senderName", patientSignInfo.getDoctorName()); imageMap.put("senderProfessional", patientSignInfo.getDoctorProfessional());
imageMap.put("senderProfessional", patientSignInfo.getDoctorProfessional()); imageMap.put("team", false);
imageMap.put("team", false); imageMap.put("teamFlag", 0);
imageMap.put("teamFlag", 0); imageMap.put("toApplicationCode", IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
imageMap.put("toApplicationCode", IMInformConstants.IM_SYSTEM_BUSINESS_CODE); content = JSONObject.toJSONString(imageMap);
contentStr.add(content);
}
msgType = "TIMCustomElem"; msgType = "TIMCustomElem";
// }
content = JSONObject.toJSONString(imageMap); } else if (i == 2) {
} else if (i == 2) { if (Objects.nonNull(reportDetailVo)) {
if (Objects.nonNull(reportDetailVo)) { content = MessageFormat.format(content, ReportTypeEnum.getDesc(reportDetailVo.getReportType()));
content = MessageFormat.format(content, ReportTypeEnum.getDesc(reportDetailVo.getReportType())); }
} }
} }
} }
} }
if (SenderEnum.DOCTOR.getDesc().equals(componentsList.get(i).getSender())) {
messageInfo = getDoctorInformRefreshPatientParam(patientSignInfo, IMInformConstants.REFRESH);
} else {
log.info("msgType={}", msgType);
messageInfo = getInformRefreshPatientParam(patientSignInfo, IMInformConstants.REFRESH, msgType);
}
messageInfos.add(messageInfo);
PersonImInformReq parameter = new PersonImInformReq();
parameter.setMessageInfos(messageInfos);
parameter.setAdmissionId(sendImMsgDTO.getAdmId());
parameter.setBusiCode(IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
log.info("推送家庭医生提示语推送:{}" + JSON.toJSONString(parameter.getMessageInfos()));
Long syncFlag = i * 100L;
if (i == 1) {
if (personUserImInform(parameter, content, syncFlag, msgType)) {
log.info("推送家庭医生提示语推送成功,admissionId:{}", sendImMsgDTO.getAdmId());
flag = true;
}
} else if (i == 1) {
for (int j = 1; j < contentStr.size(); j++) {
syncFlag = j * 100L;
if (personUserImInform(parameter, content, syncFlag, msgType)) {
log.info("推送家庭医生提示语推送成功,admissionId:{}", sendImMsgDTO.getAdmId());
flag = true;
}
}
} else if (MsgTempTypeEnum.REP_ANO.getValue().equals(sendImMsgDTO.getType())) { // 报告异常特殊处理 } else if (i == 2) {
content = MessageFormat.format(content, patientSignInfo.getDoctorName(), sendImMsgDTO.getIntention()); syncFlag = contentStr.size() + 1L;
} else if (MsgTempTypeEnum.AFTER_HEAL_ASSE.getValue().equals(sendImMsgDTO.getType())) { // 健康评估后特殊处理 if (personUserImInform(parameter, content, syncFlag, msgType)) {
MasterUrlDTO masterUrlDTO = new MasterUrlDTO(); log.info("推送家庭医生提示语推送成功,admissionId:{}", sendImMsgDTO.getAdmId());
masterUrlDTO.setPhone(patientSignInfo.getPatientPhone()); flag = true;
masterUrlDTO.setSignSeqId(String.valueOf(patientSignInfo.getSignedId()));
masterUrlDTO.setType("2");
String masterResult = thirdOrderPushUtil.getMasterUrl(masterUrlDTO);
if (!StringUtils.isEmpty(masterResult)) {
Result<String> muResult = JSON.parseObject(masterResult, Result.class);
if (muResult.isSuccess()) {
content = MessageFormat.format(content, muResult.getData());
} }
} }
} else {
if (!StringUtils.isEmpty(sendImMsgDTO.getOldAdmId())) { }
if (MsgTempTypeEnum.UP_SUC.getValue().equals(sendImMsgDTO.getType())) {
content = MessageFormat.format(content, patientSignInfo.getDoctorName()); } else {
if (!Objects.nonNull(componentsList.get(i).getConditionFlag()) for (int i = 0; i < componentsList.size(); i++) {
&& CommonConstants.STATUS_VALID.equals(componentsList.get(i).getConditionFlag())) { String content = componentsList.get(i).getContent();
// 查询用户健康计划是否开启状态 List<MessageInfo> messageInfos = new ArrayList<>();
HealthInfoDTO healthInfoDTO = new HealthInfoDTO(); MessageInfo messageInfo = new MessageInfo();
healthInfoDTO.setPhone(patientSignInfo.getPatientPhone()); // 报告解读
String result = thirdOrderPushUtil.getHealthSchStatus(healthInfoDTO); String msgType = null;
if (!StringUtils.isEmpty(result)) { if (MsgTempTypeEnum.REP_INTER.getValue().equals(sendImMsgDTO.getType())) {
Result<String> hssResult = JSON.parseObject(result, Result.class); if (!StringUtils.isEmpty(reportResult)) {
if (hssResult.isSuccess() && CommonConstants.STATUS_VALID.equals(hssResult.getData())) { Result rrResult = JSON.parseObject(reportResult, Result.class);
continue; if (rrResult.isSuccess()) {
ReportDetailVo reportDetailVo = JSON.parseObject(JSONObject.toJSONString(rrResult.getData()), ReportDetailVo.class);
List<ReportDetailItemVo> reportDetailItemVos = reportDetailVo.getReportFileList();
if (i == 0) {
if (Objects.nonNull(reportDetailVo)) {
content = MessageFormat.format(content, patientSignInfo.getDoctorName(), ReportTypeEnum.getDesc(reportDetailVo.getReportType()));
}
} else if (i == 1) {
List<String> contentStr = new ArrayList<>();
Map<String, Object> imageMap = new HashMap<>();
for (ReportDetailItemVo reportDetailItemVo : reportDetailItemVos) {
imageMap.put("UserAction", CommonConstants.USER_ACTION);
imageMap.put("applicationCode", IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
imageMap.put("appointmentId", sendImMsgDTO.getAdmId());
imageMap.put("attacheUrl", reportDetailItemVo.getFileUrl());
imageMap.put("businessCode", IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
imageMap.put("doctorHeadUrl", patientSignInfo.getDoctorHeadPortrait());
imageMap.put("doctorName", patientSignInfo.getDoctorName());
imageMap.put("msgId", UUIDUtil.getUUID());
imageMap.put("msgType", CommonConstants.MSG_TYPE);
imageMap.put("senderName", patientSignInfo.getDoctorName());
imageMap.put("senderProfessional", patientSignInfo.getDoctorProfessional());
imageMap.put("team", false);
imageMap.put("teamFlag", 0);
imageMap.put("toApplicationCode", IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
content = JSONObject.toJSONString(imageMap);
contentStr.add(content);
}
msgType = "TIMCustomElem";
} else if (i == 2) {
if (Objects.nonNull(reportDetailVo)) {
content = MessageFormat.format(content, ReportTypeEnum.getDesc(reportDetailVo.getReportType()));
}
}
}
}
} else if (MsgTempTypeEnum.REP_ANO.getValue().equals(sendImMsgDTO.getType())) { // 报告异常特殊处理
content = MessageFormat.format(content, patientSignInfo.getDoctorName(), sendImMsgDTO.getIntention());
} else if (MsgTempTypeEnum.AFTER_HEAL_ASSE.getValue().equals(sendImMsgDTO.getType())) { // 健康评估后特殊处理
MasterUrlDTO masterUrlDTO = new MasterUrlDTO();
masterUrlDTO.setPhone(patientSignInfo.getPatientPhone());
masterUrlDTO.setSignSeqId(String.valueOf(patientSignInfo.getSignedId()));
masterUrlDTO.setType("2");
String masterResult = thirdOrderPushUtil.getMasterUrl(masterUrlDTO);
if (!StringUtils.isEmpty(masterResult)) {
Result<String> muResult = JSON.parseObject(masterResult, Result.class);
if (muResult.isSuccess()) {
content = MessageFormat.format(content, muResult.getData());
}
}
} else {
if (!StringUtils.isEmpty(sendImMsgDTO.getOldAdmId())) {
if (MsgTempTypeEnum.UP_SUC.getValue().equals(sendImMsgDTO.getType())) {
content = MessageFormat.format(content, patientSignInfo.getDoctorName());
if (!Objects.nonNull(componentsList.get(i).getConditionFlag())
&& CommonConstants.STATUS_VALID.equals(componentsList.get(i).getConditionFlag())) {
// 查询用户健康计划是否开启状态
HealthInfoDTO healthInfoDTO = new HealthInfoDTO();
healthInfoDTO.setPhone(patientSignInfo.getPatientPhone());
String result = thirdOrderPushUtil.getHealthSchStatus(healthInfoDTO);
if (!StringUtils.isEmpty(result)) {
Result<String> hssResult = JSON.parseObject(result, Result.class);
if (hssResult.isSuccess() && CommonConstants.STATUS_VALID.equals(hssResult.getData())) {
continue;
}
MasterUrlDTO masterUrlDTO = new MasterUrlDTO();
masterUrlDTO.setPhone(patientSignInfo.getPatientPhone());
masterUrlDTO.setSignSeqId(String.valueOf(patientSignInfo.getSignedId()));
masterUrlDTO.setType("3");
String masterResult = thirdOrderPushUtil.getMasterUrl(masterUrlDTO);
if (!StringUtils.isEmpty(masterResult)) {
Result<String> muResult = JSON.parseObject(masterResult, Result.class);
if (muResult.isSuccess()) {
content = MessageFormat.format(content, muResult.getData());
}
}
} }
}
} else if (MsgTempTypeEnum.SIG_SUC.getValue().equals(sendImMsgDTO.getType())) {
content = MessageFormat.format(content, patientSignInfo.getDoctorName());
if (!Objects.nonNull(componentsList.get(i).getConditionFlag())
&& CommonConstants.STATUS_VALID.equals(componentsList.get(i).getConditionFlag())) {
MasterUrlDTO masterUrlDTO = new MasterUrlDTO(); MasterUrlDTO masterUrlDTO = new MasterUrlDTO();
masterUrlDTO.setPhone(patientSignInfo.getPatientPhone()); masterUrlDTO.setPhone(patientSignInfo.getPatientPhone());
masterUrlDTO.setSignSeqId(String.valueOf(patientSignInfo.getSignedId())); masterUrlDTO.setSignSeqId(String.valueOf(patientSignInfo.getSignedId()));
...@@ -248,55 +348,40 @@ public class ImChatTemplateImpl implements ImChatTemplate { ...@@ -248,55 +348,40 @@ public class ImChatTemplateImpl implements ImChatTemplate {
} }
} }
} }
} else {
PatientSignInfo oldPatientSignInfo = getPatientSignInfo(sendImMsgDTO.getOldAdmId());
log.info("之前的doctorName={}", oldPatientSignInfo.getDoctorName());
log.info("来源的doctorName={}", oldPatientSignInfo.getDoctorName());
content = MessageFormat.format(content, oldPatientSignInfo.getDoctorName(), patientSignInfo.getDoctorName());
} }
} else if (MsgTempTypeEnum.SIG_SUC.getValue().equals(sendImMsgDTO.getType())) {
content = MessageFormat.format(content, patientSignInfo.getDoctorName());
if (!Objects.nonNull(componentsList.get(i).getConditionFlag())
&& CommonConstants.STATUS_VALID.equals(componentsList.get(i).getConditionFlag())) {
MasterUrlDTO masterUrlDTO = new MasterUrlDTO();
masterUrlDTO.setPhone(patientSignInfo.getPatientPhone());
masterUrlDTO.setSignSeqId(String.valueOf(patientSignInfo.getSignedId()));
masterUrlDTO.setType("3");
String masterResult = thirdOrderPushUtil.getMasterUrl(masterUrlDTO);
if (!StringUtils.isEmpty(masterResult)) {
Result<String> muResult = JSON.parseObject(masterResult, Result.class);
if (muResult.isSuccess()) {
content = MessageFormat.format(content, muResult.getData());
}
}
}
} else { } else {
PatientSignInfo oldPatientSignInfo = getPatientSignInfo(sendImMsgDTO.getOldAdmId()); content = MessageFormat.format(content, patientSignInfo.getDoctorName());
log.info("之前的doctorName={}", oldPatientSignInfo.getDoctorName());
log.info("来源的doctorName={}", oldPatientSignInfo.getDoctorName());
content = MessageFormat.format(content, oldPatientSignInfo.getDoctorName(), patientSignInfo.getDoctorName());
} }
} else {
content = MessageFormat.format(content, patientSignInfo.getDoctorName());
} }
} if (SenderEnum.DOCTOR.getDesc().equals(componentsList.get(i).getSender())) {
messageInfo = getDoctorInformRefreshPatientParam(patientSignInfo, IMInformConstants.REFRESH);
if (SenderEnum.DOCTOR.getDesc().equals(componentsList.get(i).getSender())) { } else {
messageInfo = getDoctorInformRefreshPatientParam(patientSignInfo, IMInformConstants.REFRESH); log.info("msgType={}", msgType);
} else { messageInfo = getInformRefreshPatientParam(patientSignInfo, IMInformConstants.REFRESH, msgType);
log.info("msgType={}", msgType); }
messageInfo = getInformRefreshPatientParam(patientSignInfo, IMInformConstants.REFRESH, msgType); messageInfos.add(messageInfo);
} PersonImInformReq parameter = new PersonImInformReq();
messageInfos.add(messageInfo); parameter.setMessageInfos(messageInfos);
PersonImInformReq parameter = new PersonImInformReq(); parameter.setAdmissionId(sendImMsgDTO.getAdmId());
parameter.setMessageInfos(messageInfos); parameter.setBusiCode(IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
parameter.setAdmissionId(sendImMsgDTO.getAdmId()); log.info("推送家庭医生提示语推送:{}" + JSON.toJSONString(parameter.getMessageInfos()));
parameter.setBusiCode(IMInformConstants.IM_SYSTEM_BUSINESS_CODE); Long syncFlag = i * 100L;
log.info("推送家庭医生提示语推送:{}" + JSON.toJSONString(parameter.getMessageInfos())); if (personUserImInform(parameter, content, syncFlag, msgType)) {
Long syncFlag = i * 100L; log.info("推送家庭医生提示语推送成功,admissionId:{}", sendImMsgDTO.getAdmId());
if (personUserImInform(parameter, content, syncFlag, msgType)) { flag = true;
log.info("推送家庭医生提示语推送成功,admissionId:{}", sendImMsgDTO.getAdmId()); }
flag = true;
} }
} }
} }
return flag; return flag;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论