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

feat:家庭医生初始化

上级 32be867f
......@@ -214,7 +214,7 @@
<dependency>
<groupId>com.ihospital</groupId>
<artifactId>doctor-basedata-api</artifactId>
<version>2.0.0</version>
<version>${doctoruser-api.version}</version>
</dependency>
<dependency>
......
......@@ -154,88 +154,188 @@ public class ImChatTemplateImpl implements ImChatTemplate {
if (!componentsList.isEmpty()) {
log.info("componentsList={}", componentsList);
String reportResult = "";
PatientSignInfo patientSignInfo = getPatientSignInfo(sendImMsgDTO.getAdmId());
// 报告推送
if (MsgTempTypeEnum.REP_INTER.getValue().equals(sendImMsgDTO.getType())) {
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}],\"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();
String msgType = null;
List<MessageInfo> messageInfos = new ArrayList<>();
PatientSignInfo patientSignInfo = getPatientSignInfo(sendImMsgDTO.getAdmId());
MessageInfo messageInfo = new MessageInfo();
// 报告解读
String msgType = null;
if (MsgTempTypeEnum.REP_INTER.getValue().equals(sendImMsgDTO.getType())) {
for (int i = 0; i < componentsList.size(); i++) {
List<String> contentStr = new ArrayList<>();
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)) {
Result rrResult = JSON.parseObject(reportResult, Result.class);
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)) {
if (Objects.nonNull(reportDetailVo)) {
if (i == 0) {
content = MessageFormat.format(content, patientSignInfo.getDoctorName(), ReportTypeEnum.getDesc(reportDetailVo.getReportType()));
}
} else if (i == 1) {
Map<String, Object> imageMap = new HashMap<>();
// if (reportDetailVo.getReportType().equals(1)) {
imageMap.put("UserAction", CommonConstants.USER_ACTION);
imageMap.put("applicationCode", IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
imageMap.put("appointmentId", sendImMsgDTO.getAdmId());
imageMap.put("attacheUrl", reportDetailItemVos.get(0).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);
} else if (i == 1) {
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";
// }
content = JSONObject.toJSONString(imageMap);
} else if (i == 2) {
if (Objects.nonNull(reportDetailVo)) {
content = MessageFormat.format(content, ReportTypeEnum.getDesc(reportDetailVo.getReportType()));
} else if (i == 2) {
if (Objects.nonNull(reportDetailVo)) {
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())) { // 报告异常特殊处理
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 (i == 2) {
syncFlag = contentStr.size() + 1L;
if (personUserImInform(parameter, content, syncFlag, msgType)) {
log.info("推送家庭医生提示语推送成功,admissionId:{}", sendImMsgDTO.getAdmId());
flag = true;
}
}
} 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;
}
} else {
for (int i = 0; i < componentsList.size(); i++) {
String content = componentsList.get(i).getContent();
List<MessageInfo> messageInfos = new ArrayList<>();
MessageInfo messageInfo = new MessageInfo();
// 报告解读
String msgType = null;
if (MsgTempTypeEnum.REP_INTER.getValue().equals(sendImMsgDTO.getType())) {
if (!StringUtils.isEmpty(reportResult)) {
Result rrResult = JSON.parseObject(reportResult, Result.class);
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.setPhone(patientSignInfo.getPatientPhone());
masterUrlDTO.setSignSeqId(String.valueOf(patientSignInfo.getSignedId()));
......@@ -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 {
PatientSignInfo oldPatientSignInfo = getPatientSignInfo(sendImMsgDTO.getOldAdmId());
log.info("之前的doctorName={}", oldPatientSignInfo.getDoctorName());
log.info("来源的doctorName={}", oldPatientSignInfo.getDoctorName());
content = MessageFormat.format(content, oldPatientSignInfo.getDoctorName(), patientSignInfo.getDoctorName());
content = MessageFormat.format(content, patientSignInfo.getDoctorName());
}
} else {
content = MessageFormat.format(content, patientSignInfo.getDoctorName());
}
}
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 (personUserImInform(parameter, content, syncFlag, msgType)) {
log.info("推送家庭医生提示语推送成功,admissionId:{}", sendImMsgDTO.getAdmId());
flag = true;
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 (personUserImInform(parameter, content, syncFlag, msgType)) {
log.info("推送家庭医生提示语推送成功,admissionId:{}", sendImMsgDTO.getAdmId());
flag = true;
}
}
}
}
return flag;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论