Parcourir la source

在可挂号医生列表处添加医生头像。新增挂号校验:男性无法挂妇产科,成年人无法挂儿科。

lighter il y a 4 ans
Parent
commit
56e7f33c26

+ 1 - 1
pom.xml

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

+ 3 - 2
src/main/java/thyyxxk/wxservice_server/controller/AppointmentController.java

@@ -58,8 +58,9 @@ public class AppointmentController {
     }
 
     @GetMapping("/hasValidCovidAssessment")
-    public ResultVo<String> hasValidCovidAssessment(@RequestParam("patientId") String patientId) {
-        return service.hasValidCovidAssessment(patientId);
+    public ResultVo<String> hasValidCovidAssessment(@RequestParam("patientId") String patientId,
+                                                    @RequestParam("deptCode") String deptCode) {
+        return service.hasValidCovidAssessment(patientId, deptCode);
     }
 
     @PostMapping("/getSourcesByDateAndDoctor")

+ 9 - 2
src/main/java/thyyxxk/wxservice_server/dao/AppointmentDao.java

@@ -1,6 +1,7 @@
 package thyyxxk.wxservice_server.dao;
 
 import org.apache.ibatis.annotations.*;
+import thyyxxk.wxservice_server.pojo.PureCodeName;
 import thyyxxk.wxservice_server.pojo.assessment.CovidPojo;
 import thyyxxk.wxservice_server.pojo.appointment.DoctorInfoPojo;
 
@@ -28,6 +29,12 @@ public interface AppointmentDao {
             "datediff(day, date, getdate()) <= 3 order by date desc")
     CovidPojo validCovidAssessment(@Param("patientId") String patientId);
 
+    @Select("select isnull(sex,9) as code,isnull(social_no,'') as name from mz_patient_mi where patient_id=#{patientId}")
+    PureCodeName selectSexAndSocialNo(@Param("patientId") String patientId);
+
+    @Select("select rtrim(mz_class) from zd_unit_code where code=#{code}")
+    String selectMzClass(@Param("code") String code);
+
     @Select("select rtrim(code_rs) from a_employee_mi where code=#{code}")
     String getCodeRsByCode(@Param("code") String code);
 
@@ -42,6 +49,6 @@ public interface AppointmentDao {
     void updateWxBindSocialNo(@Param("patientId") String patientId,
                                @Param("socialNo") String socialNo);
 
-    @Select("select introduction from a_employee_mi where code=#{code}")
-    String selectIntroduction(@Param("code") String code);
+    @Select("select portrait as code,introduction as name from a_employee_mi where code=#{code}")
+    PureCodeName selectPortraitAndIntroduction(@Param("code") String code);
 }

+ 9 - 0
src/main/java/thyyxxk/wxservice_server/pojo/PureCodeName.java

@@ -0,0 +1,9 @@
+package thyyxxk.wxservice_server.pojo;
+
+import lombok.Data;
+
+@Data
+public class PureCodeName {
+    private String code;
+    private String name;
+}

+ 14 - 2
src/main/java/thyyxxk/wxservice_server/service/AppointmentService.java

@@ -9,12 +9,14 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.client.RestTemplate;
 import thyyxxk.wxservice_server.config.exception.ExceptionEnum;
 import thyyxxk.wxservice_server.dao.AppointmentDao;
+import thyyxxk.wxservice_server.pojo.PureCodeName;
 import thyyxxk.wxservice_server.pojo.ResultVo;
 import thyyxxk.wxservice_server.pojo.appointment.*;
 import thyyxxk.wxservice_server.pojo.assessment.CovidPojo;
 import thyyxxk.wxservice_server.pojo.hrgresponse.SourcesRes;
 import thyyxxk.wxservice_server.pojo.hrgresponse.GhFeeRes;
 import thyyxxk.wxservice_server.pojo.hrgresponse.MzClassRes;
+import thyyxxk.wxservice_server.utils.DateUtil;
 import thyyxxk.wxservice_server.utils.PropertiesUtil;
 import thyyxxk.wxservice_server.utils.ResultVoUtil;
 import thyyxxk.wxservice_server.utils.ThmzUrls;
@@ -125,7 +127,9 @@ public class AppointmentService {
             return ResultVoUtil.fail(ExceptionEnum.SLIGHTLY_ERROR);
         }
         for (Map<String, Object> map : data.getData()) {
-            map.put("introduction", dao.selectIntroduction(map.get("doctorCode").toString()));
+            PureCodeName info = dao.selectPortraitAndIntroduction(map.get("doctorCode").toString());
+            map.put("portrait", info.getCode());
+            map.put("introduction", info.getName());
         }
         return ResultVoUtil.success(data.getData());
     }
@@ -189,7 +193,15 @@ public class AppointmentService {
         return CompletableFuture.completedFuture(ResultVoUtil.success(source));
     }
 
-    public ResultVo<String> hasValidCovidAssessment(String patientId) {
+    public ResultVo<String> hasValidCovidAssessment(String patientId, String deptCode) {
+        PureCodeName sexSocial = dao.selectSexAndSocialNo(patientId);
+        String mzClass = dao.selectMzClass(deptCode);
+        if (sexSocial.getCode().equals("1") && mzClass.equals("03")) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "男性无法在妇产科挂号,请选择其他科室。");
+        }
+        if (deptCode.equals("1040000") && DateUtil.getAgeBySocialNo(sexSocial.getName()) >= 18) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "成年人无法在儿科挂号,请选择其他科室。");
+        }
         CovidPojo covid = dao.validCovidAssessment(patientId);
         if (null == covid) {
             return ResultVoUtil.success("no valid assessment");

+ 34 - 0
src/main/java/thyyxxk/wxservice_server/utils/DateUtil.java

@@ -11,4 +11,38 @@ public class DateUtil {
         SimpleDateFormat sdf = new SimpleDateFormat(pattern);
         return sdf.format(date);
     }
+
+    public static int getAgeBySocialNo(String socialNo) {
+        if (socialNo.startsWith("K") || socialNo.length() != 18) {
+            return 0;
+        }
+        String birthDay = socialNo.substring(6, 14);
+        String time = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
+        String yearStr = time.split("-")[0];
+        String monthStr = time.split("-")[1];
+        String dayStr = time.split("-")[2];
+        String yearBirthStr = birthDay.substring(0, 4);
+        String monthBirthStr = birthDay.substring(4, 6);
+        String dayBirthStr = birthDay.substring(6);
+        int year = Integer.parseInt(yearStr);
+        int yearBirth = Integer.parseInt(yearBirthStr);
+        if (year - yearBirth <= 0) {
+            return 0;
+        }
+        int age = year - yearBirth;
+        int month = Integer.parseInt(monthStr);
+        int monthBirth = Integer.parseInt(monthBirthStr);
+        if (month - monthBirth > 0) {
+            return age;
+        }
+        if (month - monthBirth < 0) {
+            return --age;
+        }
+        int day = Integer.parseInt(dayStr);
+        int dayBirth = Integer.parseInt(dayBirthStr);
+        if (day - dayBirth >= 0) {
+            return age;
+        }
+        return --age;
+    }
 }

+ 1 - 1
src/main/resources/application-prod.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8085
+  port: 8083
   servlet:
     context-path: /wxserver
 spring: