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..29ebb13231 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,9 @@ 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(); + } + } diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.60__alter_ic_epidemic_special_attention.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.60__alter_ic_epidemic_special_attention.sql new file mode 100644 index 0000000000..6a34b24ec5 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.60__alter_ic_epidemic_special_attention.sql @@ -0,0 +1,3 @@ + +ALTER TABLE `ic_epidemic_special_attention` + MODIFY COLUMN `MOBILE` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号'; 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..08088612bb 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 concat(a.pids,':',#{orgId}) 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 concat(a.pids,':',#{orgId}) like concat('%',#{orgId},'%') AND a.ATTENTION_TYPE = #{attentionType} AND a.`NAME` LIKE CONCAT('%',#{name},'%')