Browse Source

检验检查的检验部分

lighter 8 months ago
parent
commit
bd1b13f052
20 changed files with 520 additions and 4 deletions
  1. 20 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/RestTemplateConfig.java
  2. 61 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/InspectionController.java
  3. 22 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/InspectionInterface.java
  4. 28 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/config/CardType.java
  5. 23 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/config/Category.java
  6. 18 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/config/InspectionApi.java
  7. 33 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/config/PatientNumType.java
  8. 6 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/config/ResponseMode.java
  9. 72 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/inspectionImpl/ThyyInspectionImpl.java
  10. 10 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/request/ReportDetailInquiry.java
  11. 15 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/request/ReportIndexInquiry.java
  12. 42 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/request/jy/JyIndexRequest.java
  13. 14 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/AntibioticItem.java
  14. 22 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/JyDetailBacterias.java
  15. 48 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/JyDetailItem.java
  16. 45 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/JyDetailOrder.java
  17. 12 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/JyDetailResponse.java
  18. 23 0
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/JyIndexResponse.java
  19. 1 4
      thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/tts/TtsController.java
  20. 5 0
      thyy-thirdpart-api/src/main/resources/application.yml

+ 20 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/RestTemplateConfig.java

@@ -0,0 +1,20 @@
+package org.thyy.thirdpartapi;
+
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+import java.time.Duration;
+
+@Configuration
+public class RestTemplateConfig {
+
+    @Bean
+    public RestTemplate restTemplate(RestTemplateBuilder builder) {
+        return builder
+                .connectTimeout(Duration.ofSeconds(3))
+                .readTimeout(Duration.ofSeconds(5))
+                .build();
+    }
+}

+ 61 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/InspectionController.java

@@ -0,0 +1,61 @@
+package org.thyy.thirdpartapi.inspection;
+
+import com.alibaba.fastjson2.JSONObject;
+import jakarta.annotation.PostConstruct;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.thyy.thirdpartapi.inspection.config.InspectionApi;
+import org.thyy.thirdpartapi.inspection.response.jy.JyDetailResponse;
+import org.thyy.thirdpartapi.inspection.response.jy.JyIndexResponse;
+import org.thyy.utils.result.R;
+import org.thyy.utils.result.ResultVo;
+
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/inspection")
+public class InspectionController {
+    private final Map<String, InspectionInterface> serviceMap;
+    private final InspectionApi inspectionApi;
+    private InspectionInterface service;
+
+    @Autowired
+    public InspectionController(Map<String, InspectionInterface> serviceMap, InspectionApi inspectionApi) {
+        this.serviceMap = serviceMap;
+        this.inspectionApi = inspectionApi;
+    }
+
+    @PostConstruct
+    public void init() {
+        for (Map.Entry<String, InspectionInterface> map : serviceMap.entrySet()) {
+            String key = map.getKey();
+            if (inspectionApi.getConfig() == null) {
+                return;
+            }
+            InspectionApi.Config config = inspectionApi.getConfig().get(key);
+            if (config != null) {
+                try {
+                    map.getValue().init(inspectionApi, config);
+                    service = map.getValue();
+                } catch (Exception ignore) {}
+                return;
+            }
+        }
+    }
+
+    @PostMapping("/queryExamIndex")
+    public ResultVo<List<JyIndexResponse>> queryExamIndex(@RequestBody JSONObject request) {
+        List<JyIndexResponse> list = service.queryExamIndex(request);
+        return R.ok(list);
+    }
+
+    @PostMapping("/queryExamDetail")
+    public ResultVo<JyDetailResponse> queryExamDetail(@RequestBody JSONObject request) {
+        JyDetailResponse response = service.queryExamDetail(request);
+        return R.ok(response);
+    }
+}

+ 22 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/InspectionInterface.java

@@ -0,0 +1,22 @@
+package org.thyy.thirdpartapi.inspection;
+
+import com.alibaba.fastjson2.JSONObject;
+import org.thyy.thirdpartapi.inspection.config.InspectionApi;
+import org.thyy.thirdpartapi.inspection.response.jy.JyDetailResponse;
+import org.thyy.thirdpartapi.inspection.response.jy.JyIndexResponse;
+
+import java.util.List;
+
+/**
+ * 查询检验结果
+ * */
+public interface InspectionInterface {
+
+    default void init(InspectionApi inspectionApi, InspectionApi.Config config) {
+
+    }
+
+    List<JyIndexResponse> queryExamIndex(JSONObject request);
+
+    JyDetailResponse queryExamDetail(JSONObject request);
+}

+ 28 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/config/CardType.java

@@ -0,0 +1,28 @@
+package org.thyy.thirdpartapi.inspection.config;
+
+public enum CardType {
+    /**
+     * 国家社保卡
+     */
+    SocialSecurityCard,
+
+    /**
+     * 居民健康卡
+     */
+    HealthCard,
+
+    /**
+     * 院内诊疗卡
+     */
+    MedicalCard,
+
+    /**
+     * 居民身份证
+     */
+    IDCard,
+
+    /**
+     * 未知(默认值)
+     */
+    Undefine
+}

+ 23 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/config/Category.java

@@ -0,0 +1,23 @@
+package org.thyy.thirdpartapi.inspection.config;
+
+public enum Category {
+    /**
+     * 检验
+     * */
+    JY,
+
+    /**
+     * 检查
+     * */
+    JC,
+
+    /**
+     * 病理
+     * */
+    BL,
+
+    /**
+     * 心电
+     * */
+    XD
+}

+ 18 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/config/InspectionApi.java

@@ -0,0 +1,18 @@
+package org.thyy.thirdpartapi.inspection.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "thyy.api.inspection")
+public class InspectionApi {
+    @Data
+    public static class Config {
+        private String jy;
+    }
+    private Map<String, Config> config;
+}

+ 33 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/config/PatientNumType.java

@@ -0,0 +1,33 @@
+package org.thyy.thirdpartapi.inspection.config;
+
+public enum PatientNumType {
+    /**
+     * 门诊号
+     * */
+    OutPatient,
+
+    /**
+     * 住院号
+     * */
+    InPatient,
+    
+    /**
+     * 验单号
+     * */
+    Lis,
+
+    /**
+     * 体检号
+     * */
+    Pis,
+
+    /**
+     * 婚检号
+     * */
+    Marry ,
+
+    /**
+     * 未知(默认值)
+     * */
+    None
+}

+ 6 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/config/ResponseMode.java

@@ -0,0 +1,6 @@
+package org.thyy.thirdpartapi.inspection.config;
+
+public enum ResponseMode {
+    Json,
+    Xml
+}

+ 72 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/inspectionImpl/ThyyInspectionImpl.java

@@ -0,0 +1,72 @@
+package org.thyy.thirdpartapi.inspection.inspectionImpl;
+
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+import org.thyy.thirdpartapi.inspection.InspectionInterface;
+import org.thyy.thirdpartapi.inspection.config.InspectionApi;
+import org.thyy.thirdpartapi.inspection.response.jy.JyDetailResponse;
+import org.thyy.thirdpartapi.inspection.response.jy.JyIndexResponse;
+import org.thyy.utils.exception.BizException;
+import org.thyy.utils.exception.ExceptionEnum;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+@Service(value = "csth")
+public class ThyyInspectionImpl implements InspectionInterface {
+    private String api;
+    private final RestTemplate restTemplate;
+
+    @Autowired
+    public ThyyInspectionImpl( RestTemplate restTemplate) {
+        this.restTemplate = restTemplate;
+    }
+
+    @Override
+    public void init(InspectionApi inspectionApi, InspectionApi.Config config) {
+        this.api = config.getJy();
+        log.info("检验检查模块初始化: {}", api);
+    }
+
+    @Override
+    public List<JyIndexResponse> queryExamIndex(JSONObject request) {
+        JSONObject response = restTemplate.postForObject(api + "/self", request, JSONObject.class);
+        if (null == response) {
+            throw new BizException(ExceptionEnum.NETWORK_ERROR);
+        }
+        Boolean code = response.getBoolean("code");
+        if (null == code || !code) {
+            throw new BizException(ExceptionEnum.API_ERROR, response.getString("message"));
+        }
+        JSONObject data = response.getJSONObject("data");
+        JSONArray items = data.getJSONArray("items");
+        List<JyIndexResponse> examIndexList = new ArrayList<>();
+        for (int i = 0; i < items.size(); i++) {
+            JSONObject item = items.getJSONObject(i);
+            String jsonString = item.toJSONString();
+            JyIndexResponse examIndexResponse = JSONObject.parseObject(jsonString, JyIndexResponse.class);
+            examIndexList.add(examIndexResponse);
+        }
+        return examIndexList;
+    }
+
+    @Override
+    public JyDetailResponse queryExamDetail(JSONObject request) {
+        JSONObject response = new RestTemplate().postForObject(
+                api + "/detail", request, JSONObject.class);
+        if (null == response) {
+            throw new BizException(ExceptionEnum.NETWORK_ERROR);
+        }
+        Boolean code = response.getBoolean("code");
+        if (null == code || !code) {
+            throw new BizException(ExceptionEnum.API_ERROR, response.getString("message"));
+        }
+        String data = response.getJSONObject("data").toJSONString();
+        return JSONObject.parseObject(data, JyDetailResponse.class);
+    }
+}

+ 10 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/request/ReportDetailInquiry.java

@@ -0,0 +1,10 @@
+package org.thyy.thirdpartapi.inspection.request;
+
+import lombok.Data;
+
+@Data
+public class ReportDetailInquiry {
+    private String reportId;
+    private String reportUrl;
+    private String patientId;
+}

+ 15 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/request/ReportIndexInquiry.java

@@ -0,0 +1,15 @@
+package org.thyy.thirdpartapi.inspection.request;
+
+import lombok.Data;
+import org.thyy.thirdpartapi.inspection.config.Category;
+import org.thyy.thirdpartapi.inspection.config.PatientNumType;
+
+@Data
+public class ReportIndexInquiry {
+    private PatientNumType patType;
+    private Category reportCategory;
+    private String patNo;
+    private String socialNo;
+    private String reqStartTime;
+    private String reqEndTime;
+}

+ 42 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/request/jy/JyIndexRequest.java

@@ -0,0 +1,42 @@
+package org.thyy.thirdpartapi.inspection.request.jy;
+
+import lombok.Data;
+import org.thyy.thirdpartapi.inspection.config.PatientNumType;
+
+@Data
+public class JyIndexRequest {
+    /**
+     * 卡类型,枚举值。
+     * 值域:
+     * SocialSecurityCard = 国家社保卡
+     * HealthCard = 居民健康卡
+     * MedicalCard = 院内诊疗卡
+     * IDCard = 居民身份证
+     * Undefine = 未知(默认值)
+     * */
+    private String cardType;
+    private String cardNo;
+    /**
+     * 患者病历号类别(对应检验网的验单录入界面的病历号类型),枚举值。
+     * 值域:
+     * OutPatient = 门诊号
+     * InPatient = 住院号
+     * Lis = 验单号
+     * Pis = 体检号
+     * Marry = 婚检号
+     * None = 未知(默认值)
+     * */
+    private PatientNumType patientNumType;
+    /**
+     * 对应 patientNumType 参数的具体号码
+     * */
+    private String patientNum;
+    /**
+     * 查询起始日期: yyyy-MM-dd
+     * */
+    private String startDate;
+    /**
+     * 查询截止日期: yyyy-MM-dd
+     * */
+    private String endDate;
+}

+ 14 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/AntibioticItem.java

@@ -0,0 +1,14 @@
+package org.thyy.thirdpartapi.inspection.response.jy;
+
+import lombok.Data;
+
+@Data
+public class AntibioticItem {
+    private Integer antiId;
+    private String antiNameUk;
+    private String antiNameCn;
+    private String antiAbb;
+    private String antiMic;
+    private String antiValue;
+    private String antiStr;
+}

+ 22 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/JyDetailBacterias.java

@@ -0,0 +1,22 @@
+package org.thyy.thirdpartapi.inspection.response.jy;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class JyDetailBacterias {
+    private Integer itmId;
+    private String itmCode;
+    private String itmName;
+    private Integer itmOrdr;
+    private String rsltStrs;
+    private Integer bacId;
+    private String bacNameUk;
+    private String bacNameCn;
+    private String bacAbb;
+    private String idenNo;
+    private Integer itmCalg;
+    private Integer testMthd;
+    private List<AntibioticItem> antiList;
+}

+ 48 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/JyDetailItem.java

@@ -0,0 +1,48 @@
+package org.thyy.thirdpartapi.inspection.response.jy;
+
+import lombok.Data;
+
+@Data
+public class JyDetailItem {
+    private Integer itmId;
+    private String itmCode;
+    private String itmName;
+    private String itmUnit;
+    private Integer itmOrdr;
+    private String itmValue;
+    private String itmSrcValue;
+    private Integer rsltListId;
+    private Integer rsltId;
+    private String rsltStrs;
+    private String itmStrValue;
+    private String itmStrSrcValue;
+    private Integer resType;
+    private Long itemSrcFlowId;
+    private Integer deflRsltId;
+    private String rsltName;
+    private String rangeLow;
+    private String rangeHigh;
+    private String range;
+    private Integer rangeRsltId;
+    private String ranGeStr;
+    private String itmAlert;
+    private String criticalLow;
+    private String criticalHigh;
+    private String critical;
+    private String criticalAlert;
+    private Integer calcType;
+    private String calcFomula;
+    private String calcFomulaItems;
+    private Integer decBit;
+    private Integer isNull;
+    private Integer isNum;
+    private Integer prntGrup;
+    private Integer otherFlagA;
+    private Integer otherFlagB;
+    private Integer otherFlagC;
+    private String mthdName;
+    private Integer criticalExecFlag;
+    private String criticalExecInfo;
+    private String criticalExecTime;
+    private String mapPisCode;
+}

+ 45 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/JyDetailOrder.java

@@ -0,0 +1,45 @@
+package org.thyy.thirdpartapi.inspection.response.jy;
+
+import lombok.Data;
+
+@Data
+public class JyDetailOrder {
+    private Integer ordrId;
+    private String aplyDate;
+    private String ordrCreateDate;
+    private String inspectTime;
+    private String signTime;
+    private String ordrDate;
+    private String audtTime;
+    private Integer prntStatus;
+    private String smplNum;
+    private String smplName;
+    private String aplyCntn;
+    private Integer testUsrId;
+    private String testUsrName;
+    private Integer ordrUsrId;
+    private String ordrUsrName;
+    private Integer audtUsrId;
+    private String audtUsrName;
+    private String aplyFlowNum;
+    private Integer emcyMrk;
+    private String deptName;
+    private String docName;
+    private String idCard;
+    private String icCard;
+    private String ptntNo;
+    private Integer ptntNoType;
+    private String ptntName;
+    private Integer ptntSex;
+    private String ptntAgeFirst;
+    private Integer ptntAgeSecond;
+    private String ptntAge;
+    private Integer ptntAgeUnit;
+    private String ptntBedNo;
+    private String diagInfo;
+    private String ctatAddr;
+    private String phoneNum;
+    private String ordrRemark;
+    private Integer sqncNum;
+    private String dvceName;
+}

+ 12 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/JyDetailResponse.java

@@ -0,0 +1,12 @@
+package org.thyy.thirdpartapi.inspection.response.jy;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class JyDetailResponse {
+    private JyDetailOrder order;
+    private List<JyDetailItem> items;
+    private List<JyDetailBacterias> bacterias;
+}

+ 23 - 0
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/inspection/response/jy/JyIndexResponse.java

@@ -0,0 +1,23 @@
+package org.thyy.thirdpartapi.inspection.response.jy;
+
+import lombok.Data;
+
+@Data
+public class JyIndexResponse {
+    private String reportId;
+    private String reportType;
+    private String icCard;
+    private String idCard;
+    private String patientNumType;
+    private String patientNum;
+    private String patientName;
+    private String patientGender;
+    private String patientAge;
+    private String departName;
+    private String doctorName;
+    private String sampleNum;
+    private String printStatus;
+    private String trscDate;
+    private String barCode;
+    private String examPurpose;
+}

+ 1 - 4
thyy-thirdpart-api/src/main/java/org/thyy/thirdpartapi/tts/TtsController.java

@@ -12,10 +12,9 @@ import org.thyy.utils.result.ResultVo;
 import java.util.Map;
 
 @RestController
-@RequestMapping("/xfTtsApi")
+@RequestMapping("/ttsApi")
 @Slf4j
 public class TtsController {
-
     private final Map<String, Tts> ttsServices;
     private final TtsConfig ttsConfig;
     private Tts ttsService;
@@ -37,7 +36,6 @@ public class TtsController {
                 try {
                     map.getValue().init(ttsConfig, config);
                     ttsService = map.getValue();
-
                 } catch (Exception e) {
                     log.error("语言合成错误", e);
                 }
@@ -46,7 +44,6 @@ public class TtsController {
         }
     }
 
-
     @PostMapping("/textToSpeech")
     public ResultVo<String> textToSpeech(@RequestBody TtsRequest request, HttpServletResponse response) {
         return ttsService.textToSpeech(request, response);

+ 5 - 0
thyy-thirdpart-api/src/main/resources/application.yml

@@ -15,3 +15,8 @@ thyy:
         app-id: fdde4cef
         api-key: 95a78dd3cfcc4863e3c003352ca8ec65
         api-secret: OWZjZGE4NjI3MDdkYzg4ZjllY2VjNGQ0
+  api:
+    inspection:
+      config:
+        csth:
+          jy: http://172.16.32.178/apis/third/report/query