|
@@ -10,6 +10,8 @@ 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.bookable.BookedYjReq;
|
|
|
+import thyyxxk.wxservice_server.entity.bookable.Prescription;
|
|
|
import thyyxxk.wxservice_server.entity.covid.MultipleExamTimeLimit;
|
|
|
import thyyxxk.wxservice_server.entity.hrgresponse.SaveMzFeeResponse;
|
|
|
import thyyxxk.wxservice_server.utils.CastUtil;
|
|
@@ -17,7 +19,6 @@ import thyyxxk.wxservice_server.utils.ResultVoUtil;
|
|
|
import thyyxxk.wxservice_server.utils.StringUtil;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -49,15 +50,20 @@ public class OrderCovidExamService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> savePrescription(String patientId, int type) {
|
|
|
- if (StringUtil.isBlank(timeLimit.getLimitValue())) {
|
|
|
- timeLimitChanged();
|
|
|
- }
|
|
|
if (type == 2) {
|
|
|
- int nowtime = Integer.parseInt(timeLimitFormat.format(new Date()));
|
|
|
- if (nowtime < timeLimit.getBeginLimit() || nowtime > timeLimit.getEndLimit()) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "混检仅在 " +
|
|
|
- timeLimit.getLimitValueForDisplay() + " 开放。");
|
|
|
+ int regNoExist = dao.regNoExist(patientId);
|
|
|
+ if (regNoExist == 0) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您今日没有有效的挂号信息,无法继续下单,敬请谅解。");
|
|
|
}
|
|
|
+ int reqNoExist = dao.reqNoExist(patientId, "004651");
|
|
|
+ if (reqNoExist > 0) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您今日已经下单过新型冠状病毒抗原检测,无法继续下单,敬请谅解。");
|
|
|
+ }
|
|
|
+ BookedYjReq req = new BookedYjReq();
|
|
|
+ req.setPatientId(patientId);
|
|
|
+ req.setCode("004651");
|
|
|
+ req.setName("新型冠状病毒抗原检测");
|
|
|
+ return orderCovidAntigen(req);
|
|
|
}
|
|
|
String[] oris = getExamUrlAndLabel(type);
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
@@ -77,14 +83,32 @@ public class OrderCovidExamService {
|
|
|
switch (type) {
|
|
|
case 1:
|
|
|
return new String[]{"/nucleicAcidApplication?patientId=", "单人单管(绿码)"};
|
|
|
- case 2:
|
|
|
- return new String[]{"/hybridTestApplication?patientId=", "混检"};
|
|
|
case 3:
|
|
|
default:
|
|
|
return new String[]{"/nucleicOnlyYellowAcidApplication?patientId=", "单人单管(黄码)"};
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private ResultVo<String> orderCovidAntigen(BookedYjReq param) {
|
|
|
+ Prescription book = new Prescription();
|
|
|
+ book.initMzYjReqList(param);
|
|
|
+ book.getMzBlRecord().setEmrChiefComplaint("申请新型冠状病毒抗原检测");
|
|
|
+ book.getMzBlRecord().setEmrPe("申请新型冠状病毒抗原检测");
|
|
|
+ book.getMzBlRecord().setEmrFzjc("申请新型冠状病毒抗原检测");
|
|
|
+ book.getMzBlRecord().setEmrProcess("申请新型冠状病毒抗原检测");
|
|
|
+ log.info("自助开单预约:{}", JSONObject.toJSONString(book));
|
|
|
+ RestTemplate restTemplate = new RestTemplate();
|
|
|
+ SaveMzFeeResponse hrgResponse = restTemplate.postForObject(hrgApiUrl + "/savePrescription", book, SaveMzFeeResponse.class);
|
|
|
+ log.info("自助开单:{},结果:{}", param, hrgResponse);
|
|
|
+ if (null == hrgResponse) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
|
|
|
+ }
|
|
|
+ if (-1 == hrgResponse.getResultCode()) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, hrgResponse.getResultMessage());
|
|
|
+ }
|
|
|
+ return ResultVoUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
public ResultVo<MultipleExamTimeLimit> getMultipleExamTimeLimit() {
|
|
|
if (StringUtil.isBlank(timeLimit.getLimitValue())) {
|
|
|
timeLimitChanged();
|