| | |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.vos.BcDictionaryVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationMajorExcelVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationMajorMistakeExcelVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationMistakeExcelVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngPopulationRehabilitationMistakeExcelVO; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.utlis.ListUtils; |
| | | import com.panzhihua.common.utlis.PayUtil; |
| | |
| | | log.info("开始导入重精人员数据"); |
| | | log.info("表格总数据:" + list.size()); |
| | | if (list.size() == 0) { |
| | | throw new ServiceException("500", "导入数据为空!"); |
| | | throw new ServiceException("000", "导入数据为空!"); |
| | | } |
| | | ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue(); |
| | | String key = Constants.MAJOR_POPULATION_ERROR_LIST + communityId; |
| | | String key = Constants.MAJOR_POPULATION_ERROR_LIST; |
| | | |
| | | Map<String,String> dictMap = dictionaryR.getData().stream().collect(Collectors.toMap(BcDictionaryVO::getDictName,BcDictionaryVO::getDictValue)); |
| | | // Map<String,Integer> dictMap = new HashMap<>(); |
| | |
| | | vo.setSerialNumber(oneData.get(0)); |
| | | } |
| | | //姓名和身份证都为空,为空户,无需操作,否则就解析年龄,性别,出生年月日 |
| | | if(StringUtils.isNotEmpty(oneData.get(1)) || StringUtils.isNotEmpty(oneData.get(2))){ |
| | | if(StringUtils.isEmpty(oneData.get(1))){ |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | index++; |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("名字不可为空,请填写姓名"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | vo.setName(oneData.get(1)); |
| | | if(StringUtils.isEmpty(oneData.get(2))){ |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | index++; |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("身份证号不可为空,请填写身份证"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | if(StringUtils.isEmpty(oneData.get(1))){ |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | index++; |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("名字不可为空,请填写姓名"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | vo.setName(oneData.get(1)); |
| | | if(StringUtils.isEmpty(oneData.get(2))){ |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | index++; |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("身份证号不可为空,请填写身份证"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | |
| | | //判断身份证号码位数 |
| | | if(oneData.get(2).length() != 18){ |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | index++; |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("身份证号位数有误,请检查身份证号码是否正确"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | vo.setCardNo(oneData.get(2).toUpperCase()); |
| | | //根据身份证号码解析年龄以及性别 |
| | | //获取用户生日 |
| | | String birthday = vo.getCardNo().substring(6, 14); |
| | | if(StringUtils.isNotEmpty(birthday)){ |
| | | String year = birthday.substring(0,4); |
| | | String month = birthday.substring(4,6); |
| | | String day = birthday.substring(6,8); |
| | | vo.setBirthday(year + "-" + month + "-" + day); |
| | | } |
| | | //判断身份证号码位数 |
| | | if(oneData.get(2).length() != 18){ |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | index++; |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("身份证号位数有误,请检查身份证号码是否正确"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | vo.setCardNo(oneData.get(2).toUpperCase()); |
| | | //根据身份证号码解析年龄以及性别 |
| | | //获取用户生日 |
| | | String birthday = vo.getCardNo().substring(6, 14); |
| | | if(StringUtils.isNotEmpty(birthday)){ |
| | | String year = birthday.substring(0,4); |
| | | String month = birthday.substring(4,6); |
| | | String day = birthday.substring(6,8); |
| | | vo.setBirthday(year + "-" + month + "-" + day); |
| | | } |
| | | // //设置用户年龄 |
| | | // vo.setAge(AgeUtils.getAgeFromBirthTime(birthday)); |
| | | //获取用户性别 |
| | | int sex = Integer.parseInt(vo.getCardNo().substring(16, 17)); |
| | | if(sex%2 == 1){ |
| | | vo.setSex(PopulSexEnum.nan.getCode()); |
| | | }else{ |
| | | vo.setSex(PopulSexEnum.nv.getCode()); |
| | | } |
| | | //获取用户性别 |
| | | int sex = Integer.parseInt(vo.getCardNo().substring(16, 17)); |
| | | if(sex%2 == 1){ |
| | | vo.setSex(PopulSexEnum.nan.getCode()); |
| | | }else{ |
| | | vo.setSex(PopulSexEnum.nv.getCode()); |
| | | } |
| | | |
| | | if(StringUtils.isEmpty(oneData.get(3))){ |
| | | index++; |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | |
| | | continue; |
| | | } |
| | | vo.setDoorNo(oneData.get(4).trim()); |
| | | if(StringUtils.isEmpty(oneData.get(5))){ |
| | | index++; |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("楼排号不可为空"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | // if(StringUtils.isEmpty(oneData.get(5))){ |
| | | // index++; |
| | | // ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | // setMistake(oneData, mistake); |
| | | // mistake.setMistake("楼排号不可为空"); |
| | | // mistakes.add(mistake); |
| | | // continue; |
| | | // } |
| | | if(StringUtils.isNotEmpty(oneData.get(5))) { |
| | | vo.setFloor(oneData.get(5).trim()); |
| | | } |
| | | vo.setFloor(oneData.get(5).trim()); |
| | | if(StringUtils.isEmpty(oneData.get(6))){ |
| | | index++; |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("单元号不可为空"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | // if(StringUtils.isEmpty(oneData.get(6))){ |
| | | // index++; |
| | | // ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | // setMistake(oneData, mistake); |
| | | // mistake.setMistake("单元号不可为空"); |
| | | // mistakes.add(mistake); |
| | | // continue; |
| | | // } |
| | | if(StringUtils.isNotEmpty(oneData.get(6))) { |
| | | vo.setUnitNo(oneData.get(6).trim()); |
| | | } |
| | | vo.setUnitNo(oneData.get(6).trim()); |
| | | if(StringUtils.isEmpty(oneData.get(7))){ |
| | | index++; |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("户室不可为空"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | // if(StringUtils.isEmpty(oneData.get(7))){ |
| | | // index++; |
| | | // ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | // setMistake(oneData, mistake); |
| | | // mistake.setMistake("户室不可为空"); |
| | | // mistakes.add(mistake); |
| | | // continue; |
| | | // } |
| | | if(StringUtils.isNotEmpty(oneData.get(7))) { |
| | | vo.setHouseNo(oneData.get(7).trim()); |
| | | } |
| | | vo.setHouseNo(oneData.get(7).trim()); |
| | | if(StringUtils.isNotEmpty(oneData.get(8))){ |
| | | Integer isOk = PopulHouseUseEnum.getCodeByName(oneData.get(8)); |
| | | if(isOk.equals(-1)){ |
| | |
| | | vo.setEconomicCondition(oneData.get(15).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(16))){ |
| | | vo.setGuarDian(oneData.get(16).trim()); |
| | | vo.setPersonType(oneData.get(16).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(17))){ |
| | | vo.setGuarDianPhone(oneData.get(17).trim()); |
| | | vo.setFamilySituation(oneData.get(17).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(18))){ |
| | | Integer isOk = PopulRelationEnum.getCodeByName(oneData.get(18)); |
| | | vo.setCustodyPerson(oneData.get(18).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(19))){ |
| | | Integer isOk = PopulRelationEnum.getCodeByName(oneData.get(19)); |
| | | if(isOk.equals(-1)){ |
| | | index++; |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("您填写的与患者关系有误"); |
| | | mistake.setMistake("您填写的与监护人关系有误"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | vo.setPatientRelation(isOk); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(19))){ |
| | | vo.setDiagnose(oneData.get(19).trim()); |
| | | vo.setCustodyRelation(isOk); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(20))){ |
| | | vo.setOther(oneData.get(20).trim()); |
| | | vo.setCustodyCardNo(oneData.get(20).trim()); |
| | | } |
| | | vo.getUserTagStr().add("重精人员"); |
| | | for (int i = 21; i < headSize; i++) { |
| | | if(StringUtils.isNotEmpty(oneData.get(21))){ |
| | | vo.setCustodyPersonPhone(oneData.get(21).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(22))){ |
| | | vo.setCustodyAddress(oneData.get(22).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(23))){ |
| | | vo.setHelpPerson(oneData.get(23).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(24))){ |
| | | vo.setHelpPersonPhone(oneData.get(24).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(25))){ |
| | | vo.setHelpMethod(oneData.get(25).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(26))){ |
| | | vo.setHelpSituation(oneData.get(26).trim()); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(27))){ |
| | | Integer isOk = PopulHouseUseEnum.getCodeByName(oneData.get(27)); |
| | | if(isOk.equals(-1)){ |
| | | ComMngPopulationMajorMistakeExcelVO mistake = new ComMngPopulationMajorMistakeExcelVO(); |
| | | index++; |
| | | setMistake(oneData, mistake); |
| | | mistake.setMistake("您填写的是否违法犯罪有误"); |
| | | mistakes.add(mistake); |
| | | continue; |
| | | } |
| | | vo.setIsCrime(isOk); |
| | | }else { |
| | | vo.setIsCrime(PopulHouseUseEnum.getCodeByName("否")); |
| | | } |
| | | if(StringUtils.isNotEmpty(oneData.get(28))){ |
| | | vo.setCrimeSutiation(oneData.get(28).trim()); |
| | | } |
| | | vo.getUserTagStr().add("精神障碍患者"); |
| | | for (int i = 29; i < headSize; i++) { |
| | | if (oneData.get(i) != null && oneData.get(i).equals("是")) { |
| | | vo.getUserTagStr().add(headData.get(i).substring(0,headData.get(i).indexOf("("))); |
| | | } |
| | |
| | | vo.setCensusRegister(map.get(13)); |
| | | vo.setCultureLevel(map.get(14)); |
| | | vo.setEconomicCondition(map.get(15)); |
| | | vo.setGuarDian(map.get(16)); |
| | | vo.setGuarDianPhone(map.get(17)); |
| | | vo.setPatientRelation(map.get(18)); |
| | | vo.setDiagnose(map.get(19)); |
| | | vo.setOther(map.get(20)); |
| | | vo.setPersonType(map.get(16)); |
| | | vo.setFamilySituation(map.get(17)); |
| | | vo.setCustodyPerson(map.get(18)); |
| | | vo.setCustodyRelation(map.get(19)); |
| | | vo.setCustodyCardNo(map.get(20)); |
| | | vo.setCustodyPersonPhone(map.get(21)); |
| | | vo.setCustodyAddress(map.get(22)); |
| | | vo.setHelpPerson(map.get(23)); |
| | | vo.setHelpPersonPhone(map.get(24)); |
| | | vo.setHelpMethod(map.get(25)); |
| | | vo.setHelpSituation(map.get(26)); |
| | | vo.setIsCrime(map.get(27)); |
| | | vo.setCrimeSutiation(map.get(28)); |
| | | } |
| | | |
| | | private String convertMarriage(String ma) { |