|
|
|
@ -3,10 +3,9 @@ package com.ynxbd.common.service; |
|
|
|
import com.ynxbd.common.bean.Dept; |
|
|
|
import com.ynxbd.common.bean.Dept; |
|
|
|
import com.ynxbd.common.bean.Doctor; |
|
|
|
import com.ynxbd.common.bean.Doctor; |
|
|
|
import com.ynxbd.common.bean.Patient; |
|
|
|
import com.ynxbd.common.bean.Patient; |
|
|
|
import com.ynxbd.common.bean.ai.AIDept; |
|
|
|
import com.ynxbd.common.bean.ai.*; |
|
|
|
import com.ynxbd.common.bean.ai.AIDoctor; |
|
|
|
import com.ynxbd.common.bean.healthcard.HCHospitalHome; |
|
|
|
import com.ynxbd.common.bean.ai.AIDoctorSchedule; |
|
|
|
import com.ynxbd.common.bean.pay.Register; |
|
|
|
import com.ynxbd.common.bean.ai.AIPatient; |
|
|
|
|
|
|
|
import com.ynxbd.common.config.healthcard.HCAIGuidanceConfig; |
|
|
|
import com.ynxbd.common.config.healthcard.HCAIGuidanceConfig; |
|
|
|
import com.ynxbd.common.dao.RegisterDao; |
|
|
|
import com.ynxbd.common.dao.RegisterDao; |
|
|
|
import com.ynxbd.common.dao.his.HisRegisterDao; |
|
|
|
import com.ynxbd.common.dao.his.HisRegisterDao; |
|
|
|
@ -41,7 +40,7 @@ public class AIGuidanceService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>(); |
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>(); |
|
|
|
if (!hosId.equals(HCAIGuidanceConfig.HOSP_ID)) { |
|
|
|
if (!HCAIGuidanceConfig.HOSP_ID.equals(hosId)) { // 医院id校验
|
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, resultList); |
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, resultList); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
@ -79,7 +78,7 @@ public class AIGuidanceService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<AIDept> dataList = new ArrayList<>(); |
|
|
|
List<AIDept> dataList = new ArrayList<>(); |
|
|
|
if (!hosId.equals(HCAIGuidanceConfig.HOSP_ID)) { // 医院id校验
|
|
|
|
if (!HCAIGuidanceConfig.HOSP_ID.equals(hosId)) { // 医院id校验
|
|
|
|
log.warn("[智能导诊]科室列表查询-hosId不匹配"); |
|
|
|
log.warn("[智能导诊]科室列表查询-hosId不匹配"); |
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, dataList); |
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, dataList); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -169,7 +168,7 @@ public class AIGuidanceService { |
|
|
|
return Result.error(ResultEnum.PARAM_IS_DEFECT); |
|
|
|
return Result.error(ResultEnum.PARAM_IS_DEFECT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!hosId.equals(HCAIGuidanceConfig.HOSP_ID)) { // 医院id校验
|
|
|
|
if (!HCAIGuidanceConfig.HOSP_ID.equals(hosId)) { // 医院id校验
|
|
|
|
log.warn("[智能导诊]医生列表查询-hosId不匹配"); |
|
|
|
log.warn("[智能导诊]医生列表查询-hosId不匹配"); |
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, new ArrayList<>()); |
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, new ArrayList<>()); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -290,7 +289,7 @@ public class AIGuidanceService { |
|
|
|
resp.put("hospitalId", HCAIGuidanceConfig.HOSP_ID); |
|
|
|
resp.put("hospitalId", HCAIGuidanceConfig.HOSP_ID); |
|
|
|
resp.put("cardList", cardList); |
|
|
|
resp.put("cardList", cardList); |
|
|
|
|
|
|
|
|
|
|
|
if (!hosId.equals(HCAIGuidanceConfig.HOSP_ID)) { // 医院id校验
|
|
|
|
if (!HCAIGuidanceConfig.HOSP_ID.equals(hosId)) { // 医院id校验
|
|
|
|
log.warn("[智能导诊]查询就诊人列表-hosId不匹配"); |
|
|
|
log.warn("[智能导诊]查询就诊人列表-hosId不匹配"); |
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, resp); |
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, resp); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -323,27 +322,57 @@ public class AIGuidanceService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 4.1.9 获取医生号源排班信息(必选) |
|
|
|
* 4.1.9 获取医生号源排班信息(必选) |
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public Result getDoctorSchedule(String hosId, String branchId, String doctorsJson) { |
|
|
|
public Result getDoctorSchedule(String hosId, String branchId, String doctorsJson) { |
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
if (!HCAIGuidanceConfig.HOSP_ID.equals(hosId)) { // 医院id校验
|
|
|
|
|
|
|
|
log.warn("[智能导诊]获取医生号源排班信息-hosId不匹配"); |
|
|
|
|
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, map); |
|
|
|
|
|
|
|
} |
|
|
|
List<AIDoctorSchedule> doctors = new ArrayList<>(); |
|
|
|
List<AIDoctorSchedule> doctors = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(doctors)) { |
|
|
|
|
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, doctors); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<AIDoctorSchedule> doctorScheduleList = JsonHelper.parseArray(doctorsJson, AIDoctorSchedule.class); |
|
|
|
List<AIDoctorSchedule> doctorScheduleList = JsonHelper.parseArray(doctorsJson, AIDoctorSchedule.class); |
|
|
|
if (doctorScheduleList.isEmpty()) { |
|
|
|
if (doctorScheduleList.isEmpty()) { |
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, doctors); |
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, doctors); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<AIDoctorSchedule> deptList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (AIDoctorSchedule item : doctorScheduleList) { |
|
|
|
|
|
|
|
String docId = item.getDocId(); |
|
|
|
|
|
|
|
String departmentId = item.getDepartmentId(); |
|
|
|
|
|
|
|
AIDoctorSchedule findDept = deptList.stream().filter(o -> o.getDepartmentId().equals(departmentId)).findFirst().orElse(null); |
|
|
|
|
|
|
|
if (findDept == null) { |
|
|
|
|
|
|
|
AIDoctorSchedule dept = new AIDoctorSchedule(); |
|
|
|
|
|
|
|
dept.setDepartmentId(departmentId); |
|
|
|
|
|
|
|
Map<String, String> doctorIds = new HashMap<>(); |
|
|
|
|
|
|
|
doctorIds.put(docId, docId); |
|
|
|
|
|
|
|
dept.setDoctorIds(doctorIds); |
|
|
|
|
|
|
|
deptList.add(dept); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Map<String, String> doctorIds = findDept.getDoctorIds(); |
|
|
|
|
|
|
|
if (doctorIds == null) { |
|
|
|
|
|
|
|
doctorIds = new HashMap<>(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!doctorIds.containsKey(docId)) { |
|
|
|
|
|
|
|
doctorIds.put(docId, docId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<Doctor> regDoctorList = new ArrayList<>(); |
|
|
|
List<Doctor> regDoctorList = new ArrayList<>(); |
|
|
|
List<Doctor> hisDoctorList; |
|
|
|
List<Doctor> hisDoctorList; |
|
|
|
HisRegisterDao hisRegisterDao = new HisRegisterDao(); |
|
|
|
HisRegisterDao hisRegisterDao = new HisRegisterDao(); |
|
|
|
for (AIDoctorSchedule aiDoctorSchedule : doctorScheduleList) { |
|
|
|
for (AIDoctorSchedule deptItem : deptList) { |
|
|
|
String departmentId = aiDoctorSchedule.getDepartmentId(); |
|
|
|
String departmentId = deptItem.getDepartmentId(); |
|
|
|
if (ObjectUtils.isEmpty(departmentId)) { |
|
|
|
if (ObjectUtils.isEmpty(departmentId)) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Map<String, String> doctorIds = deptItem.getDoctorIds(); |
|
|
|
|
|
|
|
if (doctorIds == null || doctorIds.isEmpty()) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (HCAIGuidanceConfig.IS_SPLIT_TIME_REG) { // 分时段
|
|
|
|
if (HCAIGuidanceConfig.IS_SPLIT_TIME_REG) { // 分时段
|
|
|
|
String curDate = DateHelper.getCurDate(); |
|
|
|
String curDate = DateHelper.getCurDate(); |
|
|
|
@ -358,23 +387,45 @@ public class AIGuidanceService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
regDoctorList.addAll(hisDoctorList); |
|
|
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, String> item : doctorIds.entrySet()) { |
|
|
|
|
|
|
|
String docId = item.getKey(); |
|
|
|
|
|
|
|
Doctor findRegDoctorItem = regDoctorList.stream().filter(o -> o.getDoctCode().equals(docId)).findFirst().orElse(null); |
|
|
|
|
|
|
|
if (findRegDoctorItem != null) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Doctor findHisDoctorItem = hisDoctorList.stream().filter(o -> o.getDoctCode().equals(docId)).findFirst().orElse(null); |
|
|
|
|
|
|
|
if (findHisDoctorItem != null) { |
|
|
|
|
|
|
|
regDoctorList.add(findHisDoctorItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
regDoctorList = new DoctorService().doctorListFilter(regDoctorList); |
|
|
|
regDoctorList = new DoctorService().doctorListFilter(regDoctorList); |
|
|
|
|
|
|
|
|
|
|
|
String domain = WeChatConfig.getDomain(true); |
|
|
|
String domain = WeChatConfig.getDomain(true); |
|
|
|
|
|
|
|
String webReqURL = WeChatConfig.getWebReqURL(true); |
|
|
|
|
|
|
|
String curDate = DateHelper.getCurDate(); |
|
|
|
|
|
|
|
|
|
|
|
AIDoctorSchedule item; |
|
|
|
AIDoctorSchedule item; |
|
|
|
String headImg; |
|
|
|
String headImg; |
|
|
|
for (Doctor doctor : regDoctorList) { |
|
|
|
for (Doctor doctor : regDoctorList) { |
|
|
|
|
|
|
|
String deptCode = doctor.getDeptCode(); |
|
|
|
|
|
|
|
String deptName = doctor.getDeptName(); |
|
|
|
|
|
|
|
String doctCode = doctor.getDoctCode(); |
|
|
|
|
|
|
|
String doctName = doctor.getDoctName(); |
|
|
|
|
|
|
|
|
|
|
|
item = new AIDoctorSchedule(); |
|
|
|
item = new AIDoctorSchedule(); |
|
|
|
item.setDocId(doctor.getDoctCode()); |
|
|
|
|
|
|
|
item.setName(doctor.getDoctName()); |
|
|
|
|
|
|
|
item.setHosId(HCAIGuidanceConfig.HOSP_ID); |
|
|
|
item.setHosId(HCAIGuidanceConfig.HOSP_ID); |
|
|
|
item.setDepartmentId(doctor.getDeptCode()); |
|
|
|
item.setBranchId(branchId); |
|
|
|
item.setDoctorLevel(""); |
|
|
|
//
|
|
|
|
item.setDescription(ObjectUtils.isEmpty(doctor.getDescription()) ? "暂无介绍" : doctor.getDescription()); |
|
|
|
item.setDocId(doctCode); |
|
|
|
|
|
|
|
item.setName(doctName); |
|
|
|
|
|
|
|
item.setDepartmentId(deptCode); |
|
|
|
|
|
|
|
item.setDeptName(deptName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item.setDoctorLevel(doctor.getTitle()); |
|
|
|
|
|
|
|
item.setDescription(ObjectUtils.isEmpty(doctor.getSkill()) ? "暂无内容" : doctor.getSkill()); // 擅长
|
|
|
|
headImg = doctor.getHeadImg(); |
|
|
|
headImg = doctor.getHeadImg(); |
|
|
|
if (headImg != null && !ObjectUtils.isEmpty(headImg.trim())) { |
|
|
|
if (headImg != null && !ObjectUtils.isEmpty(headImg.trim())) { |
|
|
|
if (!headImg.contains("data:image/")) { // 不是base64
|
|
|
|
if (!headImg.contains("data:image/")) { // 不是base64
|
|
|
|
@ -382,11 +433,90 @@ public class AIGuidanceService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
item.setUrl(""); // 挂号链接
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// item.sets
|
|
|
|
map.put("date", curDate); |
|
|
|
|
|
|
|
map.put("deptCode", deptCode); |
|
|
|
|
|
|
|
map.put("deptName", URLHelper.encodeURL(deptName)); |
|
|
|
|
|
|
|
map.put("doctName", URLHelper.encodeURL(doctName)); |
|
|
|
|
|
|
|
map.put("doctCode", doctCode); |
|
|
|
|
|
|
|
map.put("subDeptCode", ""); |
|
|
|
|
|
|
|
map.put("hospitalArea", ""); |
|
|
|
|
|
|
|
if (HCAIGuidanceConfig.IS_SPLIT_TIME_REG) { |
|
|
|
|
|
|
|
item.setUrl(webReqURL + "reg-reserve.html#/reg-doct-source" + URLHelper.mapParamsToUrl(map, true)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
item.setUrl(webReqURL + "reg-reserve.html#/reg-doctor" + URLHelper.mapParamsToUrl(map, true)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
item.setSchedule(queryDoctorSchedule(deptCode, null, doctCode)); |
|
|
|
|
|
|
|
|
|
|
|
doctors.add(item); |
|
|
|
doctors.add(item); |
|
|
|
} |
|
|
|
} |
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, doctors); |
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, doctors); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<AISchedule> queryDoctorSchedule(String deptCode, String subDeptCode, String doctCode) { |
|
|
|
|
|
|
|
String begDate = DateHelper.getCurDate(); |
|
|
|
|
|
|
|
List<Register> sourceList = new HisRegisterDao().getTimeRegSource(deptCode, subDeptCode, doctCode, begDate, DateHelper.getMoveDate(begDate, 7)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<AISchedule> schedules = new ArrayList<>(); |
|
|
|
|
|
|
|
for (Register item : sourceList) { |
|
|
|
|
|
|
|
String regDate = item.getRegDate(); |
|
|
|
|
|
|
|
AISchedule findItem = schedules.stream().filter(o -> o.getDate().equals(regDate)).findFirst().orElse(null); |
|
|
|
|
|
|
|
if (findItem == null) { |
|
|
|
|
|
|
|
AISchedule addItem = new AISchedule(); |
|
|
|
|
|
|
|
addItem.setDate(regDate); |
|
|
|
|
|
|
|
addItem.setAvailable(1); |
|
|
|
|
|
|
|
addItem.setType("普通"); |
|
|
|
|
|
|
|
schedules.add(addItem); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
findItem.setAvailable(findItem.getAvailable() + 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return schedules; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 4.2.1.1 查询医院的首页服务列表(必选)
|
|
|
|
|
|
|
|
public Result getHospitalHomeService(String hosId) { |
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
if (!HCAIGuidanceConfig.HOSP_ID.equals(hosId)) { // 医院id校验
|
|
|
|
|
|
|
|
log.warn("[智能导诊]查询医院的首页服务列表-hosId不匹配"); |
|
|
|
|
|
|
|
return Result.success(ResultEnum.AI_SUCCESS, map); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<HCHospitalHome> dataList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String webReqURL = WeChatConfig.getWebReqURL(true); |
|
|
|
|
|
|
|
dataList.add(new HCHospitalHome(){{ |
|
|
|
|
|
|
|
setScene("门诊"); |
|
|
|
|
|
|
|
setServiceName("预约挂号"); |
|
|
|
|
|
|
|
setH5Url(webReqURL + "reg-reserve.html"); |
|
|
|
|
|
|
|
setRemark("线上挂号,线下就诊"); |
|
|
|
|
|
|
|
setWxAppId(""); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataList.add(new HCHospitalHome(){{ |
|
|
|
|
|
|
|
setScene("通用"); |
|
|
|
|
|
|
|
setServiceName("微官网"); |
|
|
|
|
|
|
|
setH5Url(webReqURL + "app.html"); |
|
|
|
|
|
|
|
setRemark("医院官网,功能分类展示"); |
|
|
|
|
|
|
|
setWxAppId(""); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataList.add(new HCHospitalHome(){{ |
|
|
|
|
|
|
|
setScene("门诊"); |
|
|
|
|
|
|
|
setServiceName("诊间支付"); |
|
|
|
|
|
|
|
setH5Url(webReqURL + "pay-info.html"); |
|
|
|
|
|
|
|
setRemark("处方和申请单线上缴费"); |
|
|
|
|
|
|
|
setWxAppId(""); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataList.add(new HCHospitalHome(){{ |
|
|
|
|
|
|
|
setScene("报告"); |
|
|
|
|
|
|
|
setServiceName("报告查询"); |
|
|
|
|
|
|
|
setH5Url(webReqURL + "all-result.html"); |
|
|
|
|
|
|
|
setRemark("检验、检查报告查询"); |
|
|
|
|
|
|
|
setWxAppId(""); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("dataList", dataList); |
|
|
|
|
|
|
|
return Result.success(map); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|