提交 0bfaa2ca authored 作者: 杨凯's avatar 杨凯

feat:家庭医生初始化

上级 abc6f7c8
package com.ebaiyihui.family.doctor.common.dto;
import lombok.Data;
/**
* @ClassName: DoctorListForScheduleReqDTO
* @Author:yanliang
* @Date:2024/3/22 09:07
* @Description
*/
@Data
public class DoctorListForScheduleReqDTO {
private Long hospitalId;
private Integer servType;
}
package com.ebaiyihui.family.doctor.common.vo;
import lombok.Data;
/**
* @ClassName: DoctorListForScheduleResVo
* @Author:yanliang
* @Date:2024/3/22 09:08
* @Description
*/
@Data
public class DoctorListForScheduleResVo {
private String doctorId;
private String doctorName;
private String deptName;
private String deptId;
}
package com.ebaiyihui.family.doctor.server.controller; package com.ebaiyihui.family.doctor.server.controller;
import com.ebaiyihui.family.doctor.common.dto.DoctorListForScheduleReqDTO;
import com.ebaiyihui.family.doctor.common.dto.QueryDoctorsDTO; import com.ebaiyihui.family.doctor.common.dto.QueryDoctorsDTO;
import com.ebaiyihui.family.doctor.common.vo.DoctorListForScheduleResVo;
import com.ebaiyihui.family.doctor.common.vo.DoctorListVo; import com.ebaiyihui.family.doctor.common.vo.DoctorListVo;
import com.ebaiyihui.family.doctor.server.service.DoctorService; import com.ebaiyihui.family.doctor.server.service.DoctorService;
import com.ebaiyihui.framework.page.PageResult; import com.ebaiyihui.framework.page.PageResult;
...@@ -15,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -15,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* @ClassName: DoctorController * @ClassName: DoctorController
* @Author:yanliang * @Author:yanliang
...@@ -46,4 +50,13 @@ public class DoctorController { ...@@ -46,4 +50,13 @@ public class DoctorController {
} }
@ApiOperation(value = "管理端分类获取开通在线问诊的医生列表")
@RequestMapping(value = "/getDoctorListForSchedule", method = RequestMethod.POST)
public BaseResponse<List<DoctorListForScheduleResVo>> getDoctorListForSchedule(@RequestBody DoctorListForScheduleReqDTO req) {
return doctorService.getDoctorListForSchedule(req);
}
} }
package com.ebaiyihui.family.doctor.server.feign;
import com.doctor.basedata.api.DepartmentInfoApi;
import org.springframework.cloud.openfeign.FeignClient;
/**
* @ClassName: DepartmentFeignClient
* @Author:yanliang
* @Date:2024/3/22 09:24
* @Description
*/
@FeignClient(name = "doctoruser-service-api", url = "${cloudDoctorUrl}")
public interface DepartmentFeignClient extends DepartmentInfoApi {
}
...@@ -3,6 +3,9 @@ package com.ebaiyihui.family.doctor.server.mapper; ...@@ -3,6 +3,9 @@ package com.ebaiyihui.family.doctor.server.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ebaiyihui.family.doctor.server.entity.ScheduleRecordEntity; import com.ebaiyihui.family.doctor.server.entity.ScheduleRecordEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @ClassName: ScheduleRecordMapper * @ClassName: ScheduleRecordMapper
...@@ -12,4 +15,10 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -12,4 +15,10 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface ScheduleRecordMapper extends BaseMapper<ScheduleRecordEntity> { public interface ScheduleRecordMapper extends BaseMapper<ScheduleRecordEntity> {
List<ScheduleRecordEntity> selectByDate(@Param("hospitalId") String hospitalId,
@Param("servType") Integer servType,
@Param("scheduleDate") String scheduleDate,
@Param("status") Integer status,
@Param("endStart") String endStart);
} }
package com.ebaiyihui.family.doctor.server.service; package com.ebaiyihui.family.doctor.server.service;
import com.ebaiyihui.family.doctor.common.dto.DoctorListForScheduleReqDTO;
import com.ebaiyihui.family.doctor.common.dto.QueryDoctorsDTO; import com.ebaiyihui.family.doctor.common.dto.QueryDoctorsDTO;
import com.ebaiyihui.family.doctor.common.vo.DoctorListForScheduleResVo;
import com.ebaiyihui.family.doctor.common.vo.DoctorListVo; import com.ebaiyihui.family.doctor.common.vo.DoctorListVo;
import com.ebaiyihui.framework.page.PageResult; import com.ebaiyihui.framework.page.PageResult;
import com.ebaiyihui.framework.response.BaseResponse; import com.ebaiyihui.framework.response.BaseResponse;
import java.util.List;
/** /**
* @ClassName: DoctorService * @ClassName: DoctorService
* @Author:yanliang * @Author:yanliang
...@@ -15,4 +19,6 @@ import com.ebaiyihui.framework.response.BaseResponse; ...@@ -15,4 +19,6 @@ import com.ebaiyihui.framework.response.BaseResponse;
public interface DoctorService { public interface DoctorService {
BaseResponse<PageResult<DoctorListVo>> getSignedDoctorList(QueryDoctorsDTO reqVo); BaseResponse<PageResult<DoctorListVo>> getSignedDoctorList(QueryDoctorsDTO reqVo);
BaseResponse<List<DoctorListForScheduleResVo>> getDoctorListForSchedule(DoctorListForScheduleReqDTO req);
} }
...@@ -4,19 +4,26 @@ import com.alibaba.fastjson.JSON; ...@@ -4,19 +4,26 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.doctor.basedata.api.vo.BusinessDoctorPageReqVo; import com.doctor.basedata.api.vo.BusinessDoctorPageReqVo;
import com.doctor.basedata.api.vo.DepartmentDetailVo;
import com.doctor.basedata.api.vo.DoctorBasicRespVO; import com.doctor.basedata.api.vo.DoctorBasicRespVO;
import com.doctor.basedata.api.vo.ServiceCheckReqVo;
import com.ebaiyihui.family.doctor.common.dto.DoctorListForScheduleReqDTO;
import com.ebaiyihui.family.doctor.common.dto.QueryDoctorsDTO; import com.ebaiyihui.family.doctor.common.dto.QueryDoctorsDTO;
import com.ebaiyihui.family.doctor.common.vo.DoctorListForScheduleResVo;
import com.ebaiyihui.family.doctor.common.vo.DoctorListVo; import com.ebaiyihui.family.doctor.common.vo.DoctorListVo;
import com.ebaiyihui.family.doctor.server.common.constants.ImConstants;
import com.ebaiyihui.family.doctor.server.common.enums.SignStatus; import com.ebaiyihui.family.doctor.server.common.enums.SignStatus;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity; import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.family.doctor.server.entity.ServiceConfigEntity;
import com.ebaiyihui.family.doctor.server.feign.DepartmentFeignClient;
import com.ebaiyihui.family.doctor.server.feign.DoctorWorkingServiceClient; import com.ebaiyihui.family.doctor.server.feign.DoctorWorkingServiceClient;
import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper; import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper;
import com.ebaiyihui.family.doctor.server.mapper.ScheduleRecordMapper; import com.ebaiyihui.family.doctor.server.mapper.ServiceConfigMapper;
import com.ebaiyihui.family.doctor.server.service.DoctorService; import com.ebaiyihui.family.doctor.server.service.DoctorService;
import com.ebaiyihui.family.doctor.server.service.ServiceConfigService;
import com.ebaiyihui.framework.page.PageResult; import com.ebaiyihui.framework.page.PageResult;
import com.ebaiyihui.framework.response.BaseResponse; import com.ebaiyihui.framework.response.BaseResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -40,10 +47,10 @@ public class DoctorServiceImpl implements DoctorService { ...@@ -40,10 +47,10 @@ public class DoctorServiceImpl implements DoctorService {
private PatientSignMapper patientSignMapper; private PatientSignMapper patientSignMapper;
@Autowired @Autowired
private ScheduleRecordMapper scheduleRecordMapper; private DepartmentFeignClient departmentInfoApi;
@Autowired @Autowired
private ServiceConfigService serviceConfigService; private ServiceConfigMapper serviceConfigMapper;
@Autowired @Autowired
private DoctorWorkingServiceClient doctorWorkingServiceClient; private DoctorWorkingServiceClient doctorWorkingServiceClient;
...@@ -135,6 +142,84 @@ public class DoctorServiceImpl implements DoctorService { ...@@ -135,6 +142,84 @@ public class DoctorServiceImpl implements DoctorService {
return BaseResponse.success(pageResult); return BaseResponse.success(pageResult);
} }
@Override
public BaseResponse<List<DoctorListForScheduleResVo>> getDoctorListForSchedule(DoctorListForScheduleReqDTO req) {
//通过医院ID和服务查找开通服务 开通排班 的医生
BusinessDoctorPageReqVo businessDoctorPageReqVo = new BusinessDoctorPageReqVo();
businessDoctorPageReqVo.setSeq(1);
businessDoctorPageReqVo.setStatus(1);
businessDoctorPageReqVo.setOrganId(req.getHospitalId());
businessDoctorPageReqVo.setPageNum(1);
businessDoctorPageReqVo.setPageSize(9999);
businessDoctorPageReqVo.setServiceCode(ImConstants.IM_QUERY_ACCOUNT_CODE);
BaseResponse<PageResult<DoctorBasicRespVO>> result =
doctorWorkingServiceClient.getBusinessDoctorBaseInfoPage(businessDoctorPageReqVo);
if (!result.isSuccess()) {
return BaseResponse.error("医生查询失败");
}
if (null == result || null == result.getData()) {
return BaseResponse.error("无开通家庭医生的医生");
}
log.info("查询开通家庭医生医生列表{}", JSON.toJSONString(result.getData().getContent()));
ArrayList<DoctorListForScheduleResVo> listForScheduleVos = new ArrayList<>();
for (DoctorBasicRespVO doctorBasicRespVO : result.getData().getContent()) {
QueryWrapper<ServiceConfigEntity> queryWrapper = new QueryWrapper<>();
ServiceConfigEntity serviceConfig = new ServiceConfigEntity();
serviceConfig.setServiceCode(ImConstants.IM_QUERY_ACCOUNT_CODE);
serviceConfig.setDeptId(doctorBasicRespVO.getDeptId());
serviceConfig.setDoctorId(doctorBasicRespVO.getXId().toString());
serviceConfig.setOrganId(doctorBasicRespVO.getOrganId().toString());
serviceConfig.setStatus(1);
queryWrapper.setEntity(serviceConfig);
List list = new ArrayList<>();
list.add(2);
list.add(3);
queryWrapper.in("is_schedule", list);
List<ServiceConfigEntity> serviceConfigEntities = serviceConfigMapper.selectList(queryWrapper);
if (CollectionUtils.isEmpty(serviceConfigEntities)) {
log.info("未查询到医生服务信息,或此医生未开通排班");
continue;
}
serviceConfigEntities.stream().forEach(one -> {
//查在线医生服务是否开通
ServiceCheckReqVo serviceCheckReqVo = new ServiceCheckReqVo();
serviceCheckReqVo.setDoctorId(doctorBasicRespVO.getXId());
serviceCheckReqVo.setOrganId(doctorBasicRespVO.getOrganId());
serviceCheckReqVo.setDeptId(one.getDeptId());
serviceCheckReqVo.setServiceCode(serviceConfig.getServiceCode());
BaseResponse<Boolean> response = doctorWorkingServiceClient.checkDoctorServiceByCode(serviceCheckReqVo);
if (!response.isSuccess() || !response.getData()) {
log.info("医生该科室未开通家庭医生服务:{}", one.getDeptId());
return;
}
if (StringUtils.isEmpty(one.getDoctorPortrait()) || StringUtils.isEmpty(one.getDoctorProfession())) {
//把医生头像和职称更新进去
ServiceConfigEntity serviceUpdate = new ServiceConfigEntity();
serviceUpdate.setDoctorPortrait(doctorBasicRespVO.getPortrait());
serviceUpdate.setDoctorProfession(doctorBasicRespVO.getStandardTitle());
serviceUpdate.setId(one.getId());
serviceConfigMapper.updateById(serviceUpdate);
}
DoctorListForScheduleResVo doctorForScheduleVo = new DoctorListForScheduleResVo();
doctorForScheduleVo.setDoctorId(doctorBasicRespVO.getXId().toString());
doctorForScheduleVo.setDoctorName(doctorBasicRespVO.getDoctorName());
BaseResponse<DepartmentDetailVo> departmentDetail = departmentInfoApi.getDepartmentDetail(Long.valueOf(one.getDeptId()));
doctorForScheduleVo.setDeptName(departmentDetail.getData().getDeptName());
doctorForScheduleVo.setDeptId(one.getDeptId().toString());
listForScheduleVos.add(doctorForScheduleVo);
});
}
return BaseResponse.success(listForScheduleVos);
}
// private void redisHistory(QueryFamousDotDTO reqVo) { // private void redisHistory(QueryFamousDotDTO reqVo) {
// //
// //把搜索的数据存在map中 // //把搜索的数据存在map中
...@@ -250,7 +335,6 @@ public class DoctorServiceImpl implements DoctorService { ...@@ -250,7 +335,6 @@ public class DoctorServiceImpl implements DoctorService {
if (CollectionUtils.isEmpty(resultData)) { if (CollectionUtils.isEmpty(resultData)) {
return new ArrayList<>(); return new ArrayList<>();
} }
//List<DoctorBasicRespVO> content = businessDoctorPage.getData().getContent();
List<DoctorBasicRespVO> collect = resultData.stream().filter(vo -> ("5").equals(vo.getAduitStatus())).collect(Collectors.toList()); List<DoctorBasicRespVO> collect = resultData.stream().filter(vo -> ("5").equals(vo.getAduitStatus())).collect(Collectors.toList());
docBaseList.addAll(collect); docBaseList.addAll(collect);
} }
......
package com.ebaiyihui.family.doctor.server.service.impl; package com.ebaiyihui.family.doctor.server.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ebaiyihui.family.doctor.common.dto.NotifyConsultDataDTO; import com.ebaiyihui.family.doctor.common.dto.NotifyConsultDataDTO;
import com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO; import com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO;
...@@ -10,9 +11,11 @@ import com.ebaiyihui.family.doctor.server.common.enums.SignStatus; ...@@ -10,9 +11,11 @@ import com.ebaiyihui.family.doctor.server.common.enums.SignStatus;
import com.ebaiyihui.family.doctor.server.common.enums.StatusEnum; import com.ebaiyihui.family.doctor.server.common.enums.StatusEnum;
import com.ebaiyihui.family.doctor.server.entity.MobileBenefitPackageEntity; import com.ebaiyihui.family.doctor.server.entity.MobileBenefitPackageEntity;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity; import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.family.doctor.server.entity.ScheduleRecordEntity;
import com.ebaiyihui.family.doctor.server.exception.BusinessException; import com.ebaiyihui.family.doctor.server.exception.BusinessException;
import com.ebaiyihui.family.doctor.server.mapper.MobileBenefitPackageMapper; import com.ebaiyihui.family.doctor.server.mapper.MobileBenefitPackageMapper;
import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper; import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper;
import com.ebaiyihui.family.doctor.server.mapper.ScheduleRecordMapper;
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.GoEasyPushService;
import com.ebaiyihui.family.doctor.server.service.ImChatTemplate; import com.ebaiyihui.family.doctor.server.service.ImChatTemplate;
...@@ -26,12 +29,14 @@ import com.ebaiyihui.framework.response.BaseResponse; ...@@ -26,12 +29,14 @@ import com.ebaiyihui.framework.response.BaseResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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 org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Random;
/** /**
* @ClassName: PatientServiceImpl * @ClassName: PatientServiceImpl
...@@ -49,8 +54,8 @@ public class PatientServiceImpl implements PatientService { ...@@ -49,8 +54,8 @@ public class PatientServiceImpl implements PatientService {
@Autowired @Autowired
private MobileBenefitPackageMapper mobileBenefitPackageMapper; private MobileBenefitPackageMapper mobileBenefitPackageMapper;
// @Autowired @Autowired
// private private ScheduleRecordMapper scheduleRecordMapper;
@Autowired @Autowired
private ImMsgTemplateService imMsgTemplateService; private ImMsgTemplateService imMsgTemplateService;
...@@ -88,7 +93,10 @@ public class PatientServiceImpl implements PatientService { ...@@ -88,7 +93,10 @@ public class PatientServiceImpl implements PatientService {
} catch (Exception e) { } catch (Exception e) {
return BaseResponse.error("没有查询到有关权益"); return BaseResponse.error("没有查询到有关权益");
} }
Long doctorId = reqVo.getDoctorId();
String doctorName = reqVo.getDoctorName();
Long deptId = reqVo.getDeptId();
String deptName = reqVo.getDeptName();
if (!SignStatus.NORMAL.getValue().equals(reqVo.getSignStatus())) { if (!SignStatus.NORMAL.getValue().equals(reqVo.getSignStatus())) {
QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>(); QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>();
PatientSignEntity patientSign = new PatientSignEntity(); PatientSignEntity patientSign = new PatientSignEntity();
...@@ -100,6 +108,13 @@ public class PatientServiceImpl implements PatientService { ...@@ -100,6 +108,13 @@ public class PatientServiceImpl implements PatientService {
if (!patientSignEntities.isEmpty()) { if (!patientSignEntities.isEmpty()) {
return BaseResponse.error("已经有进行中的签约的医生,不能在进行签约!!!"); return BaseResponse.error("已经有进行中的签约的医生,不能在进行签约!!!");
} }
} else {
// 查询排班医生信息
ScheduleRecordEntity scheduleRecordEntity = getScheduleDoctor(reqVo.getPatientId());
doctorId = Long.valueOf(scheduleRecordEntity.getDoctorId());
doctorName = scheduleRecordEntity.getDoctorName();
deptId = Long.valueOf(scheduleRecordEntity.getDeptId());
deptName = scheduleRecordEntity.getDeptName();
} }
if (SignStatus.CANCEL.getValue().equals(reqVo.getSignStatus())) { if (SignStatus.CANCEL.getValue().equals(reqVo.getSignStatus())) {
QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>(); QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>();
...@@ -140,10 +155,10 @@ public class PatientServiceImpl implements PatientService { ...@@ -140,10 +155,10 @@ public class PatientServiceImpl implements PatientService {
patientSignEntity.setAppCode(CommonConstants.APP_CODE); patientSignEntity.setAppCode(CommonConstants.APP_CODE);
patientSignEntity.setOrganId(CommonConstants.ORGAN_CODE); patientSignEntity.setOrganId(CommonConstants.ORGAN_CODE);
patientSignEntity.setOrganName(CommonConstants.ORGAN_NAME); patientSignEntity.setOrganName(CommonConstants.ORGAN_NAME);
patientSignEntity.setDoctorId(reqVo.getDoctorId()); patientSignEntity.setDoctorId(doctorId);
patientSignEntity.setDoctorName(reqVo.getDoctorName()); patientSignEntity.setDoctorName(doctorName);
patientSignEntity.setDeptId(reqVo.getDeptId()); patientSignEntity.setDeptId(deptId);
patientSignEntity.setDeptName(reqVo.getDeptName()); patientSignEntity.setDeptName(deptName);
patientSignEntity.setSignStatus(SignStatus.CANCEL.getValue().equals(reqVo.getSignStatus()) ? SignStatus.SIGNED.getValue() : reqVo.getSignStatus()); patientSignEntity.setSignStatus(SignStatus.CANCEL.getValue().equals(reqVo.getSignStatus()) ? SignStatus.SIGNED.getValue() : reqVo.getSignStatus());
patientSignEntity.setPatientPhone(reqVo.getPhone()); patientSignEntity.setPatientPhone(reqVo.getPhone());
patientSignEntity.setCredNo(reqVo.getCredNo()); patientSignEntity.setCredNo(reqVo.getCredNo());
...@@ -247,58 +262,43 @@ public class PatientServiceImpl implements PatientService { ...@@ -247,58 +262,43 @@ public class PatientServiceImpl implements PatientService {
return BaseResponse.success(patientSignEntity); return BaseResponse.success(patientSignEntity);
} }
// public ScheduleRecordEntity getScheduleDoctorInfo(String patientId){ /**
// String date = DateUtils.dateToSimpleString(new Date()); * 随访查询一个排班医生
// String hourAndSecond = DateUtils.getHourAndSecond(); *
// QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>(); * @param patientId
// PatientSignEntity patientSign = new PatientSignEntity(); * @return
// patientSign.setPatientId(patientId); */
// patientSign.setStatus(StatusEnum.IN_CONSULTATION.getValue()); public ScheduleRecordEntity getScheduleDoctor(String patientId) {
// psWrapper.setEntity(patientSign); String date = DateUtils.dateToSimpleString(new Date());
// List<PatientSignEntity> patientSignEntities = patientSignMapper.selectList(psWrapper); String hourAndSecond = DateUtils.getHourAndSecond();
// List<Long> doctorIdsFastBuy = patientSignEntities.stream().map(PatientSignEntity::getDoctorId).collect(Collectors.toList()); QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>();
// log.info("患者已下单医生:{}", doctorIdsFastBuy); PatientSignEntity patientSign = new PatientSignEntity();
// patientSign.setPatientId(patientId);
// List<ScheduleRecordEntity> scheduleRecordEntities = scheduleRecordMapper.selectByDate(CommonConstants.APP_CODE, 3, date, 1, hourAndSecond); patientSign.setSignStatus(SignStatus.NORMAL.getValue());
// List<String> doctorIds = new ArrayList<>(); patientSign.setStatus(StatusEnum.IN_CONSULTATION.getValue());
// log.info("当前排班医生:{}", JSON.toJSONString(scheduleRecordEntities)); psWrapper.setEntity(patientSign);
// List<PatientSignEntity> patientSignEntities = patientSignMapper.selectList(psWrapper);
// if (CollectionUtils.isEmpty(scheduleRecordEntities)) { if (CollectionUtils.isEmpty(patientSignEntities)) {
// throw new BusinessException("暂无排班医生,请稍后下单"); throw new BusinessException("已有进行中排班医生沟通,请勿重复点击");
// } }
// // 查询排班医生信息
// //过滤该患者已下过单的医生 List<ScheduleRecordEntity> scheduleRecordEntities = scheduleRecordMapper.selectByDate(CommonConstants.APP_CODE, 4, date, 1, hourAndSecond);
// if (!CollectionUtils.isEmpty(doctorIdsFastBuy)) { log.info("当前排班医生:{}", JSON.toJSONString(scheduleRecordEntities));
// scheduleRecordEntities = scheduleRecordEntities.stream().filter(v -> !doctorIdsFastBuy.contains(v.getDoctorId())).collect(Collectors.toList());
// } if (CollectionUtils.isEmpty(scheduleRecordEntities)) {
// throw new BusinessException("暂无排班医生,请稍后重试");
// if (CollectionUtils.isEmpty(scheduleRecordEntities)) { }
// throw new BusinessException("已有订单进行中,请勿重复下单");
// } ScheduleRecordEntity scheduleRecordEntity = new ScheduleRecordEntity();
//
// doctorIds = scheduleRecordEntities.stream().map(ScheduleRecordEntity::getDoctorId).collect(Collectors.toList()); Random random = new Random();
// int i = random.nextInt(scheduleRecordEntities.size() + 1);
// List<String> doctorByOrderCount = orderMapper.findDoctorByOrderCount(doctorIds, type); if (i == 0) {
// i = i + 1;
// ScheduleRecordEntity scheduleRecordEntity = new ScheduleRecordEntity(); }
// scheduleRecordEntity = scheduleRecordEntities.get(i - 1);
// //有极速购药订单的医生(d1)数量等于有排班的医生(d2)数量,取d1数量最少的(第一个)
// //有极速购药订单的医生(d1)数量小于有排班的医生(d2)数量,d2-d1,剩下随机取 log.info("当前下单的医生:{}", JSON.toJSONString(scheduleRecordEntity));
// if (doctorByOrderCount.size() == scheduleRecordEntities.size()) { return scheduleRecordEntity;
// String doctorId = doctorByOrderCount.get(0); }
// Optional<ScheduleRecordEntity> first = scheduleRecordEntities.stream().filter(v -> Objects.equals(v.getDoctorId(), doctorId)).findFirst();
// scheduleRecordEntity = first.get();
// } else if (doctorByOrderCount.size() < scheduleRecordEntities.size()) {
// scheduleRecordEntities = scheduleRecordEntities.stream().filter(v -> !doctorByOrderCount.contains(v.getDoctorId())).collect(Collectors.toList());
// Random random = new Random();
// int i = random.nextInt(scheduleRecordEntities.size() + 1);
// if (i == 0) {
// i = i + 1;
// }
// scheduleRecordEntity = scheduleRecordEntities.get(i - 1);
// }
//
// log.info("当前下单的医生:{}", JSON.toJSONString(scheduleRecordEntity));
// return scheduleRecordEntity;
// }
} }
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ebaiyihui.family.doctor.server.mapper.ScheduleRecordMapper">
<select id="selectByDate" resultType="com.ebaiyihui.family.doctor.server.entity.ScheduleRecordEntity">
SELECT
*
FROM schedule_record
<where>
schedule_date = #{scheduleDate}
and hospital_id = #{hospitalId}
and serv_type = #{servType}
and status =1
and start_time <![CDATA[<= ]]> #{endStart}
and end_time <![CDATA[>= ]]> #{endStart}
</where>
</select>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论