Forráskód Böngészése

添加新冠抗原检测

lighter 2 éve
szülő
commit
027096ab25

+ 1 - 1
pom.xml

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

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

@@ -47,4 +47,13 @@ public interface AppointmentDao {
     @Select("select isnull(portrait,'') as portrait,isnull(introduction,'') as introduction " +
             "from a_employee_mi with(nolock) where code=#{code}")
     DoctorInfo selectPortraitAndIntroduction(@Param("code") String code);
+
+    @Select("select count(1) from mz_yj_req with(nolock) where patient_id=#{patientId} and " +
+            "order_code=#{code} and isnull(del_flag,0)=0 and datediff(day,req_date,getdate())=0")
+    int reqNoExist(@Param("patientId") String patientId,
+                   @Param("code") String code);
+
+    @Select("select count(1) from mzy_reqrec where patient_id=#{patientId} and cancel_mark=0 " +
+            "and datediff(day, request_day, getdate())=0")
+    int regNoExist(@Param("patientId") String patientId);
 }

+ 34 - 10
src/main/java/thyyxxk/wxservice_server/service/OrderCovidExamService.java

@@ -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();

+ 2 - 2
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: