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