| 
					
				 | 
			
			
				@ -0,0 +1,196 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				package com.yihu.jw.care.endpoint.third.platForm; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.assistance.EmergencyAssistanceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.doorCoach.DoctorDoorCoachOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.lifeCare.LifeCareOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.security.SecurityMonitoringOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.care.service.third.PatientInfoPlatFormService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachOrderDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.ResponseContant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.ObjEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiOperation; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.GetMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.RequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.RequestParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * Created by Bing on 2021/6/16. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 * 管理端pc端 居民详情大屏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@RequestMapping(value = "/cloudCare/noLogin/patientInfoForm") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				@Api(description = "管理端pc端 居民详情大屏") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				public class PatientInfoPlatFormEndpoint extends EnvelopRestEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientInfoPlatFormService patientInfoPlatFormService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private PatientDoorCoachOrderService patientDoorCoachOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private DoctorDoorCoachOrderService doctorDoorCoachOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private LifeCareOrderService lifeCareOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private SecurityMonitoringOrderService securityMonitoringOrderService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private EmergencyAssistanceService assistanceService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = "getPatientInfo") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiParam("获取居民详情页") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop getPatientInfo(@ApiParam(name="patient",value = "居民id",required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @RequestParam(value = "patient")String patient, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @ApiParam(name="patientType",value="患者类型 1老人 2 新生儿") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @RequestParam(name = "patientType",required = false,defaultValue = "1")Integer patientType){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getSuccess("查询成功",patientInfoPlatFormService.getPatientInfo(patient,patientType)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getError("获取失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = "getPatientEvent") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiParam("获取就诊事件") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop getPatientEvent(@ApiParam(name="patient",value = "居民id",required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @RequestParam(value = "patient")String patient, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @ApiParam(name="patientType",value="患者类型 1老人 2 新生儿") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @RequestParam(name = "patientType",required = false,defaultValue = "1")Integer patientType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @ApiParam(name="page",value="page") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @RequestParam(name = "page")Integer page, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @ApiParam(name="pageSize",value="pageSize") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @RequestParam(name = "pageSize")Integer pageSize){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getSuccess("查询成功",patientInfoPlatFormService.getPatientEvent(patient,patientType,page,pageSize)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getError("获取失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = "getServiceOrder") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiParam("获取服务工单列表") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop getServiceOrder(@ApiParam(name="patient",value = "居民id",required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @RequestParam(value = "patient")String patient, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @ApiParam(name="patientType",value="患者类型 1老人 2 新生儿") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @RequestParam(name = "patientType",required = false,defaultValue = "1")Integer patientType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @ApiParam(name="page",value="page") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @RequestParam(name = "page")Integer page, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @ApiParam(name="pageSize",value="pageSize") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                     @RequestParam(name = "pageSize")Integer pageSize){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getSuccess("查询成功",patientInfoPlatFormService.getServiceOrder(patient,patientType,page,pageSize)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getError("获取失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = "getHealthIndexInfo") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiParam("获取居民体征信息") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop getHealthIndexInfo(@ApiParam(name="patient",value="患者代码",defaultValue = "eb0b478fbe9245428ecf63cd7517206f") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                             @RequestParam(value="patient",required = true) String patient, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         @ApiParam(name="type",value="指标类型",defaultValue = "1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                             @RequestParam(value="type",required = true) int type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         @ApiParam(name="gi_type",value="就餐类型",defaultValue = "1") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                             @RequestParam(value = "gi_type",required = false) int gi_type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         @ApiParam(name="begin",value="开始时间",defaultValue = "2017-05-22 00:00:00") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                             @RequestParam(value="begin",required = true) String begin, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         @ApiParam(name="end",value="结束时间",defaultValue = "2017-06-02 00:00:00") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                             @RequestParam(value="end",required = true) String end){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getSuccess("查询成功",patientInfoPlatFormService.getHealthIndexInfo(patient,type,gi_type,begin,end)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getError("获取失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping("getDoorCoachByOrderId") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "根据工单id获取相应的工单,如果为空,则获取该患者当前最新一条的工单") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop getByOrderId( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(value = "patientCode", name = "patientCode") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "patientCode", required = true) String patientCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(value = "工单id", name = "orderId") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "orderId", required = false) String orderId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 没有提供工单id的情况下,则获取该医生当前最新一条的工单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isEmpty(orderId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                // 根据接单医生code获取最近一次服务orderId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                orderId = patientDoorCoachOrderService.getOrderIdByPatient(patientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isEmpty(orderId)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    return ObjEnvelop.getSuccess( "获取失败, 该患者暂无工单",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 根据orderId获取工单信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BaseDoorCoachOrderDO baseDoorCoachOrderDO = doctorDoorCoachOrderService.getDoorServiceOrderById(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getSuccess( "获取成功",  baseDoorCoachOrderDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getError("获取失败, 该医生暂无工单!" + e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping("getLifeCareByOrderId") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "根据工单id获取相应的工单") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop getByOrderId( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @ApiParam(value = "工单id", name = "orderId") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            @RequestParam(value = "orderId", required = true) String orderId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 根据orderId获取工单信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            LifeCareOrderDO doorServiceOrderDO = lifeCareOrderService.getServiceOrderById(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getSuccess("获取成功", doorServiceOrderDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getError( "获取失败" ,-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = "getSecurityOrderDetail") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "获取安防工单详情")// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop getSecurityOrderDetail(@ApiParam(name="orderId",value = "orderId",required = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                             @RequestParam(value = "orderId")String orderId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                             @ApiParam(name="doctor",value = "doctor",required = false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                             @RequestParam(value = "doctor",required = false)String doctor){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject result = securityMonitoringOrderService.getSecurityOrderDetail(orderId,doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (result.getIntValue("resultFlag") == 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return ObjEnvelop.getError(result.getString("resultMsg")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getSuccess("创建成功",result.getJSONObject("resultMsg")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getError("查询失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @GetMapping(value = "patientGetOrderDetail") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @ApiOperation(value = "患者查看救助详情")//仅只能查看已完成 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ObjEnvelop patientGetOrderDetail(@ApiParam(name="orderId",value = "工单id") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            @RequestParam(value = "orderId") String orderId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            @ApiParam(name="patient",value = "patient") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                            @RequestParam(value = "patient") String patient 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            JSONObject result = assistanceService.patientGetOrderDetail(orderId,patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getSuccess("查询成功",result.getJSONObject("resultMsg")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return ObjEnvelop.getError("查询失败"+e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |