Преглед изворни кода

移除核酸检测健康码限制,启用挂号条件校验,优化代码。

lighter пре 2 година
родитељ
комит
499d212505

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>wxservice-server</artifactId>
-    <version>9.4</version>
+    <version>9.6</version>
     <name>wxservice-server</name>
     <description>server for wxservice-web</description>
 

+ 3 - 3
src/main/java/thyyxxk/wxservice_server/controller/AppointmentController.java

@@ -59,10 +59,10 @@ public class AppointmentController {
         return service.getDoctorInfo(doctorCode, openId);
     }
 
-    @GetMapping("/hasValidCovidAssessment")
-    public ResultVo<String> hasValidCovidAssessment(@RequestParam("patientId") String patientId,
+    @GetMapping("/checkAppointmentRequirements")
+    public ResultVo<String> checkAppointmentRequirements(@RequestParam("patientId") String patientId,
                                                     @RequestParam("deptCode") String deptCode) {
-        return service.hasValidCovidAssessment(patientId, deptCode);
+        return service.checkAppointmentRequirements(patientId, deptCode);
     }
 
     @PostMapping("/getSourcesByDateAndDoctor")

+ 3 - 19
src/main/java/thyyxxk/wxservice_server/controller/OrderCovidController.java

@@ -3,7 +3,6 @@ package thyyxxk.wxservice_server.controller;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import thyyxxk.wxservice_server.entity.ResultVo;
-import thyyxxk.wxservice_server.entity.covid.MultipleExamTimeLimit;
 import thyyxxk.wxservice_server.service.OrderCovidExamService;
 
 /**
@@ -25,28 +24,13 @@ public class OrderCovidController {
         service.setCovidAntigenLimit(needCheck, maxCount);
     }
 
-    @GetMapping("/hasDoneCovidAssessment")
-    public ResultVo<String> hasDoneCovidAssessment(@RequestParam("patientId") String patientId) {
-        return service.hasDoneCovidAssessment(patientId);
-    }
-
     @GetMapping("/savePrescription")
     public ResultVo<String> savePrescription(@RequestParam("patientId") String patientId, @RequestParam("type") int type) {
-        return service.savePrescription(patientId, type);
-    }
-
-    @GetMapping("/getMultipleExamTimeLimit")
-    public ResultVo<MultipleExamTimeLimit> getMultipleExamTimeLimit() {
-        return service.getMultipleExamTimeLimit();
-    }
-
-    @GetMapping("/yellowHealthCardFreeCovidExam")
-    public ResultVo<String> yellowHealthCardFreeCovidExam(@RequestParam("patientId") String patientId) {
-        return service.yellowHealthCardFreeCovidExam(patientId);
+        return type == 1 ? service.applySingleCovidExam(patientId) : service.applyCovidAntigen(patientId);
     }
 
     @GetMapping("/timeLimitChanged")
-    public String timeLimitChanged() {
-        return service.timeLimitChanged();
+    public void timeLimitChanged() {
+
     }
 }

+ 0 - 4
src/main/java/thyyxxk/wxservice_server/dao/AppointmentDao.java

@@ -34,10 +34,6 @@ public interface AppointmentDao {
             "isnull(a.del_flag,0)<>1")
     DoctorInfo selectDoctorInfo(@Param("doctorCode") String doctorCode, @Param("openId") String openId);
 
-    @Select("select top 1 * from t_covid19_assessment with(nolock) where patient_id=#{patientId} and " +
-            "datediff(day, date, getdate()) <= 3 order by date desc")
-    CovidQuestionnaire validCovidAssessment(@Param("patientId") String patientId);
-
     @Select("select rtrim(social_no) from mz_patient_mi with(nolock) where patient_id=#{patientId}")
     String selectPatientIdCard(@Param("patientId") String patientId);
 

+ 0 - 12
src/main/java/thyyxxk/wxservice_server/entity/covid/MultipleExamTimeLimit.java

@@ -1,12 +0,0 @@
-package thyyxxk.wxservice_server.entity.covid;
-
-import lombok.Data;
-
-@Data
-public class MultipleExamTimeLimit {
-    private String limitValue;
-    private String limitValueForDisplay = "08:00 - 24:00";
-
-    private Integer beginLimit = 800;
-    private Integer endLimit = 2400;
-}

+ 1 - 28
src/main/java/thyyxxk/wxservice_server/service/AppointmentService.java

@@ -206,15 +206,7 @@ public class AppointmentService {
         return ResultVoUtil.success(doctor);
     }
 
-    public ResultVo<String> hasValidCovidAssessment(String patientId, String deptCode) {
-        ResultVo<String> appointmentRequirements = checkAppointmentRequirements(patientId, deptCode);
-        if (appointmentRequirements.getCode() != ExceptionEnum.SUCCESS.getCode()) {
-            return appointmentRequirements;
-        }
-        return checkCovidQuestionnaire(patientId);
-    }
-
-    private ResultVo<String> checkAppointmentRequirements(String patientId, String deptCode) {
+    public ResultVo<String> checkAppointmentRequirements(String patientId, String deptCode) {
         String idCard = dao.selectPatientIdCard(patientId);
         if (!IdCardUtil.isValidatedIdCard(idCard)) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您在我院绑定的身份证号不是有效的身份证号," +
@@ -234,25 +226,6 @@ public class AppointmentService {
         return ResultVoUtil.success();
     }
 
-    private ResultVo<String> checkCovidQuestionnaire(String patientId) {
-        CovidQuestionnaire covid = dao.validCovidAssessment(patientId);
-        if (null == covid) {
-            return ResultVoUtil.success("no valid assessment");
-        }
-        if (isDangerousCovidQuestionnaire(covid)) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您新型冠状病毒感染流行病学史问卷未通过,请挂发热门诊。");
-        }
-        return ResultVoUtil.success("valid assessment");
-    }
-
-    private boolean isDangerousCovidQuestionnaire(CovidQuestionnaire covid) {
-        return covid.getTemperature() == 2 ||
-                covid.getItem1() != 14 ||
-                covid.getItem2() != 24 ||
-                covid.getItem3() != 32 ||
-                covid.getItem4() != 42;
-    }
-
     public ResultVo<String> getDoctorQrCode(String doctorCode) {
         final String qywxToken = PropertiesUtil.getProperty("qywxToken");
         final String userid = redis.getEmployeeCodeRs(doctorCode);

+ 19 - 92
src/main/java/thyyxxk/wxservice_server/service/OrderCovidExamService.java

@@ -9,18 +9,10 @@ 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.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;
 import thyyxxk.wxservice_server.utils.ResultVoUtil;
-import thyyxxk.wxservice_server.utils.StringUtil;
-
-import java.text.SimpleDateFormat;
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * @author dj
@@ -29,7 +21,6 @@ import java.util.Map;
 @Service
 public class OrderCovidExamService {
     private final AppointmentDao dao;
-    private final MultipleExamTimeLimit timeLimit = new MultipleExamTimeLimit();
     private static Boolean CHECK_MAX_COVID_ANTIGEN = true;
     private static Integer MAX_COVID_ANTIGEN = 100;
 
@@ -46,39 +37,11 @@ public class OrderCovidExamService {
         MAX_COVID_ANTIGEN = maxCount;
     }
 
-    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, int type) {
-        if (type == 2) {
-            if (CHECK_MAX_COVID_ANTIGEN && dao.reqCount("004651") >= MAX_COVID_ANTIGEN) {
-                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "今日新冠抗原检测已售罄,无法继续下单,敬请谅解。");
-            }
-            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);
+    public ResultVo<String> applySingleCovidExam(String patientId) {
         RestTemplate restTemplate = new RestTemplate();
-        String url = hrgApiUrl + oris[0] + patientId;
+        String url = hrgApiUrl + "/nucleicAcidApplication?patientId=" + patientId;
         SaveMzFeeResponse hrgResponse = restTemplate.getForObject(url, SaveMzFeeResponse.class);
-        log.info("【{}】快速下单核酸检测:患者:{},结果:{}", oris[1], patientId, hrgResponse);
+        log.info("【单人单管】快速下单核酸检测:患者:{},结果:{}", patientId, hrgResponse);
         if (null == hrgResponse) {
             return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
         }
@@ -88,14 +51,23 @@ public class OrderCovidExamService {
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, hrgResponse.getResultMessage());
     }
 
-    private String[] getExamUrlAndLabel(int type) {
-        switch (type) {
-            case 1:
-                return new String[]{"/nucleicAcidApplication?patientId=", "单人单管(绿码)"};
-            case 3:
-            default:
-                return new String[]{"/nucleicOnlyYellowAcidApplication?patientId=", "单人单管(黄码)"};
+    public ResultVo<String> applyCovidAntigen(String patientId) {
+        if (CHECK_MAX_COVID_ANTIGEN && dao.reqCount("004651") >= MAX_COVID_ANTIGEN) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "今日新冠抗原检测已售罄,无法继续下单,敬请谅解。");
+        }
+        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);
     }
 
     private ResultVo<String> orderCovidAntigen(BookedYjReq param) {
@@ -118,49 +90,4 @@ public class OrderCovidExamService {
         return ResultVoUtil.success();
     }
 
-    public ResultVo<MultipleExamTimeLimit> getMultipleExamTimeLimit() {
-        if (StringUtil.isBlank(timeLimit.getLimitValue())) {
-            timeLimitChanged();
-        }
-        return ResultVoUtil.success(timeLimit);
-    }
-
-    public String timeLimitChanged() {
-        String url = hrgApiUrl + "/getHyBirdTime";
-        RestTemplate template = new RestTemplate();
-        Map<String, Object> result = template.getForObject(url, HashMap.class);
-        log.info("重新获取混检开放时间:{}", result);
-        if (null == result) {
-            String msg = "获取混检开放时间失败,接口返回空。";
-            log.info(msg);
-            return msg;
-        }
-        if ((int) result.get("code") != 0) {
-            String msg = result.get("message").toString();
-            log.info("获取混检开放时间失败:{}", msg);
-            return msg;
-        }
-        Map<String, String> data = CastUtil.cast(result.get("data"));
-        String value = data.get("configValue");
-        String[] valuesArr = value.replaceAll(":", "").split("-");
-        timeLimit.setLimitValue(value);
-        timeLimit.setLimitValueForDisplay(value.replace("-", " - "));
-        timeLimit.setBeginLimit(Integer.parseInt(valuesArr[0]));
-        timeLimit.setEndLimit(Integer.parseInt(valuesArr[1]));
-        return JSONObject.toJSONString(timeLimit);
-    }
-
-    public ResultVo<String> yellowHealthCardFreeCovidExam(String patientId) {
-        RestTemplate restTemplate = new RestTemplate();
-        String url = hrgApiUrl + "/nucleicOnlyYellowAcidApplication?patientId=" + patientId;
-        SaveMzFeeResponse hrgResponse = restTemplate.getForObject(url, SaveMzFeeResponse.class);
-        log.info("黄码免费核酸检测快速下单:患者:{},结果:{}", patientId, hrgResponse);
-        if (null == hrgResponse) {
-            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "网络异常,请稍后再试。");
-        }
-        if (0 == hrgResponse.getResultCode()) {
-            return ResultVoUtil.success("黄码免费核酸检测下单成功。");
-        }
-        return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, hrgResponse.getResultMessage());
-    }
 }

+ 4 - 4
src/main/resources/application.yml

@@ -9,8 +9,8 @@ spring:
     cache: false
   datasource:
     driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
-    url: jdbc:sqlserver://172.16.32.179:1433;databaseName=thxyhisdb
-#    url: jdbc:sqlserver://172.16.32.168:1433;databaseName=thxyhisdb
+#    url: jdbc:sqlserver://172.16.32.179:1433;databaseName=thxyhisdb
+    url: jdbc:sqlserver://172.16.32.168:1433;databaseName=thxyhisdb
     hikari:
       username: sa
       password:
@@ -32,8 +32,8 @@ mybatis:
   configuration:
     map-underscore-to-camel-case: true
 
-hrgApiUrl: http://172.16.30.33:8089/thmz/api/v1
-#hrgApiUrl: http://172.16.32.160:81/thmz/api/v1
+#hrgApiUrl: http://172.16.30.33:8089/thmz/api/v1
+hrgApiUrl: http://172.16.32.160:81/thmz/api/v1
 
 inspectionUrl: http://172.16.32.178:622/pushservice.asmx?wsdl
 physicalCheck: http://172.16.32.183:8888/bdp/dataservice/api/