فهرست منبع

身份证不合法时提示患者进行修改。

lighter 4 سال پیش
والد
کامیت
8de63693bc

+ 1 - 1
src/main/java/thyyxxk/wxservice_server/dao/AppointmentDao.java

@@ -29,7 +29,7 @@ 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}")
+    @Select("select isnull(sex,9) as code,rtrim(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}")

+ 6 - 1
src/main/java/thyyxxk/wxservice_server/service/AppointmentService.java

@@ -198,7 +198,12 @@ public class AppointmentService {
         if (sexSocial.getCode().equals("1") && mzClass.equals("03")) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "男性无法在妇产科挂号,请选择其他科室。");
         }
-        if (deptCode.equals("1040000") && IdCardUtil.calAgeBySocialNo(sexSocial.getName()) >= 18) {
+        int age = IdCardUtil.calAgeBySocialNo(sexSocial.getName());
+        if (age == -1) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您在我院绑定的身份证号不是有效的身份证号," +
+                    "请前往【个人中心 - 我的就诊人 - 就诊人信息】进行修改。");
+        }
+        if (deptCode.equals("1040000") && age >= 18) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "成年人无法在儿科挂号,请选择其他科室。");
         }
         CovidPojo covid = dao.validCovidAssessment(patientId);

+ 4 - 0
src/main/java/thyyxxk/wxservice_server/service/CovidVaccinateAppointmentService.java

@@ -53,6 +53,10 @@ public class CovidVaccinateAppointmentService {
     public ResultVo<String> submitVaccinateAppointment(VaccinatePojo param) {
         param.setCreateDatetime(new Date());
         int age = IdCardUtil.calAgeBySocialNo(param.getSocialNo());
+        if (age == -1) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "您在我院绑定的身份证号不是有效的身份证号," +
+                    "请前往【个人中心 - 我的就诊人 - 就诊人信息】进行修改。");
+        }
         if (age < 18 || age > 59) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "可接种的年龄区间为【18岁 - 59岁】," +
                     "您的年龄不满足此条件,敬请谅解。");

+ 2 - 2
src/main/java/thyyxxk/wxservice_server/utils/IdCardUtil.java

@@ -199,8 +199,8 @@ public class IdCardUtil {
      * 根据身份证号计算年龄
      * */
     public static int calAgeBySocialNo(String idCard) {
-        if (idCard.startsWith("K") || idCard.length() != 18) {
-            return 0;
+        if (null == idCard || idCard.startsWith("K") || idCard.length() != 18 || idCard.contains("-")) {
+            return -1;
         }
         String birthDay = idCard.substring(6, 14);
         String time = new SimpleDateFormat("yyyy-MM-dd").format(new Date());