123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package thyyxxk.wxservice_server.service;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Service;
- import org.springframework.web.client.RestTemplate;
- import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
- import thyyxxk.wxservice_server.dao.AppointmentDao;
- import thyyxxk.wxservice_server.entity.ResultVo;
- import thyyxxk.wxservice_server.entity.assessment.CovidQuestionnaire;
- import thyyxxk.wxservice_server.entity.covid.OrderCovidExamParam;
- import thyyxxk.wxservice_server.entity.hrgresponse.SaveMzFeeResponse;
- import thyyxxk.wxservice_server.utils.ResultVoUtil;
- import thyyxxk.wxservice_server.utils.IdCardUtil;
- /**
- * @author dj
- */
- @Slf4j
- @Service
- public class OrderCovidExamService {
- private final AppointmentDao dao;
- @Value("${hrgApiUrl}")
- private String hrgApiUrl;
- @Autowired
- public OrderCovidExamService(AppointmentDao dao) {
- this.dao = dao;
- }
- public ResultVo<String> hasDoneCovidAssessment(String patientId) {
- CovidQuestionnaire covid = dao.validCovidAssessment(patientId);
- if (null == covid) {
- return ResultVoUtil.success("no");
- } else {
- return ResultVoUtil.success("yes");
- }
- }
- public ResultVo<String> savePrescription(String patientId) {
- RestTemplate restTemplate = new RestTemplate();
- String url = hrgApiUrl + "/nucleicAcidApplication?patientId=" + patientId;
- SaveMzFeeResponse hrgResponse = restTemplate.getForObject(url, SaveMzFeeResponse.class);
- log.info("快速下单核酸检测:患者:{},结果:{}", patientId, hrgResponse);
- if (null == hrgResponse) {
- return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
- }
- if (0 == hrgResponse.getResultCode()) {
- return ResultVoUtil.success();
- }
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, hrgResponse.getResultMessage());
- }
- public ResultVo<String> updateIdCard(String patientId, String socialNo) {
- log.info("更新身份证:{},{}", patientId, socialNo);
- dao.updateMzPatientMiSocialNo(patientId, socialNo);
- dao.updateWxBindSocialNo(patientId, socialNo);
- return ResultVoUtil.success("更新身份证成功。");
- }
- }
|