From a6cabe556645a8dd6a40304df13a6800add5dfed Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 8 Jul 2022 17:30:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E6=B3=A8=E5=90=8D=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=BB=84=E7=BB=87=E8=8C=83=E5=9B=B4=E6=94=B9=E6=88=90?= =?UTF-8?q?=E6=9C=AC=E7=BA=A7=E5=8F=8A=E4=BB=A5=E4=B8=8B=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=B2=A1=E6=89=8B=E6=9C=BA=E5=8F=B7=E4=B8=8D=E5=81=9A?= =?UTF-8?q?=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/IcEpidemicSpecialAttentionDTO.java | 2 +- .../dto/result/VaccinationListResultDTO.java | 36 ++++++++++++++----- .../mapper/IcEpidemicSpecialAttentionDao.xml | 4 +-- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java index ef59cb992b..9b2a5274b6 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcEpidemicSpecialAttentionDTO.java @@ -70,7 +70,7 @@ public class IcEpidemicSpecialAttentionDTO implements Serializable { /** * 手机号 */ - @NotBlank(message = "mobile不能为空",groups = IcEpidemicSpecialAttentionAdd.class) +// @NotBlank(message = "mobile不能为空",groups = IcEpidemicSpecialAttentionAdd.class) private String mobile; /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java index 63d56ebac2..e4e34c26ff 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java @@ -5,6 +5,7 @@ import lombok.Data; import org.apache.commons.lang3.StringUtils; import java.io.Serializable; +import java.util.regex.Pattern; /** * @Author zxc @@ -118,16 +119,26 @@ public class VaccinationListResultDTO implements Serializable { this.sex = "未知"; }else { if (this.idCard.length() == NumConstant.FIFTEEN){ - if (Integer.parseInt(this.idCard.substring(NumConstant.FOURTEEN, NumConstant.FIFTEEN)) % NumConstant.TWO == NumConstant.ZERO) { - sex = "女"; - } else { - sex = "男"; + String substring = this.idCard.substring(NumConstant.FOURTEEN, NumConstant.FIFTEEN); + if (!isNumeric2(substring)){ + this.sex = "未知"; + }else { + if (Integer.parseInt(substring) % NumConstant.TWO == NumConstant.ZERO) { + sex = "女"; + } else { + sex = "男"; + } } }else if (this.idCard.length() == NumConstant.EIGHTEEN){ - if (Integer.parseInt(this.idCard.substring(NumConstant.SIXTEEN).substring(NumConstant.ZERO,NumConstant.ONE)) % NumConstant.TWO == NumConstant.ZERO) { - sex = "女"; - } else { - sex = "男"; + String substring = this.idCard.substring(NumConstant.SIXTEEN).substring(NumConstant.ZERO, NumConstant.ONE); + if (!isNumeric2(substring)){ + this.sex = "未知"; + }else { + if (Integer.parseInt(substring) % NumConstant.TWO == NumConstant.ZERO) { + sex = "女"; + } else { + sex = "男"; + } } }else { this.sex = "未知"; @@ -135,4 +146,13 @@ public class VaccinationListResultDTO implements Serializable { } } + private static final Pattern NUMBER_PATTERN = Pattern.compile("-?\\d+(\\.\\d+)?"); + public static boolean isNumeric2(String str) { + return str != null && NUMBER_PATTERN.matcher(str).matches(); + } + + public static void main(String[] args) { + System.out.println(isNumeric2("1")); + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml index 778ece8433..fcadba645e 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml @@ -36,7 +36,7 @@ LEFT JOIN ic_resi_user b ON a.id_card = b.id_card AND b.del_flag = '0' and b.CUSTOMER_ID=a.CUSTOMER_ID LEFT JOIN (SELECT id_card , CUSTOMER_ID, count(1) AS vaccinationCount, CREATED_TIME FROM ic_vaccine WHERE DEL_FLAG = 0 GROUP BY ID_CARD, CUSTOMER_ID) v ON (v.ID_CARD = a.ID_CARD and v.CUSTOMER_ID=a.CUSTOMER_ID) WHERE a.DEL_FLAG = 0 - AND a.ORG_ID = #{orgId} + AND a.pids like concat('%',#{orgId},'%') AND a.ATTENTION_TYPE = #{attentionType} AND a.`NAME` LIKE CONCAT('%',#{name},'%') @@ -87,7 +87,7 @@ FROM ic_epidemic_special_attention a LEFT JOIN ic_resi_user b ON a.id_card = b.id_card AND b.del_flag = '0' and a.CUSTOMER_ID = b.CUSTOMER_ID WHERE a.DEL_FLAG = 0 - AND a.ORG_ID = #{orgId} + AND a.pids like concat('%',#{orgId},'%') AND a.ATTENTION_TYPE = #{attentionType} AND a.`NAME` LIKE CONCAT('%',#{name},'%')