| 
					
				 | 
			
			
				@ -1,10 +1,13 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.wlyy.service.specialist.rehabilitation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.doctor.profile.Doctor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.patient.Patient; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.entity.patient.SignFamily; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.doctor.DoctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.patient.PatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.repository.patient.SignFamilyDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.service.BaseService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.util.IdCardUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.util.http.HttpResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.wlyy.util.http.HttpUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.collections.map.HashedMap; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -33,6 +36,8 @@ public class RehabilitationManageService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DoctorDao doctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private SignFamilyDao signFamilyDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientDao patientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /************************************************************* start ************************************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String findRehabilitationPlanList = "/svr-specialist/findRehabilitationPlanList";//康复管理-康复计划列表 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -47,6 +52,9 @@ public class RehabilitationManageService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String recentPlanDetailRecord = "/svr-specialist/recentPlanDetailRecord";//居民康复计划详情页-近期康复相关记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String createServiceQrCode ="/svr-specialist/createServiceQrCode";//根据康复计划明细id和对话sessionId生成服务码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String checkAfterQrCode="/svr-specialist/checkAfterQrCode";//居民扫码后验证是否是关联的居民扫码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String serviceDoctorList = "/svr-specialist/serviceDoctorList";//康复管理-医生端居民详情服务医生列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String appCalendarPlanDetailList = "/svr-specialist/appCalendarPlanDetailList";//康复管理-app端、微信端计划的服务项目列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private String dailyJob = "/svr-specialist/dailyJob";//每日康复服务通知 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /************************************************************* end ************************************************************************/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -83,6 +91,14 @@ public class RehabilitationManageService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doGet(specialistUrl + findRehabilitationPlanList, param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(response.getContent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(result.getInt("status")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray json = result.getJSONArray("detailModelList"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String patientCode =""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Patient patient =null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<json.length();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientCode = json.getJSONObject(i).get("patientCode")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patient = patientDao.findByCode(patientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                json.getJSONObject(i).put("photo",patient!=null?patient.getPhoto():""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        throw new Exception("请求微服务失败!"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -214,7 +230,7 @@ public class RehabilitationManageService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("doctorCode", doctorCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("doctorType", doctorType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("content", content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("planDetailIds", planDetailId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("planDetailId", planDetailId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doPost(specialistUrl + saveGuidanceMessage, param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(response.getContent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(result.getInt("status")!=200){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -252,12 +268,20 @@ public class RehabilitationManageService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String healthDoctorName =null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String generalDoctor = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String generalDoctorName = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patientName = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer age = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sex = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String signHospitalName = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SignFamily signFamily = list.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthDoctor = signFamily.getDoctorHealth(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthDoctorName = signFamily.getDoctorHealthName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            generalDoctor = signFamily.getDoctor(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            generalDoctorName = signFamily.getDoctorName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientName = signFamily.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            age = IdCardUtil.getAgeForIdcard(signFamily.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sex = IdCardUtil.getSexForIdcard_new(signFamily.getIdcard()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            signHospitalName = signFamily.getHospitalName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("patientCode", patientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("healthDoctor", healthDoctor); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -267,7 +291,23 @@ public class RehabilitationManageService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doGet(specialistUrl + patientRehabilitationDetail, param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(response.getContent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(result.getInt("status")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result.getJSONObject("obj"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject json = result.getJSONObject("obj").getJSONObject("patientInfo"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("patientName",patientName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("age",age); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("sex",sex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("healthyCondition","康复期"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("signHospitalName",signHospitalName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            json.put("photo",patientDao.findByCode(patientCode).getPhoto()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONArray jsonArray = result.getJSONObject("obj").getJSONArray("serviceDoctorList"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String doctorCode =""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Doctor doctor = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for(int i=0;i<jsonArray.length();i++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctorCode = jsonArray.getJSONObject(i).get("doctorCode")+""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctor = doctorDao.findByCode(doctorCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                jsonArray.getJSONObject(i).put("doctorPhoto",doctor!=null?doctor.getPhoto():""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result.getJSONObject("obj").put("patientInfo",json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        throw new Exception("请求微服务失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -280,11 +320,13 @@ public class RehabilitationManageService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject recentPlanDetailRecord(String patientCode,String startTime,String endTime) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject recentPlanDetailRecord(String patientCode,String startTime,String endTime,Integer page,Integer pageSize) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> param = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("patientCode", patientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("startTime", startTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("endTime", endTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("page", page);//第几页,从1开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("pageSize", pageSize);//每页分页大小 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doGet(specialistUrl + recentPlanDetailRecord, param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(response.getContent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(result.getInt("status")==200){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -315,4 +357,75 @@ public class RehabilitationManageService extends BaseService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(response.getContent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 康复管理-app端、居民端-服务医生列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patientCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray serviceDoctorList(String patientCode) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> param = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<SignFamily> list = signFamilyDao.findByPatientAndExpensesStatusAndStatus(patientCode,"1",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String healthDoctor = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String healthDoctorName =null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String generalDoctor = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String generalDoctorName = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            SignFamily signFamily = list.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthDoctor = signFamily.getDoctorHealth(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            healthDoctorName = signFamily.getDoctorHealthName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            generalDoctor = signFamily.getDoctor(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            generalDoctorName = signFamily.getDoctorName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("patientCode", patientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("healthDoctor", healthDoctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("healthDoctorName", healthDoctorName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("generalDoctor", generalDoctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("generalDoctorName", generalDoctorName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doGet(specialistUrl + serviceDoctorList, param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(response.getContent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(result.getInt("status")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result.getJSONArray("obj"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        throw new Exception("请求微服务失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 康复管理-app端、微信端计划的服务项目列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param executeStartTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param executeEndTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param planId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param searchTask 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject appCalendarPlanDetailList(String executeStartTime, String executeEndTime, String planId, Integer searchTask, Integer status) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> param = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("executeStartTime", executeStartTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("executeEndTime", executeEndTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("planId", planId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("searchTask", searchTask); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("status", status); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doGet(specialistUrl + appCalendarPlanDetailList, param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(response.getContent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(result.getInt("status")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result.getJSONObject("obj"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        throw new Exception("请求微服务失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject dailyJob(String executeStartTime, String executeEndTime, String planId, Integer searchTask, Integer status) throws Exception{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Map<String, Object> param = new HashedMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("executeStartTime", executeStartTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        param.put("executeEndTime", executeEndTime); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        HttpResponse response = HttpUtils.doGet(specialistUrl + appCalendarPlanDetailList, param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(response.getContent()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(result.getInt("status")==200){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result.getJSONObject("obj"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        throw new Exception("请求微服务失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |