| 
					
				 | 
			
			
				@ -9,10 +9,13 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.followup.Followup; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.followup.FollowupContent; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.patient.Patient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.patient.SignFamily; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.dict.SystemDictDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.doctor.DoctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.followup.FollowupContentDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.patient.PatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.patient.SignFamilyDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.service.app.team.DrHealthTeamService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.service.system.SystemDictService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.task.FollowupUploadTask; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.util.DateUtil; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -55,6 +58,12 @@ public class FollowUpService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					private ObjectMapper objectMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					private SignFamilyDao signFamilyDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					private DrHealthTeamService drHealthTeamService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * 转译随访信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -400,26 +409,6 @@ public class FollowUpService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * 获取上次随访项目数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					public Map<String,String> getLastFollowupProjectData(String doctor,String patient,String followupProject) throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						Map<String,String> re = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						Followup lastFollowup = followupDao.findLastFollowup(doctor,patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if(lastFollowup!=null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							List<FollowupContent> dataList =  followupContentDao.findByFollowupIdAndFollowupProject(lastFollowup.getId(),followupProject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							for(FollowupContent item:dataList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								re.put(item.getFollowupKey(),item.getFollowupValue()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return re; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 *保存面访项目数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 */ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -484,4 +473,90 @@ public class FollowUpService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					/*************************************** 上次随访 ********************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * 获取团队医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					private List<Doctor>  getTeamDoctors(String doctor,String patient) throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						List<Doctor> doctors = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						//获取医生团队成员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						SignFamily signFamily = signFamilyDao.findByFamilyDoctorAndPatient(doctor, patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 查询家庭医生团队 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if (signFamily != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							doctors = drHealthTeamService.findTeamDoctors(signFamily.getTeamCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 查询三师团队医生 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if (doctors == null || doctors.size() == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							SignFamily sanshiSign = signFamilyDao.findBySanshiDoctorAndPatient(doctor, patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							if (sanshiSign != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								doctors = drHealthTeamService.findTeamDoctors(patient, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								doctors = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return doctors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * 获取上次随访 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					public Map<String,String> getLastFollowup(String doctor,String patient,String followClass) throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						Map<String,String> re = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						//获取医生团队成员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						String[] doctors = new String[]{doctor}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						List<Doctor> doctorList = getTeamDoctors(doctor,patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if(doctorList!=null&& doctorList.size()>1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							doctors = new String[doctorList.size()]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							for(int i=0;i<doctorList.size();i++) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								doctors[i] = doctorList.get(i).getCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						//获取最新的随访记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						Followup followup = followupDao.findLastFollowup(doctors,patient,followClass); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if(followup!=null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							re.put("id",String.valueOf(followup.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							re.put("followupDate",DateUtil.dateToStrShort(followup.getFollowupDate())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							re = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return re; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * 获取上次随访 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					public void copyFollowup(Long id,Long fromId) throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						List<FollowupContent> list = followupContentDao.findByFollowupId(fromId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if(list!=null && list.size()>0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							List<FollowupContent> copyList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							for (FollowupContent item :list) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								FollowupContent copyItem = new FollowupContent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								copyItem.setFollowupId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								copyItem.setFollowupKey(item.getFollowupKey()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								copyItem.setFollowupValue(item.getFollowupKey()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								copyItem.setFollowupProject(item.getFollowupProject()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								copyItem.setCreateTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								copyList.add(copyItem); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							followupContentDao.save(copyList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |