jiangping
2024-01-25 aaea4819b873c5ca7b9be1a87af173ee2015a12a
server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -3,6 +3,7 @@
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.dao.business.model.Solutions;
import io.swagger.models.auth.In;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -13,6 +14,8 @@
import java.math.BigDecimal;
import java.net.URL;
import java.net.URLDecoder;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.Date;
import java.util.regex.Matcher;
@@ -145,6 +148,36 @@
        }
        return d.intValue();
    }
    public static long getAgeByIdCard(String idCard){
        int birthYear = Integer.parseInt(idCard.substring(6, 10));
        int birthMonth = Integer.parseInt(idCard.substring(10, 12));
        int birthDay = Integer.parseInt(idCard.substring(12, 14));
        LocalDate birthDate = LocalDate.of(birthYear, birthMonth, birthDay);
        LocalDate currentDate = LocalDate.now();
        long age = ChronoUnit.YEARS.between(birthDate, currentDate);
        return age;
    }
    public static Integer getSexByIdCard(String idCard){
        Pattern pattern = Pattern.compile("\\d{17}[\\d|x]"); // 定义身份证号码格式的正则表达式
        Matcher matcher = pattern.matcher(idCard);
        Integer sex = 1;
        if (matcher.matches()) {
            int genderCode = Integer.parseInt(idCard.substring(16, 17)); // 从第17位开始提取性别编码(奇数为男性,偶数为女性)
            if ((genderCode % 2 == 1)) {
                sex = 1;
            } else {
                sex = 2;
            }
        } else {
           sex = -1;
        }
        return sex;
    }
    /**
     * 状态 0已保存、1待审核、2审核通过、3退回修改、4审核驳回、5待服务机构确认、6服务机构拒绝、7已分配服务机构、8诊断中
     * (成功上传第一份服务资料)、9服务完成、10已分配评分专家、11已完成(专家上传评分) 12退回修改中 13 已完成退回修改
@@ -373,8 +406,9 @@
        BD_SIGNED_PDF(9, "签署后保单申请表PDF", "签署后保单申请表PDF"),
        COM_SING_IMG(10, "企业印章", "企业印章"),
        BD_DONE_PDF(11, "最终报单", "最终报单"),
        CA_PD_PDF(12, "最终报单", "最终报单"),
        CA_APPLY_JIAJIAN_SIGN(13, "加减保申请签章文件", "加减保申请签章文件"),
        CA_APPLY_CHANGEUNIT_SIGN(14, "换厂申请签章文件", "换厂申请签章文件"),
        ;
@@ -650,6 +684,9 @@
        CA_PALTFORM_REFUSE_APPLY(20, "驳回退回申请",""),
        CA_PALTFORM_EDIT_PIDAN(21, "修改批单","修改原因:${param}"),
        PALTFORM_EDIT_BD(22, "修改保单","修改原因:${param}"),
        CA_CHANGUNIT_APPLY_SIGN(24, "换成申请企业签章",""),
        CA_JIAJIAN_APPLY_SIGN(23, "加减保申请企业签章",""),
        ;
        // 成员变量
        private String name;