提交 6038ee0d authored 作者: 杨凯's avatar 杨凯

feat:家庭医生初始化

上级 a171956b
......@@ -17,7 +17,7 @@ public interface MobileBenefitPackageMapper {
void insert(MobileBenefitPackageEntity entity);
MobileBenefitPackageEntity queryByPhone(@Param("mobile") String mobile, @Param("activateOrderId") String activateOrderId);
MobileBenefitPackageEntity queryByPhone(@Param("mobile") String mobile, @Param("activateOrderId") String activateOrderId, @Param("flag") String flag);
void updateUsed(MobileBenefitPackageEntity entity);
......
package com.ebaiyihui.family.doctor.server.rabbitmq;
import com.ebaiyihui.family.doctor.common.dto.NotifyConsultDataDTO;
import com.ebaiyihui.family.doctor.server.common.constants.CommonConstants;
import com.ebaiyihui.family.doctor.server.common.enums.StatusEnum;
import com.ebaiyihui.family.doctor.server.config.RabbitMqConfig;
import com.ebaiyihui.family.doctor.server.entity.MobileBenefitPackageEntity;
import com.ebaiyihui.family.doctor.server.entity.PatientSignEntity;
import com.ebaiyihui.family.doctor.server.mapper.MobileBenefitPackageMapper;
import com.ebaiyihui.family.doctor.server.mapper.PatientSignMapper;
import com.ebaiyihui.family.doctor.server.util.DateUtils;
import com.ebaiyihui.family.doctor.server.util.ThirdOrderPushUtil;
import com.ebaiyihui.family.doctor.server.vo.OrderTaskVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.Date;
......@@ -26,6 +33,12 @@ public class RabbitConsumer {
@Autowired
private PatientSignMapper patientSignMapper;
@Autowired
private MobileBenefitPackageMapper mobileBenefitPackageMapper;
@Autowired
private ThirdOrderPushUtil thirdOrderPushUtil;
@RabbitListener(queues = RabbitMqConfig.ORDER_DELAY_QUEUE_1)
public void orderDelayQueue1(@Payload OrderTaskVo orderTaskVo) {
log.info("定时任务监听结果:{}", orderTaskVo.toString());
......@@ -41,6 +54,22 @@ public class RabbitConsumer {
if (StatusEnum.IN_CONSULTATION.getValue().equals(patientSignEntity.getStatus())) {
patientSignEntity.setStatus(StatusEnum.FINISH_APPLY.getValue());
patientSignMapper.updateById(patientSignEntity);
MobileBenefitPackageEntity entity = mobileBenefitPackageMapper.queryByPhone(patientSignEntity.getPatientPhone(),
patientSignEntity.getPackageOrderId(), "1");
if (!ObjectUtils.isEmpty(entity)) {
// 推送第三方权益使用
NotifyConsultDataDTO notifyConsultDataDTO = new NotifyConsultDataDTO();
notifyConsultDataDTO.setActivateOrderId(patientSignEntity.getPackageOrderId());
notifyConsultDataDTO.setConsultOrderNo(patientSignEntity.getAdmId());
notifyConsultDataDTO.setStatus(String.valueOf(StatusEnum.FINISH_APPLY.getValue()));
notifyConsultDataDTO.setProductId(entity.getProductId());
notifyConsultDataDTO.setPatientId(entity.getUserId());
notifyConsultDataDTO.setExpertName(patientSignEntity.getDoctorName());
notifyConsultDataDTO.setOrderDate(DateUtils.dateToFullString(patientSignEntity.getCreateTime()));
notifyConsultDataDTO.setSupplierCode(CommonConstants.SUPPLIER_CODE_JTYS);
thirdOrderPushUtil.syncBenefitUsedOrder(notifyConsultDataDTO);
}
}
} catch (Exception e) {
log.info("orderDelayQueue监听异常", e);
......
......@@ -61,7 +61,7 @@ public class MobileBenefitPackageServiceImpl implements MobileBenefitPackageServ
RegisterPatientVo registerPatientVo = new RegisterPatientVo();
MobileBenefitPackageEntity entity = new MobileBenefitPackageEntity();
if (Objects.nonNull(map.get("activateOrderId"))) {
entity = mobileBenefitPackageMapper.queryByPhone(map.get("mobile"), map.get("activateOrderId"));
entity = mobileBenefitPackageMapper.queryByPhone(map.get("mobile"), map.get("activateOrderId"), null);
if (ObjectUtils.isEmpty(entity)) {
return BaseResponse.error("没有查询到有关权益");
}
......
......@@ -77,7 +77,7 @@ public class PatientServiceImpl implements PatientService {
@Override
public BaseResponse<String> signedDoctor(SignedDoctorDTO reqVo) {
MobileBenefitPackageEntity entity = mobileBenefitPackageMapper.queryByPhone(reqVo.getPhone(), reqVo.getPackageOrderId());
MobileBenefitPackageEntity entity = mobileBenefitPackageMapper.queryByPhone(reqVo.getPhone(), reqVo.getPackageOrderId(), null);
if (ObjectUtils.isEmpty(entity)) {
return BaseResponse.error("没有查询到有关权益");
}
......
......@@ -3,6 +3,7 @@ package com.ebaiyihui.family.doctor.server.task;
import com.alibaba.fastjson.JSONObject;
import com.ebaiyihui.family.doctor.common.bo.Result;
import com.ebaiyihui.family.doctor.common.dto.HealthInfoDTO;
import com.ebaiyihui.family.doctor.common.dto.NotifyConsultDataDTO;
import com.ebaiyihui.family.doctor.common.dto.SendImMsgDTO;
import com.ebaiyihui.family.doctor.server.common.constants.CommonConstants;
import com.ebaiyihui.family.doctor.server.common.constants.ImConstants;
......@@ -24,6 +25,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.Date;
......@@ -195,6 +197,21 @@ public class SignedTask {
patientSignEntity.setSignEndTime(endTime);
} else {
patientSignEntity.setStatus(StatusEnum.FINISH_APPLY.getValue());
MobileBenefitPackageEntity entity = mobileBenefitPackageMapper.queryByPhone(patientSignEntity.getPatientPhone(),
patientSignEntity.getPackageOrderId(), "1");
if (!ObjectUtils.isEmpty(entity)) {
// 推送第三方权益使用
NotifyConsultDataDTO notifyConsultDataDTO = new NotifyConsultDataDTO();
notifyConsultDataDTO.setActivateOrderId(patientSignEntity.getPackageOrderId());
notifyConsultDataDTO.setConsultOrderNo(patientSignEntity.getAdmId());
notifyConsultDataDTO.setStatus(String.valueOf(StatusEnum.FINISH_APPLY.getValue()));
notifyConsultDataDTO.setProductId(entity.getProductId());
notifyConsultDataDTO.setPatientId(entity.getUserId());
notifyConsultDataDTO.setExpertName(patientSignEntity.getDoctorName());
notifyConsultDataDTO.setOrderDate(DateUtils.dateToFullString(patientSignEntity.getCreateTime()));
notifyConsultDataDTO.setSupplierCode(CommonConstants.SUPPLIER_CODE_JTYS);
thirdOrderPushUtil.syncBenefitUsedOrder(notifyConsultDataDTO);
}
}
patientSignSevice.updateById(patientSignEntity);
mobileBenefitPackageMapper.updateVersion(mbp);
......
......@@ -59,7 +59,9 @@
mobile_benefit_package
WHERE
phone = #{mobile} and activateOrderId = #{activateOrderId}
<if test="flag!=null and flag!=''">
and NOW() BETWEEN STR_TO_DATE(benefitsStartTime, '%Y-%m-%d %H:%i:%s') AND STR_TO_DATE(benefitsEndTime, '%Y-%m-%d %H:%i:%s')
</if>
ORDER BY
x_create_time DESC
LIMIT 0,1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论