|  | @ -93,6 +93,149 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private BasePatientService basePatientService;
 |  |     private BasePatientService basePatientService;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 初始化签约老人2
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public void initOldTmp2(){
 | 
												
													
														
															|  | 
 |  |         Map<String,String> lableCodeNameMap = new HashMap<>();
 | 
												
													
														
															|  | 
 |  |         lableCodeNameMap.put("3","独居");//独居
 | 
												
													
														
															|  | 
 |  |         lableCodeNameMap.put("4","孤寡");//孤寡
 | 
												
													
														
															|  | 
 |  |         String sql = "select * from old_tmp";
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  |         for (Map<String,Object> map:mapList){
 | 
												
													
														
															|  | 
 |  |             String name = (map.get("name")+"").trim();
 | 
												
													
														
															|  | 
 |  |             String idcard = (map.get("idcard")+"").trim();
 | 
												
													
														
															|  | 
 |  |             String area = (map.get("area")+"").trim();
 | 
												
													
														
															|  | 
 |  |             String address = (map.get("address")+"").trim();
 | 
												
													
														
															|  | 
 |  |             String mobile = (map.get("mobile")+"").trim();
 | 
												
													
														
															|  | 
 |  |             String type = (map.get("type")+"").trim();
 | 
												
													
														
															|  | 
 |  |             BasePatientDO patientDO = patientDao.findByIdcard(idcard);
 | 
												
													
														
															|  | 
 |  |             if(patientDO==null){
 | 
												
													
														
															|  | 
 |  |                 patientDO = new BasePatientDO();
 | 
												
													
														
															|  | 
 |  |             }else{
 | 
												
													
														
															|  | 
 |  |                 continue;
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             patientDO.setRegister("1");
 | 
												
													
														
															|  | 
 |  |             patientDO.setSaasId(area);
 | 
												
													
														
															|  | 
 |  |             String salt = UUID.randomUUID().toString().substring(0,5);
 | 
												
													
														
															|  | 
 |  |             patientDO.setPassword(MD5.md5Hex(idcard + "{" + salt + "}"));
 | 
												
													
														
															|  | 
 |  |             patientDO.setSalt(salt);
 | 
												
													
														
															|  | 
 |  |             patientDO.setOpenid(null);
 | 
												
													
														
															|  | 
 |  |             patientDO.setIdcard(idcard);
 | 
												
													
														
															|  | 
 |  |             patientDO.setSsc(null);
 | 
												
													
														
															|  | 
 |  |             patientDO.setMobile(mobile);
 | 
												
													
														
															|  | 
 |  |             patientDO.setSex(Integer.valueOf(IdCardUtil.getSexForIdcard_new(idcard)));
 | 
												
													
														
															|  | 
 |  |             patientDO.setName(name);
 | 
												
													
														
															|  | 
 |  |             patientDO.setArchiveType(1);
 | 
												
													
														
															|  | 
 |  |             patientDO.setArchiveStatus(1);
 | 
												
													
														
															|  | 
 |  |             if(patientDO.getSex()==2){
 | 
												
													
														
															|  | 
 |  |                 patientDO.setPhoto("group1/M00/00/7C/rBoAbmIu8g6ANMrpAAAiSDNDGrM907.png");
 | 
												
													
														
															|  | 
 |  |             }else{
 | 
												
													
														
															|  | 
 |  |                 patientDO.setPhoto("group1/M00/00/5A/rBoAb2Iu8gOAQ9WYAAAgcmCLvjQ782.png");
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             patientDO.setDel("1");
 | 
												
													
														
															|  | 
 |  |             patientDO.setLocked(0);
 | 
												
													
														
															|  | 
 |  |             patientDO.setEnabled(1);
 | 
												
													
														
															|  | 
 |  |             patientDO.setSignStatus(0);
 | 
												
													
														
															|  | 
 |  |             patientDO.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  |             patientDO.setAddress(address);
 | 
												
													
														
															|  | 
 |  |             Map<String,String> tmp = LatitudeUtils.getGeocoderLatitude(address);
 | 
												
													
														
															|  | 
 |  |             if(tmp!=null){
 | 
												
													
														
															|  | 
 |  |                 String latlon = tmp.get("lat")+","+tmp.get("lng");
 | 
												
													
														
															|  | 
 |  |                 patientDO.setLatLon(latlon);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             patientDao.save(patientDO);
 | 
												
													
														
															|  | 
 |  |             String label = lableCodeNameMap.get(type);
 | 
												
													
														
															|  | 
 |  |             if(StringUtils.isNotBlank(label)){
 | 
												
													
														
															|  | 
 |  |                 WlyyPatientLabelDO patientLabelDO = new WlyyPatientLabelDO();
 | 
												
													
														
															|  | 
 |  |                 patientLabelDO.setCzrq(new Date());
 | 
												
													
														
															|  | 
 |  |                 patientLabelDO.setLabelType("3");
 | 
												
													
														
															|  | 
 |  |                 patientLabelDO.setPatient(patientDO.getId());
 | 
												
													
														
															|  | 
 |  |                 patientLabelDO.setLabelCode(label);
 | 
												
													
														
															|  | 
 |  |                 patientLabelDO.setLabelName(lableCodeNameMap.get(label));
 | 
												
													
														
															|  | 
 |  |                 patientLabelDao.save(patientLabelDO);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             logger.info("idcard="+idcard);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 初始化签约老人
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public void initOldTmp(){
 | 
												
													
														
															|  | 
 |  |         Map<String,String> lableCodeNameMap = new HashMap<>();
 | 
												
													
														
															|  | 
 |  |         lableCodeNameMap.put("3","独居");//独居
 | 
												
													
														
															|  | 
 |  |         lableCodeNameMap.put("4","孤寡");//孤寡
 | 
												
													
														
															|  | 
 |  |         String sql = "select * from old_tmp";
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  |         for (Map<String,Object> map:mapList){
 | 
												
													
														
															|  | 
 |  |             String name = (map.get("name")+"").trim();
 | 
												
													
														
															|  | 
 |  |             String idcard = (map.get("idcard")+"").trim();
 | 
												
													
														
															|  | 
 |  |             String area = (map.get("area")+"").trim();
 | 
												
													
														
															|  | 
 |  |             String address = (map.get("address")+"").trim();
 | 
												
													
														
															|  | 
 |  |             String mobile = (map.get("mobile")+"").trim();
 | 
												
													
														
															|  | 
 |  |             String type = (map.get("type")+"").trim();
 | 
												
													
														
															|  | 
 |  |             BasePatientDO patientDO = patientDao.findByIdcard(idcard);
 | 
												
													
														
															|  | 
 |  |             if(patientDO!=null){
 | 
												
													
														
															|  | 
 |  |                 if(patientDO.getSignStatus()!=null&&patientDO.getSignStatus()==1){
 | 
												
													
														
															|  | 
 |  |                     logger.info("已签约居民idcard="+idcard);
 | 
												
													
														
															|  | 
 |  |                     continue;
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             }else{
 | 
												
													
														
															|  | 
 |  |                 patientDO = new BasePatientDO();
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             patientDO.setRegister("1");
 | 
												
													
														
															|  | 
 |  |             patientDO.setSaasId(area);
 | 
												
													
														
															|  | 
 |  |             boolean flag = false;
 | 
												
													
														
															|  | 
 |  |             if(StringUtils.isBlank(patientDO.getIdcard())){
 | 
												
													
														
															|  | 
 |  |                 String salt = UUID.randomUUID().toString().substring(0,5);
 | 
												
													
														
															|  | 
 |  |                 patientDO.setPassword(MD5.md5Hex(idcard + "{" + salt + "}"));
 | 
												
													
														
															|  | 
 |  |                 patientDO.setSalt(salt);
 | 
												
													
														
															|  | 
 |  |                 patientDO.setOpenid(null);
 | 
												
													
														
															|  | 
 |  |                 patientDO.setIdcard(idcard);
 | 
												
													
														
															|  | 
 |  |                 patientDO.setSsc(null);
 | 
												
													
														
															|  | 
 |  |                 patientDO.setMobile(mobile);
 | 
												
													
														
															|  | 
 |  |                 patientDO.setSex(Integer.valueOf(IdCardUtil.getSexForIdcard_new(idcard)));
 | 
												
													
														
															|  | 
 |  |                 patientDO.setName(name);
 | 
												
													
														
															|  | 
 |  |                 patientDO.setArchiveType(1);
 | 
												
													
														
															|  | 
 |  |                 patientDO.setArchiveStatus(1);
 | 
												
													
														
															|  | 
 |  |                 if(patientDO.getSex()==2){
 | 
												
													
														
															|  | 
 |  |                     patientDO.setPhoto("group1/M00/00/7C/rBoAbmIu8g6ANMrpAAAiSDNDGrM907.png");
 | 
												
													
														
															|  | 
 |  |                 }else{
 | 
												
													
														
															|  | 
 |  |                     patientDO.setPhoto("group1/M00/00/5A/rBoAb2Iu8gOAQ9WYAAAgcmCLvjQ782.png");
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |                 patientDO.setDel("1");
 | 
												
													
														
															|  | 
 |  |                 patientDO.setLocked(0);
 | 
												
													
														
															|  | 
 |  |                 patientDO.setEnabled(1);
 | 
												
													
														
															|  | 
 |  |                 patientDO.setSignStatus(0);
 | 
												
													
														
															|  | 
 |  |                 patientDO.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  |                 flag = true;
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             patientDO.setAddress(address);
 | 
												
													
														
															|  | 
 |  |             Map<String,String> tmp = LatitudeUtils.getGeocoderLatitude(address);
 | 
												
													
														
															|  | 
 |  |             if(tmp!=null){
 | 
												
													
														
															|  | 
 |  |                 String latlon = tmp.get("lat")+","+tmp.get("lng");
 | 
												
													
														
															|  | 
 |  |                 patientDO.setLatLon(latlon);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             patientDao.save(patientDO);
 | 
												
													
														
															|  | 
 |  |             if(flag){
 | 
												
													
														
															|  | 
 |  |                 String label = lableCodeNameMap.get(type);
 | 
												
													
														
															|  | 
 |  |                 if(StringUtils.isNotBlank(label)){
 | 
												
													
														
															|  | 
 |  |                     WlyyPatientLabelDO patientLabelDO = new WlyyPatientLabelDO();
 | 
												
													
														
															|  | 
 |  |                     patientLabelDO.setCzrq(new Date());
 | 
												
													
														
															|  | 
 |  |                     patientLabelDO.setLabelType("3");
 | 
												
													
														
															|  | 
 |  |                     patientLabelDO.setPatient(patientDO.getId());
 | 
												
													
														
															|  | 
 |  |                     patientLabelDO.setLabelCode(label);
 | 
												
													
														
															|  | 
 |  |                     patientLabelDO.setLabelName(lableCodeNameMap.get(label));
 | 
												
													
														
															|  | 
 |  |                     patientLabelDao.save(patientLabelDO);
 | 
												
													
														
															|  | 
 |  |                 }
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             logger.info("idcard="+idcard);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 初始化杭州老人,只保存有身份证且有手机号的数据
 |  |      * 初始化杭州老人,只保存有身份证且有手机号的数据
 | 
												
													
														
															|  |      */
 |  |      */
 |