diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java index aa7a63c5..54909bb8 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java @@ -269,7 +269,7 @@ public class PatientInformationServiceImpl implements IPatientInformationService // log.debug("添加病人信息,patientInfoDto:{}", patientBaseInfoDto); // 如果患者没有输入身份证号则根据年龄自动生成 String idCard = patientBaseInfoDto.getIdCard(); - if (idCard == null || CommonConstants.Common.AREA_CODE.equals(idCard.substring(0, 6))) { + if (idCard == null || idCard.length() < 6 || CommonConstants.Common.AREA_CODE.equals(idCard.substring(0, 6))) { if (patientBaseInfoDto.getAge() != null) { idCard = IdCardUtil.generateIdByAge(patientBaseInfoDto.getAge()); patientBaseInfoDto.setIdCard(idCard);