提交 5b871dc8 authored 作者: luzhangjian's avatar luzhangjian

feat:对接云his+1

上级 6733af3d
...@@ -79,4 +79,9 @@ public class PatientSignInfo { ...@@ -79,4 +79,9 @@ public class PatientSignInfo {
* 签约id * 签约id
*/ */
private Long signedId; private Long signedId;
/**
* 云his挂号编号
*/
private String clinicCode;
} }
...@@ -82,4 +82,18 @@ public class BaseInfoByAdmIdVO { ...@@ -82,4 +82,18 @@ public class BaseInfoByAdmIdVO {
* 主诉 * 主诉
*/ */
private String mainSuit; private String mainSuit;
/**
* 主诉
*/
private String clinicCode;
/**
* his相关
*/
private String hisDeptCode;
private String hisDoctorCode;
private String hisDeptName;
private String hisDoctorName;
} }
package com.ebaiyihui.family.doctor.common.vo.cloudHis;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @Author: shenshanshan
* @Date: 16:09 2020-02-21
*/
@Data
public class ICDSearchNameReqVO {
@ApiModelProperty(value = "诊断名称【必填】")
@NotBlank(message = "关键字不能为空")
private String keyword;
@ApiModelProperty(value = "页数【必填】")
@NotNull(message = "页数不能为空")
private Integer pageNum;
@ApiModelProperty(value = "记录数【必填】")
@NotNull(message = "记录数不能为空")
private Integer pageSize;
}
package com.ebaiyihui.family.doctor.common.vo.cloudHis;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Author: shenshanshan
* @Date: 16:09 2020-02-21
*/
@Data
public class ICDSearchNameResVO {
@ApiModelProperty(value = "ID")
private String id;
@ApiModelProperty(value = "ICD诊断编码")
private String code;
@ApiModelProperty(value = "ICD诊断副编码")
private String encode;
@ApiModelProperty(value = "ICD诊断名称")
private String name;
@ApiModelProperty(value = "ICD助记码")
private String mnemonic;
}
...@@ -40,5 +40,6 @@ public class ProjProperties { ...@@ -40,5 +40,6 @@ public class ProjProperties {
private String archiving; private String archiving;
private String refund; private String refund;
private String checkDocAndDeptAndRegFeeInfo; private String checkDocAndDeptAndRegFeeInfo;
private String icdSearchName;
} }
package com.ebaiyihui.family.doctor.server.common.enums;
/**
* @Author:yanliang
* @Date:2019/6/12 16:00
* @Description 在线咨询订单状态枚举
*
*/
public enum AdmissionStatusEnum {
/**
* 已取消:用户未支付
*/
CANCEL("已取消", 0,"患者未支付订单"),
/**
* 待接待:请尽快与处理咨询
*/
TO_BE_RECEIVED("待接诊", 1,"医生未接诊"),
/**
* 咨询中:距离咨询结束还有[25:00]小时
*/
IN_CONSULTATION("进行中", 2,"就诊正在进行中"),
/**
* 已退款(拒绝):您已拒绝申请
*/
REFUNDED_REFUSE("已退款", 4,"已退款,医生拒绝接诊"),
/**
* 已退款(超时):有效期内未处理咨询已退款`
*/
NOT_RECEIVED_TIME_OUT("已退款", 5,"已退款,医生超时未接诊"),
/**
* 已退款(申请):您申请的退款已处理成功
*/
REFUNDED_APPLY("已退款", 6,"已退款,医生主动取消"),
/**
* 已结束(主动):您主动结束了咨询
*/
FINISH_APPLY("已完成", 7,"已结束就诊,患者未评价"),
/**
* 已结束(超时):咨询超时结束
*/
FINISH_TIME_OUT("已完成", 8,"已结束就诊,患者未评价"),
/**
* 已结束(已评价)
*/
FINISH_APPLY_REVIEWED("已完成", 9,"已结束就诊,患者已评价"),
/**
* 已退号(已退款)
*/
RETIRED("已退款", 111,"已退款,等待问诊患者主动取消"),
/**
* 待接诊医生停诊
*/
DOCTOR_CLOSED_SCHEDULE("已退款", 112,"已退款,医生停诊"),
/**
* 待候诊医生停诊
*/
DOCTOR_CLOSED_WATING_SCHEDULE("已退款", 113,"已退款,医生停诊"),
/**
* 状态 : 0 元已拒绝
* 订单已完成
* 就诊 咨询超时/主动结束
*/
REFUNDED_REFUSE_ZERO("已拒绝", 30,"医生超时未接诊"),
WAIT_ADMISSION("待问诊",20,"等待到达预约问诊时间"),
EXPIRED("已过期",10,"已退款,患者超时未进入问诊"),
TO_BE_RECEIVED_REFUND("已退款",15,"已退款,等待接诊患者主动取消"),
REFERRAL("已完成",40,"已转诊,医生已转诊"),
REFERRAL_MANAGER("已完成",41,"已转诊,管理员转诊"),
PASSNUMBER("已过号",50,"患者已过号"),
PASSNUMBER_REFUND_ZERO("已退款",114,"患者过号"),
PASSNUMBER_REFUND("已退款",115,"已退款,患者过号"),
/**
* 已退款,管理员取消
*/
ADMIN_REFUNDED("已失效", 45, "已退款,管理员取消"),
/**
* 已退款,管理员取消(待候诊)
*/
ADMIN_REFUNDED_ADMISSION("已失效", 46, "已退款,管理员取消"),
/**
* 旧转诊单状态
*/
REFERRAL_MANAGER_FINISH("已完成",42,"医生已转诊"),
/**
* 管理端审核
*/
OFFICE_REVIEW("退款审核中", 98, "退款审核中"),
/**
*互联网办公室审核通过
*/
INTERNET_OFFICE_REVIEW("退款审核中",99,"退款审核中");
private String desc;
private Integer value;
private String display;
/**
* @param desc
*/
private AdmissionStatusEnum(String desc, Integer value, String display) {
this.desc = desc;
this.value = value;
this.display = display;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getDisplay(){
return display;
}
public void setDisplay(String display){
this.display=display;
}
public static String getDesc(Integer value) {
if (value == null || value < 0) {
return null;
}
for (AdmissionStatusEnum admissionStatusEnum : AdmissionStatusEnum.values()) {
if (value.equals(admissionStatusEnum.getValue())) {
return admissionStatusEnum.getDesc();
}
}
return null;
}
public static String getDisplay(Integer value) {
if (value == null || value < 0) {
return null;
}
for (AdmissionStatusEnum admissionStatusEnum : AdmissionStatusEnum.values()) {
if (value.equals(admissionStatusEnum.getValue())) {
return admissionStatusEnum.getDisplay();
}
}
return null;
}
public static AdmissionStatusEnum getEnum(Integer value) {
if (value == null || value < 0) {
return null;
}
for (AdmissionStatusEnum admissionStatusEnum : AdmissionStatusEnum.values()) {
if (value.equals(admissionStatusEnum.getValue())) {
return admissionStatusEnum;
}
}
return null;
}
}
package com.ebaiyihui.family.doctor.server.common.enums;
public enum CloudHisAdmissionStatusEnum {
/**
* 待接待:请尽快与处理咨询
*/
TO_BE_RECEIVED("待接诊", 1,"医生待接诊"),
TREATNENTED("就诊中",20,"医生已接诊"),
FINISH("已完成",30,"医生已完成问诊"),
DOCTOR_CANCEL("已取消",40,"医生已取消问诊"),
PATIENT_CANCEL("已取消",45,"患者已取消问诊"),
OTHER_CANCEL("已取消",46,"其他操作已取消问诊"),
RETIRMENT("就诊中",50,"退诊"),
ARCHIVED("已归档",99,"归档");
private String desc;
private Integer value;
private String display;
/**
* @param desc
*/
private CloudHisAdmissionStatusEnum(String desc, Integer value, String display) {
this.desc = desc;
this.value = value;
this.display = display;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getDisplay(){
return display;
}
public void setDisplay(String display){
this.display=display;
}
public static String getDesc(Integer value) {
if (value == null || value < 0) {
return null;
}
for (AdmissionStatusEnum admissionStatusEnum : AdmissionStatusEnum.values()) {
if (value.equals(admissionStatusEnum.getValue())) {
return admissionStatusEnum.getDesc();
}
}
return null;
}
public static String getDisplay(Integer value) {
if (value == null || value < 0) {
return null;
}
for (AdmissionStatusEnum admissionStatusEnum : AdmissionStatusEnum.values()) {
if (value.equals(admissionStatusEnum.getValue())) {
return admissionStatusEnum.getDisplay();
}
}
return null;
}
public static AdmissionStatusEnum getEnum(Integer value) {
if (value == null || value < 0) {
return null;
}
for (AdmissionStatusEnum admissionStatusEnum : AdmissionStatusEnum.values()) {
if (value.equals(admissionStatusEnum.getValue())) {
return admissionStatusEnum;
}
}
return null;
}
}
...@@ -83,4 +83,7 @@ public class PatientSignEntity { ...@@ -83,4 +83,7 @@ public class PatientSignEntity {
@ApiModelProperty("签约关联id") @ApiModelProperty("签约关联id")
private Long signId; private Long signId;
@ApiModelProperty("云his挂号编号")
private String clinicCode;
} }
...@@ -2,17 +2,19 @@ package com.ebaiyihui.family.doctor.server.service; ...@@ -2,17 +2,19 @@ package com.ebaiyihui.family.doctor.server.service;
import com.ebaiyihui.family.doctor.common.vo.cloudHis.*; import com.ebaiyihui.family.doctor.common.vo.cloudHis.*;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.framework.response.BaseResponse;
import com.ebaiyihui.his.pojo.vo.base.FrontResponse; import com.ebaiyihui.his.pojo.vo.base.FrontResponse;
public interface HisTemplateService { public interface HisTemplateService {
// /** /**
// * 手动在h云his挂个号 * 手动在云his挂个号
// * @param appPointRequestDTO *
// * @return * @return
// */ */
// void registrationAndTreatment(); BaseResponse<Object> registrationAndTreatment(PatientSignEntity patientEntity);
/** /**
...@@ -34,6 +36,14 @@ public interface HisTemplateService { ...@@ -34,6 +36,14 @@ public interface HisTemplateService {
*/ */
FrontResponse<String> saveDiagnostic(DiagnosticReqDTO diagnosticReqDTO); FrontResponse<String> saveDiagnostic(DiagnosticReqDTO diagnosticReqDTO);
/**
* 查询his医生科室信息
* @param deptId
* @param doctorId
* @return
*/
HisDeptAndDocCodeVo getHisDeptAndDocCode(String deptId, String doctorId);
/** /**
* Description: 南昌众康医院 -订单预支付 * Description: 南昌众康医院 -订单预支付
* *
......
...@@ -2,16 +2,29 @@ package com.ebaiyihui.family.doctor.server.service.impl; ...@@ -2,16 +2,29 @@ package com.ebaiyihui.family.doctor.server.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.doctor.basedata.api.vo.DepartmentDetailVo;
import com.doctoruser.api.pojo.base.dto.doctor.QueryPersonnelInfoReq;
import com.doctoruser.api.pojo.base.vo.doctor.PersonnelInfo;
import com.ebaiyihui.family.doctor.common.vo.cloudHis.*; import com.ebaiyihui.family.doctor.common.vo.cloudHis.*;
import com.ebaiyihui.family.doctor.server.common.constants.ProjProperties; import com.ebaiyihui.family.doctor.server.common.constants.ProjProperties;
import com.ebaiyihui.family.doctor.server.common.enums.CloudHisAdmissionStatusEnum;
import com.ebaiyihui.family.doctor.server.entity.PatientEntity;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.family.doctor.server.feign.DepartmentFeignClient;
import com.ebaiyihui.family.doctor.server.feign.DoctorInfofeignClient;
import com.ebaiyihui.family.doctor.server.mapper.PatientMapper;
import com.ebaiyihui.family.doctor.server.service.HisTemplateService; import com.ebaiyihui.family.doctor.server.service.HisTemplateService;
import com.ebaiyihui.family.doctor.server.util.HttpKit; import com.ebaiyihui.family.doctor.server.util.HttpKit;
import com.ebaiyihui.framework.response.BaseResponse;
import com.ebaiyihui.his.pojo.vo.base.FrontRequest; import com.ebaiyihui.his.pojo.vo.base.FrontRequest;
import com.ebaiyihui.his.pojo.vo.base.FrontResponse; import com.ebaiyihui.his.pojo.vo.base.FrontResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Objects;
@Service @Service
@Slf4j @Slf4j
...@@ -20,14 +33,44 @@ public class HisTemplateServiceImpl implements HisTemplateService { ...@@ -20,14 +33,44 @@ public class HisTemplateServiceImpl implements HisTemplateService {
@Autowired @Autowired
private ProjProperties projProperties; private ProjProperties projProperties;
@Autowired
private DepartmentFeignClient departmentInfoApi;
@Autowired
private DoctorInfofeignClient doctorClient;
/** @Autowired
* 手动在云his挂号并接诊 private PatientMapper patientMapper;
* @param appPointRequestDTO
* @return
*/
@Override
public BaseResponse<Object> registrationAndTreatment(PatientSignEntity patientSign) {
HisDeptAndDocCodeVo hisDeptAndDocCode = getHisDeptAndDocCode(patientSign.getDeptId().toString(), String.valueOf(patientSign.getDoctorId()));
//挂号
AppPointRequestDTO appPointRequestDTO = this.buildAppointmentParam(patientSign, hisDeptAndDocCode);
log.info("0元复诊挂号入参:{}", JSON.toJSONString(appPointRequestDTO));
MakeAnAppointmentRequestVO makeAnAppointmentRequestVO = admissionRegistration(appPointRequestDTO);
if (Objects.isNull(makeAnAppointmentRequestVO) || StringUtils.isEmpty(makeAnAppointmentRequestVO.getOutpatientNo())) {
return BaseResponse.error("云his挂号失败");
}
// 接诊
log.info("南昌众康医生接诊======");
if (StringUtils.isEmpty(makeAnAppointmentRequestVO.getOutpatientNo())) {
return BaseResponse.error("挂号失败,不能接诊");
}
AppPointRequestDTO receive = new AppPointRequestDTO();
receive.setOutpatientNo(makeAnAppointmentRequestVO.getOutpatientNo());
receive.setStatus(CloudHisAdmissionStatusEnum.TREATNENTED.getValue());
log.info("复诊接诊入参:{}", JSON.toJSONString(appPointRequestDTO));
FrontResponse<String> hisResponse = updateAppointment(appPointRequestDTO);
if (FrontResponse.FAILED_CODE.equals(hisResponse.getCode())) {
return BaseResponse.error("挂号失败,无法接诊");
}
return BaseResponse.success(makeAnAppointmentRequestVO.getOutpatientNo());
}
@Override @Override
public MakeAnAppointmentRequestVO admissionRegistration(AppPointRequestDTO appPointRequestDTO) { public MakeAnAppointmentRequestVO admissionRegistration(AppPointRequestDTO appPointRequestDTO) {
String url = projProperties.getAdmissionRegistration(); String url = projProperties.getAdmissionRegistration();
...@@ -37,10 +80,10 @@ public class HisTemplateServiceImpl implements HisTemplateService { ...@@ -37,10 +80,10 @@ public class HisTemplateServiceImpl implements HisTemplateService {
log.info("云his=>>新增就诊信息请求url:{},param:{}", url, JSON.toJSONString(request)); log.info("云his=>>新增就诊信息请求url:{},param:{}", url, JSON.toJSONString(request));
String result = HttpKit.jsonPost(url, JSON.toJSONString(request)); String result = HttpKit.jsonPost(url, JSON.toJSONString(request));
FrontResponse<MakeAnAppointmentRequestVO> frontResponse = JSONObject.toJavaObject(JSONObject.parseObject(result), FrontResponse.class); FrontResponse<MakeAnAppointmentRequestVO> frontResponse = JSONObject.toJavaObject(JSONObject.parseObject(result), FrontResponse.class);
log.info("云his=>新增就诊信息返回值:{}" , JSONObject.toJSONString(frontResponse)); log.info("云his=>新增就诊信息返回值:{}", JSONObject.toJSONString(frontResponse));
MakeAnAppointmentRequestVO makeAnAppointmentRequestVO = JSON.parseObject(JSON.toJSONString(frontResponse.getBody()), MakeAnAppointmentRequestVO makeAnAppointmentRequestVO = JSON.parseObject(JSON.toJSONString(frontResponse.getBody()),
MakeAnAppointmentRequestVO.class); MakeAnAppointmentRequestVO.class);
log.info("云his=>新增就诊记录返回值:{}" , JSONObject.toJSONString(makeAnAppointmentRequestVO)); log.info("云his=>新增就诊记录返回值:{}", JSONObject.toJSONString(makeAnAppointmentRequestVO));
return makeAnAppointmentRequestVO; return makeAnAppointmentRequestVO;
} catch (Exception e) { } catch (Exception e) {
log.error("新增预约信息异常:{}", e.getMessage()); log.error("新增预约信息异常:{}", e.getMessage());
...@@ -188,7 +231,7 @@ public class HisTemplateServiceImpl implements HisTemplateService { ...@@ -188,7 +231,7 @@ public class HisTemplateServiceImpl implements HisTemplateService {
log.info("云his=>复诊挂号类型医生部门校验请求url:{},param:{}", url, JSON.toJSONString(request)); log.info("云his=>复诊挂号类型医生部门校验请求url:{},param:{}", url, JSON.toJSONString(request));
String result = HttpKit.jsonPost(url, JSON.toJSONString(request)); String result = HttpKit.jsonPost(url, JSON.toJSONString(request));
FrontResponse frontResponse = JSONObject.toJavaObject(JSONObject.parseObject(result), FrontResponse.class); FrontResponse frontResponse = JSONObject.toJavaObject(JSONObject.parseObject(result), FrontResponse.class);
log.info("云his=>复诊挂号类型医生部门校验返回值:{}" , JSONObject.toJSONString(frontResponse)); log.info("云his=>复诊挂号类型医生部门校验返回值:{}", JSONObject.toJSONString(frontResponse));
if (!FrontResponse.SUCCESS_CODE.equals(frontResponse.getCode())) { if (!FrontResponse.SUCCESS_CODE.equals(frontResponse.getCode())) {
return FrontResponse.error(null, FrontResponse.FAILED_CODE, frontResponse.getMessage()); return FrontResponse.error(null, FrontResponse.FAILED_CODE, frontResponse.getMessage());
} }
...@@ -200,4 +243,50 @@ public class HisTemplateServiceImpl implements HisTemplateService { ...@@ -200,4 +243,50 @@ public class HisTemplateServiceImpl implements HisTemplateService {
return FrontResponse.error(null, FrontResponse.FAILED_CODE, "复诊挂号类型医生部门校验异常"); return FrontResponse.error(null, FrontResponse.FAILED_CODE, "复诊挂号类型医生部门校验异常");
} }
} }
@Override
public HisDeptAndDocCodeVo getHisDeptAndDocCode(String deptId, String doctorId) {
HisDeptAndDocCodeVo hisDeptAndDocCodeVo = new HisDeptAndDocCodeVo();
QueryPersonnelInfoReq queryPersonnelInfoReq = new QueryPersonnelInfoReq();
queryPersonnelInfoReq.setDoctorId(doctorId);
BaseResponse<PersonnelInfo> personnelInfoBaseResponse = doctorClient.queryPersonnelInfo(queryPersonnelInfoReq);
if (personnelInfoBaseResponse.isSuccess() && null != personnelInfoBaseResponse.getData()) {
log.info("his医生code:" + JSON.toJSONString(personnelInfoBaseResponse));
String emplCode = personnelInfoBaseResponse.getData().getEmplCode();
hisDeptAndDocCodeVo.setDoctorCode(emplCode);
hisDeptAndDocCodeVo.setDoctorName(personnelInfoBaseResponse.getData().getDoctorName());
}
Long deptIdL = Long.valueOf(deptId);
BaseResponse<DepartmentDetailVo> departmentDetail = departmentInfoApi.getDepartmentDetail(deptIdL);
if (departmentDetail.isSuccess() && null != departmentDetail.getData()) {
log.info("his科室code:" + JSON.toJSONString(departmentDetail));
String deptCode = departmentDetail.getData().getDeptCode();
hisDeptAndDocCodeVo.setDeptCode(deptCode);
hisDeptAndDocCodeVo.setDeptName(departmentDetail.getData().getDeptName());
}
return hisDeptAndDocCodeVo;
}
private AppPointRequestDTO buildAppointmentParam(PatientSignEntity patientEntity, HisDeptAndDocCodeVo hisDeptAndDocCode) {
// 查询患者信息
String patientId = patientEntity.getPatientId();
PatientEntity patientInfo = patientMapper.selectById(patientId);
AppPointRequestDTO appPointRequestDTO = new AppPointRequestDTO();
appPointRequestDTO.setCardType("01");
appPointRequestDTO.setName(patientEntity.getPatientName());
appPointRequestDTO.setOutpatientType("1");
appPointRequestDTO.setDeptId(Integer.valueOf(hisDeptAndDocCode.getDeptCode()));
appPointRequestDTO.setSex(patientInfo.getGender() + "");
appPointRequestDTO.setCardNo(patientInfo.getCredNo());
appPointRequestDTO.setPhone(patientInfo.getPhone());
appPointRequestDTO.setDoctorName(hisDeptAndDocCode.getDoctorName());
appPointRequestDTO.setMedicalType("1");
appPointRequestDTO.setDoctorId(Integer.valueOf(hisDeptAndDocCode.getDoctorCode()));
appPointRequestDTO.setDeptName(hisDeptAndDocCode.getDeptName());
appPointRequestDTO.setHospitalName("众康家庭医生");
return appPointRequestDTO;
}
} }
...@@ -2,6 +2,7 @@ package com.ebaiyihui.family.doctor.server.service.impl; ...@@ -2,6 +2,7 @@ package com.ebaiyihui.family.doctor.server.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.doctoruser.api.pojo.base.dto.doctor.QueryPersonnelInfoReq; import com.doctoruser.api.pojo.base.dto.doctor.QueryPersonnelInfoReq;
import com.doctoruser.api.pojo.base.vo.doctor.PersonnelInfo; import com.doctoruser.api.pojo.base.vo.doctor.PersonnelInfo;
...@@ -12,6 +13,7 @@ import com.ebaiyihui.family.doctor.common.bo.MessageInfo; ...@@ -12,6 +13,7 @@ import com.ebaiyihui.family.doctor.common.bo.MessageInfo;
import com.ebaiyihui.family.doctor.common.bo.PatientSignInfo; import com.ebaiyihui.family.doctor.common.bo.PatientSignInfo;
import com.ebaiyihui.family.doctor.common.bo.PersonImInformReq; import com.ebaiyihui.family.doctor.common.bo.PersonImInformReq;
import com.ebaiyihui.family.doctor.common.vo.*; import com.ebaiyihui.family.doctor.common.vo.*;
import com.ebaiyihui.family.doctor.common.vo.cloudHis.*;
import com.ebaiyihui.family.doctor.server.common.constants.IMInformConstants; import com.ebaiyihui.family.doctor.server.common.constants.IMInformConstants;
import com.ebaiyihui.family.doctor.server.common.constants.ProjProperties; import com.ebaiyihui.family.doctor.server.common.constants.ProjProperties;
import com.ebaiyihui.family.doctor.server.entity.PatientEntity; import com.ebaiyihui.family.doctor.server.entity.PatientEntity;
...@@ -22,10 +24,12 @@ import com.ebaiyihui.family.doctor.server.feign.IMPushMsgFeignClient; ...@@ -22,10 +24,12 @@ import com.ebaiyihui.family.doctor.server.feign.IMPushMsgFeignClient;
import com.ebaiyihui.family.doctor.server.feign.UserApiFeignClient; import com.ebaiyihui.family.doctor.server.feign.UserApiFeignClient;
import com.ebaiyihui.family.doctor.server.mapper.PatientMapper; import com.ebaiyihui.family.doctor.server.mapper.PatientMapper;
import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper; import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper;
import com.ebaiyihui.family.doctor.server.service.HisTemplateService;
import com.ebaiyihui.family.doctor.server.service.PatientMedicalRecordService; import com.ebaiyihui.family.doctor.server.service.PatientMedicalRecordService;
import com.ebaiyihui.family.doctor.server.util.JsonUtil; import com.ebaiyihui.family.doctor.server.util.JsonUtil;
import com.ebaiyihui.framework.response.BaseResponse; import com.ebaiyihui.framework.response.BaseResponse;
import com.ebaiyihui.framework.utils.HttpKit; import com.ebaiyihui.framework.utils.HttpKit;
import com.ebaiyihui.his.pojo.vo.base.FrontResponse;
import com.ebaiyihui.imforward.client.vo.AccountVO; import com.ebaiyihui.imforward.client.vo.AccountVO;
import com.ebaiyihui.imforward.client.vo.PushSingleMsgDataVO; import com.ebaiyihui.imforward.client.vo.PushSingleMsgDataVO;
import com.ebaiyihui.imforward.client.vo.PushSingleMsgReqVO; import com.ebaiyihui.imforward.client.vo.PushSingleMsgReqVO;
...@@ -42,6 +46,7 @@ import org.springframework.util.CollectionUtils; ...@@ -42,6 +46,7 @@ import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
@Service @Service
...@@ -66,6 +71,9 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ ...@@ -66,6 +71,9 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
@Autowired @Autowired
private ProjProperties projProperties; private ProjProperties projProperties;
@Autowired
private HisTemplateService hisTemplateService;
@Override @Override
public PatientCaseDetail getMedicalInfoByAdmId(String admId) { public PatientCaseDetail getMedicalInfoByAdmId(String admId) {
log.info("根据就诊id查病例详情入参:{} ", admId); log.info("根据就诊id查病例详情入参:{} ", admId);
...@@ -98,22 +106,100 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ ...@@ -98,22 +106,100 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
List<MessageInfo> messageInfos = new ArrayList<>(); List<MessageInfo> messageInfos = new ArrayList<>();
//自定义-病历 //自定义-病历
messageInfos.add(getInformCustomPersonDocParam(patientSignInfo, messageInfos.add(getInformCustomPersonDocParam(patientSignInfo, getTreatmentCard(admissionId), IMInformConstants.CASE_DOCTOR_TYPE));
getTreatmentCard(admissionId), IMInformConstants.CASE_DOCTOR_TYPE));
//患者 //患者
//自定义-病历 //自定义-病历
messageInfos.add(getInformCustomPerPatientParam(patientSignInfo, messageInfos.add(getInformCustomPerPatientParam(patientSignInfo, getTreatmentCard(admissionId), IMInformConstants.CASE_DOCTOR_TYPE));
getTreatmentCard(admissionId), IMInformConstants.CASE_DOCTOR_TYPE));
// PersonImInformReq parameter = new PersonImInformReq();
// parameter.setMessageInfos(messageInfos);
// parameter.setAdmissionId(admissionId);
// parameter.setBusiCode(IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
if (pushImInform(messageInfos, admissionId)) { if (pushImInform(messageInfos, admissionId)) {
log.info("IM INFORM COMPLETE 医生开具复诊病例推送卡片,admissionId:{}", admissionId); log.info("IM INFORM COMPLETE 医生开具复诊病例推送卡片,admissionId:{}", admissionId);
} }
nczkSaveDiagnosToHis(patientSignInfo, admissionId);
return BaseResponse.success(); return BaseResponse.success();
} }
private String[] primaryDiagnoToArray(String primaryDiagno) {
if (StringUtils.isEmpty(primaryDiagno)) {
return null;
}
primaryDiagno = primaryDiagno.replaceAll("\\\\", "");
return primaryDiagno.split(";");
}
private List<ICDSearchNameResVO> icdSearchName(ICDSearchNameReqVO reqVo) {
List<ICDSearchNameResVO> icdNames = new ArrayList<>();
try {
log.info("查询诊断名称URL:{},入参{}, ", projProperties.getIcdSearchName(), JSON.toJSONString(reqVo));
String body = HttpKit.jsonPost(projProperties.getIcdSearchName(), JSON.toJSONString(reqVo));
BaseResponse<ICDSearchNameResVO> baseResponse = JSON.parseObject(body, BaseResponse.class);
if (baseResponse.getData() == null) {
return null;
}
icdNames = JSON.parseObject(JSONObject.toJSONString(baseResponse.getData()), new TypeReference<List<ICDSearchNameResVO>>(){});
log.info("查询诊断名称返回值:{} ",icdNames);
return icdNames;
} catch (Exception e) {
log.error("查询诊断名称返调用失败{}", e.getMessage());
}
return null;
}
private void nczkSaveDiagnosToHis(PatientSignInfo orderEntity, String admissionId) {
log.info("南昌众康诊断信息入参数:orderEntity:{},admissionInfo:{}", orderEntity, admissionId);
DiagnosticReqDTO diagnosticReqDTO = new DiagnosticReqDTO();
PatientDynamicMedicalEntityVo entityVo = getMedicalInfoByAdmId(admissionId);
if (Objects.isNull(entityVo)) {
log.error("未查询到病历信息");
return;
}
PatientDynamicMedicalVo medicalDetailVo = new PatientDynamicMedicalVo();
if (StringUtils.isNotEmpty(entityVo.getMedicalDetail())) {
medicalDetailVo = JSON.parseObject(entityVo.getMedicalDetail(), PatientDynamicMedicalVo.class);
}
diagnosticReqDTO.setChiefComplaint(entityVo.getMainSuit());
diagnosticReqDTO.setPresentMedicalHistory(medicalDetailVo.getPresentHistory());
diagnosticReqDTO.setHandleOpinion(medicalDetailVo.getHandle());
diagnosticReqDTO.setOutpatientNo(orderEntity.getClinicCode());
diagnosticReqDTO.setPhysicalExam(medicalDetailVo.getPhysicalExamination());
diagnosticReqDTO.setAuxiliaryInspection(medicalDetailVo.getAuxiliaryExamination());
log.info("entityVo.getPrimaryDiagno:{}", entityVo.getPrimaryDiagno());
String primaryDiagno = entityVo.getPrimaryDiagno();
String[] primaryDiagnoArray = primaryDiagnoToArray(primaryDiagno);
log.info("primaryDiagno:{},primaryDiagnoArray:{}", primaryDiagno, primaryDiagnoArray);
if (Objects.isNull(primaryDiagnoArray)) {
log.error("未查询到诊断信息");
return;
}
List<DiagnosticDetailReqDTO> detailReqDTOList = new ArrayList<DiagnosticDetailReqDTO>(primaryDiagno.length());
for (String diagno : primaryDiagnoArray) {
ICDSearchNameReqVO reVo = new ICDSearchNameReqVO();
reVo.setKeyword(diagno);
List<ICDSearchNameResVO> icdNames = icdSearchName(reVo);
if (CollectionUtils.isEmpty(icdNames)) {
continue;
}
DiagnosticDetailReqDTO detailReqDTO = new DiagnosticDetailReqDTO();
detailReqDTO.setDiagnosis(diagno);
detailReqDTO.setIcdCode(icdNames.get(0).getCode());
log.info("icd信息:param:{},result:{}", diagno, JSON.toJSONString(icdNames));
detailReqDTOList.add(detailReqDTO);
}
diagnosticReqDTO.setDiagnosis(detailReqDTOList);
try {
log.info("南昌众康诊断保存入参:{}", JSON.toJSONString(diagnosticReqDTO));
FrontResponse<String> response = hisTemplateService.saveDiagnostic(diagnosticReqDTO);
log.info("南昌众断保存返回值:{}", JSONObject.toJSONString(response));
} catch (Exception e) {
log.error("南昌众康诊断保存返回值:{}", e.getMessage());
}
}
@Override @Override
public BaseResponse<Object> getBaseInfoByAdmId(String admId) { public BaseResponse<Object> getBaseInfoByAdmId(String admId) {
log.info("根据就诊id查询患者医生基础信息入参admId:{}", admId); log.info("根据就诊id查询患者医生基础信息入参admId:{}", admId);
...@@ -126,20 +212,31 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ ...@@ -126,20 +212,31 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
log.info("patientSignMapper.queryByAdmId返回值:{} ", JSON.toJSONString(patientSignEntity)); log.info("patientSignMapper.queryByAdmId返回值:{} ", JSON.toJSONString(patientSignEntity));
PatientSignInfo patientSignInfo = getPatientSignInfo(admId); PatientSignInfo patientSignInfo = getPatientSignInfo(admId);
log.info("getPatientSignInfo返回值:{} ", JSON.toJSONString(patientSignInfo)); log.info("getPatientSignInfo返回值:{} ", JSON.toJSONString(patientSignInfo));
BeanUtils.copyProperties(patientSignInfo, baseInfoByAdmIdVO); BeanUtils.copyProperties(patientSignInfo, baseInfoByAdmIdVO);
if (patientSignEntity != null) { if (patientSignEntity != null) {
BeanUtils.copyProperties(patientSignEntity, baseInfoByAdmIdVO); BeanUtils.copyProperties(patientSignEntity, baseInfoByAdmIdVO);
baseInfoByAdmIdVO.setDoctorId(String.valueOf(patientSignEntity.getDoctorId())); baseInfoByAdmIdVO.setDoctorId(String.valueOf(patientSignEntity.getDoctorId()));
baseInfoByAdmIdVO.setDeptId(String.valueOf(patientSignEntity.getDeptId())); baseInfoByAdmIdVO.setDeptId(String.valueOf(patientSignEntity.getDeptId()));
baseInfoByAdmIdVO.setOrderId(String.valueOf(patientSignEntity.getId())); baseInfoByAdmIdVO.setOrderId(String.valueOf(patientSignEntity.getId()));
baseInfoByAdmIdVO.setClinicCode(patientSignEntity.getClinicCode());
HisDeptAndDocCodeVo hisDeptAndDocCode = hisTemplateService.getHisDeptAndDocCode(
String.valueOf(patientSignEntity.getDoctorId()), String.valueOf(patientSignEntity.getDeptId()));
if (hisDeptAndDocCode != null){
baseInfoByAdmIdVO.setHisDeptCode(hisDeptAndDocCode.getDeptCode());
baseInfoByAdmIdVO.setHisDeptName(hisDeptAndDocCode.getDeptName());
baseInfoByAdmIdVO.setHisDoctorCode(hisDeptAndDocCode.getDoctorCode());
baseInfoByAdmIdVO.setHisDoctorName(hisDeptAndDocCode.getDoctorName());
}
PatientEntity patientEntity = patientMapper.selectById(patientSignEntity.getPatientId()); PatientEntity patientEntity = patientMapper.selectById(patientSignEntity.getPatientId());
if(patientEntity != null){ if (patientEntity != null) {
BeanUtils.copyProperties(patientEntity, baseInfoByAdmIdVO); BeanUtils.copyProperties(patientEntity, baseInfoByAdmIdVO);
baseInfoByAdmIdVO.setPatientGender(String.valueOf(patientEntity.getGender())); baseInfoByAdmIdVO.setPatientGender(String.valueOf(patientEntity.getGender()));
} }
} }
PatientCaseDetail medicalInfoByAdmId = getMedicalInfoByAdmId(admId); PatientCaseDetail medicalInfoByAdmId = getMedicalInfoByAdmId(admId);
if (medicalInfoByAdmId != null && medicalInfoByAdmId.getPrimaryDiagno()!= null) { if (medicalInfoByAdmId != null && medicalInfoByAdmId.getPrimaryDiagno() != null) {
baseInfoByAdmIdVO.setIcdNames(medicalInfoByAdmId.getPrimaryDiagno()); baseInfoByAdmIdVO.setIcdNames(medicalInfoByAdmId.getPrimaryDiagno());
baseInfoByAdmIdVO.setMainSuit(medicalInfoByAdmId.getMainSuit()); baseInfoByAdmIdVO.setMainSuit(medicalInfoByAdmId.getMainSuit());
} }
...@@ -155,8 +252,7 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ ...@@ -155,8 +252,7 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
* @param <T> * @param <T>
* @return 不会返回空 * @return 不会返回空
*/ */
private <T> MessageInfo getInformCustomPersonDocParam(PatientSignInfo admissionInfo, T content, private <T> MessageInfo getInformCustomPersonDocParam(PatientSignInfo admissionInfo, T content, String businessCode) {
String businessCode) {
String doctorUserId = admissionInfo.getDoctorUserId(); String doctorUserId = admissionInfo.getDoctorUserId();
if (StringUtils.isEmpty(doctorUserId)) { if (StringUtils.isEmpty(doctorUserId)) {
log.error("IM INFORM ERROR : 无法查询到接收人信息"); log.error("IM INFORM ERROR : 无法查询到接收人信息");
...@@ -174,8 +270,7 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ ...@@ -174,8 +270,7 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
// 医生账号 // 医生账号
messageInfo.setSingleAccount(newAccount(IMInformConstants.DOCTOR_APPLICATION_CODE, doctorUserId)); messageInfo.setSingleAccount(newAccount(IMInformConstants.DOCTOR_APPLICATION_CODE, doctorUserId));
// 患者账号 // 患者账号
messageInfo.setSelfAccount(newAccount(IMInformConstants.PATIENT_APPLICATION_CODE, messageInfo.setSelfAccount(newAccount(IMInformConstants.PATIENT_APPLICATION_CODE, admissionInfo.getPatientUserId()));
admissionInfo.getPatientUserId()));
messageInfo.setMessage(message); messageInfo.setMessage(message);
return messageInfo; return messageInfo;
} }
...@@ -195,8 +290,7 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ ...@@ -195,8 +290,7 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
* @param <T> * @param <T>
* @return 不会返回空 * @return 不会返回空
*/ */
private <T> MessageInfo getInformCustomPerPatientParam(PatientSignInfo admissionInfo, T content, private <T> MessageInfo getInformCustomPerPatientParam(PatientSignInfo admissionInfo, T content, String businessCode) {
String businessCode) {
String patientUserId = admissionInfo.getPatientUserId(); String patientUserId = admissionInfo.getPatientUserId();
if (StringUtils.isEmpty(patientUserId)) { if (StringUtils.isEmpty(patientUserId)) {
log.error("IM INFORM ERROR : 无法查询到接收人信息"); log.error("IM INFORM ERROR : 无法查询到接收人信息");
...@@ -211,8 +305,7 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ ...@@ -211,8 +305,7 @@ public class PatientMedicalRecordServiceImpl implements PatientMedicalRecordServ
message.setData(content); message.setData(content);
message.setApplicationCode(IMInformConstants.IM_SYSTEM_BUSINESS_CODE); message.setApplicationCode(IMInformConstants.IM_SYSTEM_BUSINESS_CODE);
messageInfo.setSingleAccount(newAccount(IMInformConstants.PATIENT_APPLICATION_CODE, patientUserId)); messageInfo.setSingleAccount(newAccount(IMInformConstants.PATIENT_APPLICATION_CODE, patientUserId));
messageInfo.setSelfAccount(newAccount(IMInformConstants.DOCTOR_APPLICATION_CODE, messageInfo.setSelfAccount(newAccount(IMInformConstants.DOCTOR_APPLICATION_CODE, admissionInfo.getDoctorUserId()));
admissionInfo.getDoctorUserId()));
messageInfo.setMessage(message); messageInfo.setMessage(message);
return messageInfo; return messageInfo;
} }
......
...@@ -20,10 +20,7 @@ import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper; ...@@ -20,10 +20,7 @@ import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper;
import com.ebaiyihui.family.doctor.server.mapper.ScheduleRecordMapper; import com.ebaiyihui.family.doctor.server.mapper.ScheduleRecordMapper;
import com.ebaiyihui.family.doctor.server.mapper.ServiceConfigMapper; import com.ebaiyihui.family.doctor.server.mapper.ServiceConfigMapper;
import com.ebaiyihui.family.doctor.server.rabbitmq.RabbitProduct; import com.ebaiyihui.family.doctor.server.rabbitmq.RabbitProduct;
import com.ebaiyihui.family.doctor.server.service.GoEasyPushService; import com.ebaiyihui.family.doctor.server.service.*;
import com.ebaiyihui.family.doctor.server.service.ImChatTemplate;
import com.ebaiyihui.family.doctor.server.service.ImMsgTemplateService;
import com.ebaiyihui.family.doctor.server.service.PatientService;
import com.ebaiyihui.family.doctor.server.util.DateUtils; import com.ebaiyihui.family.doctor.server.util.DateUtils;
import com.ebaiyihui.family.doctor.server.util.ThirdOrderPushUtil; import com.ebaiyihui.family.doctor.server.util.ThirdOrderPushUtil;
import com.ebaiyihui.family.doctor.server.util.UUIDUtil; import com.ebaiyihui.family.doctor.server.util.UUIDUtil;
...@@ -77,6 +74,9 @@ public class PatientServiceImpl implements PatientService { ...@@ -77,6 +74,9 @@ public class PatientServiceImpl implements PatientService {
@Autowired @Autowired
private RabbitProduct rabbitProduct; private RabbitProduct rabbitProduct;
@Autowired
private HisTemplateService hisTemplateService;
@Override @Override
public BaseResponse<String> signedDoctor(SignedDoctorDTO reqVo) { public BaseResponse<String> signedDoctor(SignedDoctorDTO reqVo) {
...@@ -202,9 +202,14 @@ public class PatientServiceImpl implements PatientService { ...@@ -202,9 +202,14 @@ public class PatientServiceImpl implements PatientService {
if (Objects.nonNull(oldPatientSignEntity)) { if (Objects.nonNull(oldPatientSignEntity)) {
patientSignEntity.setSignId(oldPatientSignEntity.getId()); patientSignEntity.setSignId(oldPatientSignEntity.getId());
} }
// 云his挂号
BaseResponse<Object> response = hisTemplateService.registrationAndTreatment(patientSignEntity);
if (response.isSuccess()){
patientSignEntity.setClinicCode(response.getData().toString());
}else {
throw new BusinessException("his挂号失败");
}
patientSignMapper.insert(patientSignEntity); patientSignMapper.insert(patientSignEntity);
//创建IM //创建IM
BaseResponse createImResponse = imChatTemplate.createImSession(patientSignEntity); BaseResponse createImResponse = imChatTemplate.createImSession(patientSignEntity);
if (!createImResponse.isSuccess()) { if (!createImResponse.isSuccess()) {
......
...@@ -83,3 +83,4 @@ projprops: ...@@ -83,3 +83,4 @@ projprops:
archiving: https://his-dev.chinachdu.com/basic-api/sdk-service/appoint/register/archiving archiving: https://his-dev.chinachdu.com/basic-api/sdk-service/appoint/register/archiving
refund: https://his-dev.chinachdu.com/basic-api/sdk-service/order/refund refund: https://his-dev.chinachdu.com/basic-api/sdk-service/order/refund
checkDocAndDeptAndRegFeeInfo: https://his-dev.chinachdu.com/basic-api/sdk-service/appoint/checkDocAndDeptAndRegFeeInfo checkDocAndDeptAndRegFeeInfo: https://his-dev.chinachdu.com/basic-api/sdk-service/appoint/checkDocAndDeptAndRegFeeInfo
icdSearchName: https://testapi.chinachdu.com/NCZK/medicalcloud//api/icd/v1/search/name
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论