Bladeren bron

添加自助预约检验检查。

lighter 4 jaren geleden
bovenliggende
commit
698e799e81

+ 35 - 0
src/main/java/thyyxxk/wxservice_server/controller/BookableController.java

@@ -0,0 +1,35 @@
+package thyyxxk.wxservice_server.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import thyyxxk.wxservice_server.pojo.ResultVo;
+import thyyxxk.wxservice_server.pojo.bookable.ExamItem;
+import thyyxxk.wxservice_server.pojo.bookable.ExecBook;
+import thyyxxk.wxservice_server.service.BookableService;
+
+import java.util.List;
+
+/**
+ * @author: DingJie
+ * @create: 2021-04-25 13:09:02
+ **/
+@RestController
+@RequestMapping("/bookable")
+public class BookableController {
+    private final BookableService service;
+
+    @Autowired
+    public BookableController(BookableService service) {
+        this.service = service;
+    }
+
+    @GetMapping("/getBookableData")
+    public ResultVo<List<ExamItem>> getBookableData(@RequestParam("tableName") String tableName) {
+        return service.getBookableData(tableName);
+    }
+
+    @PostMapping("/saveBookPrescription")
+    public ResultVo<String> saveBookPrescription(@RequestBody ExecBook param) {
+        return service.saveBookPrescription(param);
+    }
+}

+ 21 - 0
src/main/java/thyyxxk/wxservice_server/dao/BookableDao.java

@@ -0,0 +1,21 @@
+package thyyxxk.wxservice_server.dao;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import thyyxxk.wxservice_server.pojo.bookable.ExamItem;
+
+import java.util.List;
+
+/**
+ * @author: DingJie
+ * @create: 2021-04-25 13:09:45
+ **/
+@Mapper
+public interface BookableDao {
+
+    @Select("select rtrim(code) as code, rtrim(name) as name, rtrim(exec_unit) as execUnit, " +
+            "execUnitName=(select rtrim(name) from zd_unit_code where code=exec_unit) " +
+            "from ${tableName} where isnull(del_flag,0)!=1 and wx_bookable_flag=1")
+    List<ExamItem> getBookableData(@Param("tableName") String tableName);
+}

+ 15 - 0
src/main/java/thyyxxk/wxservice_server/pojo/bookable/ExamItem.java

@@ -0,0 +1,15 @@
+package thyyxxk.wxservice_server.pojo.bookable;
+
+import lombok.Data;
+
+/**
+ * @author: DingJie
+ * @create: 2021-04-25 11:39:22
+ **/
+@Data
+public class ExamItem {
+    private String code;
+    private String name;
+    private String execUnit;
+    private String execUnitName;
+}

+ 15 - 0
src/main/java/thyyxxk/wxservice_server/pojo/bookable/ExecBook.java

@@ -0,0 +1,15 @@
+package thyyxxk.wxservice_server.pojo.bookable;
+
+import lombok.Data;
+
+/**
+ * @author: DingJie
+ * @create: 2021-04-25 14:15:23
+ **/
+@Data
+public class ExecBook {
+    private String patientId;
+    private String execUnit;
+    private String code;
+    private String name;
+}

+ 41 - 0
src/main/java/thyyxxk/wxservice_server/pojo/bookable/Prescription.java

@@ -0,0 +1,41 @@
+package thyyxxk.wxservice_server.pojo.bookable;
+
+import lombok.Data;
+import thyyxxk.wxservice_server.pojo.covid.MzBlRecord;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * @author: DingJie
+ * @create: 2021-04-25 14:22:43
+ **/
+@Data
+public class Prescription {
+    private String patientId;
+    private String visitDeptCode;
+    private String doctorCode = "99999";
+    private String inspectPart = "";
+    private String reqComment = "";
+    private String reqTzComment = "";
+    private String birthDate;
+    private String icdCode = "ZD001";
+    private String icdText = "";
+    private Integer jzFlag = 0;
+    private MzBlRecord mzBlRecord = new MzBlRecord();
+    private List<HashMap<String, String>> mzChargeDetailList = new ArrayList<>();
+    private List<HashMap<String, String>> mzYjReqList;
+
+    public void initMzYjReqList(ExecBook book) {
+        setPatientId(book.getPatientId());
+        setVisitDeptCode(book.getExecUnit());
+        setReqComment("自助开单-" + book.getName());
+        setReqTzComment("自助开单-" + book.getName());
+        setIcdText("自助开单-" + book.getName());
+        mzYjReqList = new ArrayList<>();
+        HashMap<String, String> map = new HashMap<>(1);
+        map.put("orderCode", book.getCode());
+        mzYjReqList.add(map);
+    }
+}

+ 51 - 0
src/main/java/thyyxxk/wxservice_server/service/BookableService.java

@@ -0,0 +1,51 @@
+package thyyxxk.wxservice_server.service;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
+import thyyxxk.wxservice_server.dao.BookableDao;
+import thyyxxk.wxservice_server.pojo.ResultVo;
+import thyyxxk.wxservice_server.pojo.bookable.ExamItem;
+import thyyxxk.wxservice_server.pojo.bookable.ExecBook;
+import thyyxxk.wxservice_server.pojo.bookable.Prescription;
+import thyyxxk.wxservice_server.pojo.hrgresponse.SaveMzFeeRes;
+import thyyxxk.wxservice_server.utils.ResultVoUtil;
+import thyyxxk.wxservice_server.utils.ThmzUrls;
+
+import java.util.List;
+
+/**
+ * @author: DingJie
+ * @create: 2021-04-25 13:09:30
+ **/
+@Slf4j
+@Service
+public class BookableService {
+    private final BookableDao dao;
+
+    @Autowired
+    public BookableService(BookableDao dao) {
+        this.dao = dao;
+    }
+
+    public ResultVo<List<ExamItem>> getBookableData(String tableName) {
+        return ResultVoUtil.success(dao.getBookableData(tableName));
+    }
+
+    public ResultVo<String> saveBookPrescription(ExecBook param) {
+        Prescription book = new Prescription();
+        book.initMzYjReqList(param);
+        RestTemplate restTemplate = new RestTemplate();
+        SaveMzFeeRes hrgResponse = restTemplate.postForObject(ThmzUrls.SAVE_PRESCRIPTION, book, SaveMzFeeRes.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();
+    }
+}

+ 5 - 0
src/main/java/thyyxxk/wxservice_server/utils/ThmzUrls.java

@@ -8,6 +8,11 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
+/**
+ * @author dj
+ * 测试地址:http://172.16.30.33:8089
+ * 线上地址:http://webhis.thyy.cn:81
+ */
 public class ThmzUrls {
     public final static String GET_MZ_CLASS = "http://webhis.thyy.cn:81/thmz/api/v1/getMzClass";