| 
					
				 | 
			
			
				@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.im.ConsultTeamDo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.prescription.service.PrescriptionService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.im.service.ImService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.Envelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.ListEnvelop; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -34,17 +35,18 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					private ImService imService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					private PrescriptionService prescriptionService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@GetMapping (value = BaseHospitalRequestMapping.DodtorIM.findPrescriptionConsultByDoctor) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@GetMapping (value = BaseHospitalRequestMapping.DodtorIM.findWaitingRoomOutpatientByDoctor) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@ApiOperation(value = "医生可接单列表", notes = "医生可接单列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					public ListEnvelop findPrescriptionConsultByDoctor( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "doctor", value = "医生CODE") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "doctor", value = "医生CODE",defaultValue = "1cd15ffe6b3a11e69f7c005056850d66") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "doctor",required = true) String doctor, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "type", value = "图文复诊:1视频复诊:2") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "type",required = false) Integer type){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						String result = "[{\"id\":\"000000006777d2c80167bf4d93680100\",\"day\":\"2019-06-20\",\"patientlist\":{\"id\":\"XDF1231231LLL\",\"name\":\"张三\",\"sex\":1,\"age\":68,\"photo\":\"/group/3d45/111.jpg\",\"type\":1,\"consult_type\":1,\"time\":\"12:12\"}},{\"id\":\"000000006777d2c80167bf4d93680101\",\"day\":\"2019-06-21\",\"patientlist\":{\"id\":\"XDF1231231LL12\",\"name\":\"李四\",\"sex\":2,\"age\":66,\"photo\":\"/group/3d45/111.jpg\",\"type\":2,\"consult_type\":12,\"time\":\"12:12\"}}]"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						JSONArray messageArray = JSON.parseArray(result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return success(messageArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "type",required = true) Integer type){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return success("请求成功",prescriptionService.findWaitingRoomOutpatientByDoctor(doctor,type)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.findWaitingRoomPatient) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -92,11 +94,11 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.addPrescriptionConsult) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@ApiOperation(value = "添加复诊咨询", notes = "添加复诊咨询") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					public Envelop addPrescriptionConsult(@ApiParam(name = "outpatientCode", value = "HIS就诊记录CODE", defaultValue = "10") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					public Envelop addPrescriptionConsult(@ApiParam(name = "outpatientCode", value = "HIS就诊记录CODE", defaultValue = "1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "outpatientCode", required = true) String outpatientCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "patientCode", value = "复诊居民", defaultValue = "86225d1365e711e69f7c005056850d66") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "patientCode", value = "复诊居民", defaultValue = "9638fa184ad14a71ba7e4bf931670778") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "patientCode", required = true) String patientCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "doctorCode", value = "当前医生", defaultValue = "131231312312") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(name = "doctorCode", value = "当前医生", defaultValue = "1cd15ffe6b3a11e69f7c005056850d66") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					        @RequestParam(value = "doctorCode", required = true) String doctorCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "type", value = "咨询类型(1、图文;2、视频,3、图文+视频)", defaultValue = "1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "type", required = true) Integer type, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -107,17 +109,19 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							//咨询类型(1、图文;2、视频,3、图文+视频) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							consult.setHealthindexType(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							int res = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			int res = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							synchronized (outpatientCode.intern()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								res = imService.addPrescriptionConsult(outpatientCode, patientCode,patientCode,doctorCode,consult,reason,type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							if (res == -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								failed("该处方存在未审核的处方,无法进行复诊咨询!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//				return error(-1, "该处方存在未审核的续方,无法进行续方咨询!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} if (res == -3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								failed("您当天有未完成的处方,不能发起复诊!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//				return error(-1, "您当天有未完成的续方,不能发起续方咨询!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								result = imService.addPrescriptionConsult(outpatientCode, patientCode,doctorCode,consult,reason,type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			if (res == -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//				failed("该处方存在未审核的处方,无法进行复诊咨询!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////				return error(-1, "该处方存在未审核的续方,无法进行续方咨询!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			} if (res == -3) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//				failed("您当天有未完成的处方,不能发起复诊!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				////				return error(-1, "您当天有未完成的续方,不能发起续方咨询!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            Doctor doctor = doctorService.findDoctorByCode(consult.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            // 添加到统计队列 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -152,7 +156,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new org.json.JSONObject(consult)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return success(consult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return success("操作成功",result); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@PostMapping(value = BaseHospitalRequestMapping.PatientIM.finish) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -166,4 +170,15 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						int resutl = imService.finish(consult,doctorCode,2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return success(resutl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.getConsultInfoAndPatientInfo) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					@ApiOperation(value = "获取咨询问题,图片,居民信息", notes = "获取咨询问题,图片,居民信息") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					public Envelop getConsultInfoAndPatientInfo( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "consult", value = "咨询CODE") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "consult",required = false) String consult, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@ApiParam(name = "patientCode", value = "居民COEE") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							@RequestParam(value = "patientCode",required = false) String patientCode)throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return success("请求成功",imService.getConsultInfoAndPatientInfo(consult,patientCode)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |