Browse Source

添加查看检查报告功能

lighter 1 year ago
parent
commit
986420b203

+ 1 - 1
pom.xml

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

+ 2 - 2
src/main/java/thyyxxk/wxservice_server/config/exception/BizException.java

@@ -20,8 +20,8 @@ public class BizException extends RuntimeException {
         this.errorEnum = errorEnum;
     }
 
-    public BizException(ExceptionEnum errorEnum, Throwable cause) {
-        super(errorEnum.getMessage(), cause);
+    public BizException(ExceptionEnum errorEnum, String cause) {
+        super(errorEnum.getMessage(), new Throwable(cause));
         this.errorEnum = errorEnum;
     }
 

+ 4 - 4
src/main/java/thyyxxk/wxservice_server/config/exception/GlobalExceptionHandler.java

@@ -35,21 +35,21 @@ public class GlobalExceptionHandler {
     @ExceptionHandler(value = BizException.class)
     @ResponseBody
     public ResultVo<String> bizExceptionHandler(BizException e){
-        e.printStackTrace();
-        return ResultVoUtil.fail(e.getErrorEnum());
+        log.error("BizException异常:", e);
+        return ResultVoUtil.fail(e.getErrorEnum(), e.getCause().getMessage());
     }
 
     @ExceptionHandler(value = NullPointerException.class)
     @ResponseBody
     public ResultVo<String> exceptionHandler(NullPointerException e){
-        e.printStackTrace();
+        log.error("NullPointerException异常:", e);
         return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER);
     }
 
     @ExceptionHandler(value = Exception.class)
     @ResponseBody
     public ResultVo<String> exceptionHandler(Exception e){
-        e.printStackTrace();
+        log.error("Exception异常:", e);
         if (e.getCause().getMessage().contains(Constants.Exception.CONNECT_EXCEPTION)) {
             return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
         }

+ 15 - 3
src/main/java/thyyxxk/wxservice_server/controller/InspectionsController.java

@@ -3,11 +3,13 @@ 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.inspections.CheckExamParam;
-import thyyxxk.wxservice_server.entity.inspections.ExamIndexResult;
-import thyyxxk.wxservice_server.entity.inspections.QueryReportDetail;
+import thyyxxk.wxservice_server.entity.inspections.request.CheckExamParam;
+import thyyxxk.wxservice_server.entity.inspections.response.ExamIndexResult;
+import thyyxxk.wxservice_server.entity.inspections.request.QueryReportDetail;
 import thyyxxk.wxservice_server.entity.inspections.detail.ExamDetailResult;
+import thyyxxk.wxservice_server.entity.inspections.response.TestReport;
 import thyyxxk.wxservice_server.service.InspectionsService;
+import thyyxxk.wxservice_server.utils.ResultVoUtil;
 
 import java.util.List;
 
@@ -38,4 +40,14 @@ public class InspectionsController {
     public ResultVo<List<ExamIndexResult>> checkCovidExamIndexBySocialNo(@RequestParam("socialNo") String socialNo) {
         return inspectionsService.checkCovidExamIndexBySocialNo(socialNo);
     }
+
+    @PostMapping("/checkTestIndex")
+    public ResultVo<List<TestReport>> checkTestIndex(@RequestBody CheckExamParam param) {
+        return ResultVoUtil.success(inspectionsService.checkTestIndex(param));
+    }
+
+    @PostMapping("/checkTestDetail")
+    public ResultVo<TestReport> checkTestDetail(@RequestBody QueryReportDetail param) throws Exception {
+        return ResultVoUtil.success(inspectionsService.checkTestDetail(param));
+    }
 }

+ 11 - 0
src/main/java/thyyxxk/wxservice_server/dao/InspectionsDao.java

@@ -3,6 +3,8 @@ 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.entity.inspections.request.CheckExamParam;
+import thyyxxk.wxservice_server.entity.inspections.response.TestReport;
 
 import java.util.List;
 
@@ -34,4 +36,13 @@ public interface InspectionsDao {
 
     @Select("select count(1) from t_wechat_patient_bind where patient_id=#{patId} and openid=#{openid} and del_flag=0")
     int selectPatIdAndOpenidMatchCount(@Param("patId") String patId, @Param("openid") String openid);
+
+    @Select("select patient_uid,patient_name,examin_eparts,check_time from t_check_data " +
+            "where pat_no=#{patientId} and check_time>=#{start} and check_time<=#{end} ")
+    List<TestReport> selectTestReportIndex(CheckExamParam param);
+
+    @Select("select *, " +
+            "doctorName=(select top 1 rtrim(d.name) from a_employee_mi d where d.code_rs=doctor_code) " +
+            "from t_check_data where patient_uid=#{id}")
+    TestReport selectTestReport(String id);
 }

+ 1 - 1
src/main/java/thyyxxk/wxservice_server/entity/inspections/CheckExamParam.java → src/main/java/thyyxxk/wxservice_server/entity/inspections/request/CheckExamParam.java

@@ -1,4 +1,4 @@
-package thyyxxk.wxservice_server.entity.inspections;
+package thyyxxk.wxservice_server.entity.inspections.request;
 
 import lombok.Data;
 

+ 2 - 1
src/main/java/thyyxxk/wxservice_server/entity/inspections/QueryReportDetail.java → src/main/java/thyyxxk/wxservice_server/entity/inspections/request/QueryReportDetail.java

@@ -1,4 +1,4 @@
-package thyyxxk.wxservice_server.entity.inspections;
+package thyyxxk.wxservice_server.entity.inspections.request;
 
 import lombok.Data;
 
@@ -6,5 +6,6 @@ import lombok.Data;
 public class QueryReportDetail {
     private String openid;
     private String orderId;
+    private String patientUid;
     private String patientId;
 }

+ 1 - 1
src/main/java/thyyxxk/wxservice_server/entity/inspections/ExamIndexResult.java → src/main/java/thyyxxk/wxservice_server/entity/inspections/response/ExamIndexResult.java

@@ -1,4 +1,4 @@
-package thyyxxk.wxservice_server.entity.inspections;
+package thyyxxk.wxservice_server.entity.inspections.response;
 
 import lombok.Data;
 

+ 22 - 0
src/main/java/thyyxxk/wxservice_server/entity/inspections/response/TestReport.java

@@ -0,0 +1,22 @@
+package thyyxxk.wxservice_server.entity.inspections.response;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class TestReport {
+    private String patientUid;
+    private String patNo;
+    private Integer times;
+    private String patientName;
+    private String examinEparts;
+    private String examinationSee;
+    private String examinationreSult;
+    private String doctorCode;
+    private String doctorName;
+    private String checkDoctorCode;
+    private String checkDoctorName;
+    private Date checkTime;
+    private Date reportTime;
+}

+ 33 - 3
src/main/java/thyyxxk/wxservice_server/service/InspectionsService.java

@@ -7,14 +7,16 @@ import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import thyyxxk.wxservice_server.config.exception.BizException;
 import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
 import thyyxxk.wxservice_server.dao.InspectionsDao;
 import thyyxxk.wxservice_server.entity.ResultVo;
-import thyyxxk.wxservice_server.entity.inspections.CheckExamParam;
-import thyyxxk.wxservice_server.entity.inspections.ExamIndexResult;
+import thyyxxk.wxservice_server.entity.inspections.request.CheckExamParam;
+import thyyxxk.wxservice_server.entity.inspections.response.ExamIndexResult;
 import thyyxxk.wxservice_server.entity.inspections.HshjPatient;
-import thyyxxk.wxservice_server.entity.inspections.QueryReportDetail;
+import thyyxxk.wxservice_server.entity.inspections.request.QueryReportDetail;
 import thyyxxk.wxservice_server.entity.inspections.detail.*;
+import thyyxxk.wxservice_server.entity.inspections.response.TestReport;
 import thyyxxk.wxservice_server.factory.thmz.ThmzService;
 import thyyxxk.wxservice_server.utils.*;
 
@@ -216,4 +218,32 @@ public class InspectionsService {
             return null;
         }
     }
+
+    public List<TestReport> checkTestIndex(CheckExamParam param) {
+        param.setEnd(param.getEnd() + " 23:59:59");
+        return dao.selectTestReportIndex(param);
+    }
+
+    public TestReport checkTestDetail(QueryReportDetail param) throws Exception {
+        if (StringUtil.isBlank(param.getPatientUid())) {
+            throw new BizException(ExceptionEnum.NULL_POINTER, "报告ID不能为空!");
+        }
+        param.setOpenid(TokenUtil.getInstance().getUserOpenid());
+        int exist = dao.selectPatIdAndOpenidMatchCount(param.getPatientId(), param.getOpenid());
+        if (exist == 0) {
+            throw new BizException(ExceptionEnum.TOKEN_ERROR);
+        }
+        TestReport result = dao.selectTestReport(param.getPatientUid());
+        result.setExaminationSee(
+                result.getExaminationSee()
+                        .replaceAll("\r\n", "<br/>")
+                        .replaceAll("\n", "<br/>")
+        );
+        result.setExaminationreSult(
+                result.getExaminationreSult()
+                        .replaceAll("\r\n", "<br/>")
+                        .replaceAll("\n", "<br/>")
+        );
+        return result;
+    }
 }

+ 1 - 1
src/main/java/thyyxxk/wxservice_server/service/SoapInvokeService.java

@@ -6,7 +6,7 @@ import org.dom4j.DocumentException;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
 import org.springframework.stereotype.Service;
-import thyyxxk.wxservice_server.entity.inspections.ExamIndexResult;
+import thyyxxk.wxservice_server.entity.inspections.response.ExamIndexResult;
 import thyyxxk.wxservice_server.webservice.PushService;
 import thyyxxk.wxservice_server.webservice.PushServiceSoap;