提交 2cd76b40 authored 作者: 杨凯's avatar 杨凯

feat:家庭医生初始化

上级 fa477023
......@@ -48,4 +48,7 @@ public class SignedDoctorDTO {
@ApiModelProperty("签约状态1.未签约2.已签约3:已解约")
private Integer signStatus;
@ApiModelProperty("签约id")
private String signSeqId;
}
......@@ -27,4 +27,7 @@ public class RegisterPatientVo {
@ApiModelProperty("消息推送类型")
private Integer msgPushType;
@ApiModelProperty("签约id")
private String signSeqId;
}
......@@ -38,6 +38,6 @@ public class ImMsgTemplateController {
} catch (Exception e) {
return BaseResponse.error(e.getMessage());
}
return response;
return BaseResponse.success("消息推送成功");
}
}
......@@ -109,6 +109,10 @@ public class MobileBenefitPackageServiceImpl implements MobileBenefitPackageServ
registerPatientVo.setMsgPushType(Integer.valueOf(map.get("msgPushType")));
}
if (Objects.nonNull(map.get("signSeqId"))) {
registerPatientVo.setSignSeqId(map.get("signSeqId"));
}
String patientId = map.get("patient_id");
if (!StringUtils.isEmpty(patientId)) {
// 查询患者信息
......
......@@ -49,6 +49,9 @@ public class PatientServiceImpl implements PatientService {
@Autowired
private MobileBenefitPackageMapper mobileBenefitPackageMapper;
// @Autowired
// private
@Autowired
private ImMsgTemplateService imMsgTemplateService;
......@@ -97,7 +100,6 @@ public class PatientServiceImpl implements PatientService {
if (!patientSignEntities.isEmpty()) {
return BaseResponse.error("已经有进行中的签约的医生,不能在进行签约!!!");
}
}
if (SignStatus.CANCEL.getValue().equals(reqVo.getSignStatus())) {
QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>();
......@@ -112,10 +114,15 @@ public class PatientServiceImpl implements PatientService {
}
// 处理换绑医生
if (Objects.nonNull(reqVo.getAdmId())) {
if (Objects.nonNull(reqVo.getAdmId()) || Objects.nonNull(reqVo.getSignSeqId())) {
QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>();
PatientSignEntity patientSign = new PatientSignEntity();
if (Objects.nonNull(reqVo.getAdmId())) {
patientSign.setAdmId(reqVo.getAdmId());
}
if (Objects.nonNull(reqVo.getSignSeqId())) {
patientSign.setId(Long.valueOf(reqVo.getSignSeqId()));
}
psWrapper.setEntity(patientSign);
PatientSignEntity patientSignEntity = patientSignMapper.selectOne(psWrapper);
if (Objects.nonNull(patientSignEntity)) {
......@@ -239,4 +246,59 @@ public class PatientServiceImpl implements PatientService {
}
return BaseResponse.success(patientSignEntity);
}
// public ScheduleRecordEntity getScheduleDoctorInfo(String patientId){
// String date = DateUtils.dateToSimpleString(new Date());
// String hourAndSecond = DateUtils.getHourAndSecond();
// QueryWrapper<PatientSignEntity> psWrapper = new QueryWrapper<>();
// PatientSignEntity patientSign = new PatientSignEntity();
// patientSign.setPatientId(patientId);
// patientSign.setStatus(StatusEnum.IN_CONSULTATION.getValue());
// psWrapper.setEntity(patientSign);
// List<PatientSignEntity> patientSignEntities = patientSignMapper.selectList(psWrapper);
// List<Long> doctorIdsFastBuy = patientSignEntities.stream().map(PatientSignEntity::getDoctorId).collect(Collectors.toList());
// log.info("患者已下单医生:{}", doctorIdsFastBuy);
//
// List<ScheduleRecordEntity> scheduleRecordEntities = scheduleRecordMapper.selectByDate(CommonConstants.APP_CODE, 3, date, 1, hourAndSecond);
// List<String> doctorIds = new ArrayList<>();
// log.info("当前排班医生:{}", JSON.toJSONString(scheduleRecordEntities));
//
// if (CollectionUtils.isEmpty(scheduleRecordEntities)) {
// throw new BusinessException("暂无排班医生,请稍后下单");
// }
//
// //过滤该患者已下过单的医生
// if (!CollectionUtils.isEmpty(doctorIdsFastBuy)) {
// scheduleRecordEntities = scheduleRecordEntities.stream().filter(v -> !doctorIdsFastBuy.contains(v.getDoctorId())).collect(Collectors.toList());
// }
//
// if (CollectionUtils.isEmpty(scheduleRecordEntities)) {
// throw new BusinessException("已有订单进行中,请勿重复下单");
// }
//
// doctorIds = scheduleRecordEntities.stream().map(ScheduleRecordEntity::getDoctorId).collect(Collectors.toList());
//
// List<String> doctorByOrderCount = orderMapper.findDoctorByOrderCount(doctorIds, type);
//
// ScheduleRecordEntity scheduleRecordEntity = new ScheduleRecordEntity();
//
// //有极速购药订单的医生(d1)数量等于有排班的医生(d2)数量,取d1数量最少的(第一个)
// //有极速购药订单的医生(d1)数量小于有排班的医生(d2)数量,d2-d1,剩下随机取
// if (doctorByOrderCount.size() == scheduleRecordEntities.size()) {
// 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;
// }
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论