| 
					
				 | 
			
			
				@ -233,12 +233,16 @@ public class ContactsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (4==operType){//一个月只能删除一次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Date updateTime = list.get(0).getUpdateTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                Long timeDiffer = DateUtil.timeDifference(new Date(),updateTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (timeDiffer<=(1000L*3600*24*30)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   Long day = timeDiffer/(1000L*3600*24)+1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                   result.put(ResponseContant.resultMsg,"您本月删除紧急联系人次数已使用,请"+day+"天后再试"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (null==updateTime){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    Long timeDiffer = DateUtil.timeDifference(new Date(),updateTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (timeDiffer<=(1000L*3600*24*30)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        Long day = (1000L*3600*24*30-timeDiffer)/(1000L*3600*24)+1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        result.put(ResponseContant.resultMsg,"您本月删除紧急联系人次数已使用,请"+day+"天后再试"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String[] numTmp = num.split("_"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String sql = " select pd.device_sn,wd.sim from  wlyy_patient_device pd inner join wlyy_devices wd  " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -255,17 +259,26 @@ public class ContactsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (1==operType){//新增联系人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            list = sosContactsDao.findByPatientAndDel(patient,1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Integer seqid=1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (list.size()>=2){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put(ResponseContant.resultFlag,ResponseContant.fail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                result.put(ResponseContant.resultMsg,"该用户紧急联系人已上线"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    seqid = list.get(0).getPhoneSeqid(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                PatientSosContactsDO contactsDO = new PatientSosContactsDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                list = sosContactsDao.findByPatientAndDel(patient,0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (list.size()>0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    contactsDO =list.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    contactsDO.setPhoneSeqid(1==seqid?2:1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                contactsDO.setDel(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                contactsDO.setPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                contactsDO.setSosName(name); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                contactsDO.setSosPhone(num); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -304,8 +317,9 @@ public class ContactsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (StringUtils.isNotBlank(del_num)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        String response = networkCardService.setPatientContacts(sim, null, null, "4", null, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (StringUtils.isNotBlank(response)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        String response = networkCardService.setPatientContacts(sim, null, null, "4", del_num, null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//                        if (StringUtils.isNotBlank(response)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (StringUtils.isNotBlank("111")) {//todo 对接时不做 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            String[] DelNums = del_num.split("_"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            for (String tmp:DelNums){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (!delSuccess.contains(tmp)){//本次已删除过 不再作删除操作 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -316,7 +330,7 @@ public class ContactsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    for (int i=0;i<aqgDeviceSosNum.size();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        JSONObject aqgTmp = aqgDeviceSosNum.getJSONObject(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        String aqgNum = aqgTmp.getString("num"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        if (aqgNum.equals("tmp")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        if (aqgNum.equals(tmp)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            numIndex = aqgTmp.getInteger("seqid"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -344,10 +358,10 @@ public class ContactsService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientSosContactsDO.setUpdateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientSosContactsDO.setDel(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (delSuccess.contains(num)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    patientSosContactsDO.setSuccessFlag(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    patientSosContactsDO.setSuccessFlag(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    patientSosContactsDO.setSuccessFlag(-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    patientSosContactsDO.setSuccessFlag(-2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                modify.add(patientSosContactsDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 |