Browse Source

修复无号时也能缴费的bug

lighter 4 năm trước cách đây
mục cha
commit
828124e8d1

+ 1 - 1
pom.xml

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

+ 1 - 1
src/main/java/thyyxxk/wxservice_server/controller/AppointmentController.java

@@ -27,7 +27,7 @@ public class AppointmentController {
     }
 
     @GetMapping("/refreshMzClasses")
-    public ResultVo<List<MzClassPojo>> refreshMzClasses() {
+    public ResultVo<String> refreshMzClasses() {
         return service.refreshMzClasses();
     }
 

+ 6 - 3
src/main/java/thyyxxk/wxservice_server/dao/AppointmentDao.java

@@ -12,9 +12,9 @@ public interface AppointmentDao {
             "rtrim(b.name) doctorTitle, " +
             "rtrim(a.dept_code) deptCode, " +
             "deptName=(select rtrim(name) from zd_unit_code where code=a.dept_code), " +
-            "specialty=(select specialty from a_employee_comment where code=a.code), " +
-            "introduction=(select emp_comment from a_employee_comment where code=a.code), " +
-            "portrait=(select image_base64 from a_employee_image where code=a.code), " +
+            "a.specialty, " +
+            "a.introduction, " +
+            "a.portrait, " +
             "collected=(select count(1) from t_wechat_patient_collection where " +
             "doctor_code=#{doctorCode} and open_id=#{openId}) " +
             "from a_employee_mi a, zd_emp_title b " +
@@ -41,4 +41,7 @@ public interface AppointmentDao {
     @Update("update t_wechat_patient_bind set social_no=#{socialNo} where patient_id=#{patientId}")
     void updateWxBindSocialNo(@Param("patientId") String patientId,
                                @Param("socialNo") String socialNo);
+
+    @Select("select specialty from a_employee_mi where code=#{code}")
+    String selectSpecialty(@Param("code") String code);
 }

+ 22 - 7
src/main/java/thyyxxk/wxservice_server/service/AppointmentService.java

@@ -82,10 +82,10 @@ public class AppointmentService {
         getAllDepartments();
     }
 
-    public ResultVo<List<MzClassPojo>> refreshMzClasses() {
+    public ResultVo<String> refreshMzClasses() {
         log.info("门诊科室缓存已重置。");
         mzClasses = null;
-        return getAllDepartments();
+        return ResultVoUtil.success("门诊科室缓存已重置。");
     }
 
     public ResultVo<Integer[]> getSourcesByDate(GetSourcesByDateParam param) {
@@ -112,16 +112,27 @@ public class AppointmentService {
     public ResultVo<Object> getDoctorSources(GetDoctorSourcesParam param) {
         String url = String.format(ThmzUrls.GET_DOCTOR_BY_DATE_AND_DEPT +
                 "requestDay=%s&unitCode=%s", param.getDate(), param.getDeptCode());
-        return getFromHrgWhereErrorIsSlightly(url);
+        RestTemplate template = new RestTemplate();
+        SourcesRes data = template.getForObject(url, SourcesRes.class);
+        if (null == data || null == data.getResultCode()) {
+            return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
+        }
+        if (data.getResultCode() == -1) {
+            return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR, data.getResultMessage());
+        }
+        data.getData().removeIf(map -> (int) map.get("leftNum") == 0);
+        if (data.getData().size() == 0) {
+            return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR);
+        }
+        for (Map<String, Object> map : data.getData()) {
+            map.put("specialty", dao.selectSpecialty(map.get("doctorCode").toString()));
+        }
+        return ResultVoUtil.success(data.getData());
     }
 
     public ResultVo<Object> getDoctorArrangement(GetDoctorSourcesParam param) {
         String url = String.format(ThmzUrls.GET_REQUEST_BY_DATE_AND_DEPT_AND_DOCTOR +
                 "requestDay=%s&unitCode=%s&doctorCode=%s", param.getDate(), param.getDeptCode(), param.getDoctorCode());
-        return getFromHrgWhereErrorIsSlightly(url);
-    }
-
-    private ResultVo<Object> getFromHrgWhereErrorIsSlightly(String url) {
         RestTemplate template = new RestTemplate();
         SourcesRes data = template.getForObject(url, SourcesRes.class);
         if (null == data || null == data.getResultCode()) {
@@ -130,6 +141,10 @@ public class AppointmentService {
         if (data.getResultCode() == -1) {
             return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR, data.getResultMessage());
         }
+        data.getData().removeIf(map -> (int) map.get("leftNum") == 0);
+        if (data.getData().size() == 0) {
+            return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR);
+        }
         return ResultVoUtil.success(data.getData());
     }
 

+ 6 - 2
src/main/java/thyyxxk/wxservice_server/service/InspectionsService.java

@@ -79,7 +79,7 @@ public class InspectionsService {
     public CompletableFuture<ResultVo<List<ExamIndexResult>>> checkAllIndexBySocialNo(String socialNo) {
         SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
         Date date = new Date();
-        String start = df.format(date.getTime() - 315L * 24 * 60 * 60 * 1000);
+        String start = df.format(date.getTime() - 15L * 24 * 60 * 60 * 1000);
         String end = df.format(date);
         String xmlEnd = "<START_TIME>" + start + "</START_TIME><END_TIME>" + end + "</END_TIME></message>";
         List<String> tjNos = dao.selectTjNos(socialNo);
@@ -116,13 +116,17 @@ public class InspectionsService {
     private void recognitionCovidExam(List<ExamIndexResult> results, List<ExamIndexResult> list) {
         if (null != list) {
             for (ExamIndexResult index : list) {
-                if (index.getAPLY_CTNT().contains("新型冠状病毒") && index.getAPLY_CTNT().contains("核酸检测")) {
+                if (isCovidExam(index.getAPLY_CTNT())) {
                     results.add(index);
                 }
             }
         }
     }
 
+    private boolean isCovidExam(String name) {
+        return name.startsWith("新") && name.contains("冠") && name.endsWith("核酸检测");
+    }
+
     private int getMaxDaysOfOneMonth(int year, int month) {
         int day = 1;
         Calendar cal = Calendar.getInstance();