|  | @ -0,0 +1,113 @@
 | 
	
		
			
				|  |  | package com.yihu.jw.care.endpoint.admin;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.endpoint.BaseController;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.admin.AdminDoorCoachOrderService;
 | 
	
		
			
				|  |  | import com.yihu.jw.care.service.doorCoach.DoctorDoorCoachOrderService;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.ResponseContant;
 | 
	
		
			
				|  |  | 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.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | import org.springframework.http.MediaType;
 | 
	
		
			
				|  |  | 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;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import java.util.ArrayList;
 | 
	
		
			
				|  |  | import java.util.List;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | /***
 | 
	
		
			
				|  |  |  * @ClassName: AdminDoorCoachOrderController
 | 
	
		
			
				|  |  |  * @Description: 管理员调度端终端
 | 
	
		
			
				|  |  |  * @Auther: shi kejing
 | 
	
		
			
				|  |  |  * @Date: 2021/8/31 14:38
 | 
	
		
			
				|  |  |  */
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | @RestController
 | 
	
		
			
				|  |  | @RequestMapping(value = "/admin/doorCoach/serviceOrder", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
 | 
	
		
			
				|  |  | @Api(description = "医生端-上门辅导")
 | 
	
		
			
				|  |  | public class AdminDoorCoachOrderController extends EnvelopRestEndpoint {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private DoctorDoorCoachOrderService doctorDoorCoachOrderService;
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private AdminDoorCoachOrderService adminDoorCoachOrderService;
 | 
	
		
			
				|  |  |     private BaseController baseController = new BaseController();
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = "queryBriefList")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "调度员查询工单列表")
 | 
	
		
			
				|  |  |     public String queryBriefList(
 | 
	
		
			
				|  |  |             @ApiParam(name = "dispatcher", value = "调度员code") @RequestParam(value = "dispatcher", required = true) String dispatcher,
 | 
	
		
			
				|  |  |             @ApiParam(name = "hospital", value = "调度员所在机构code") @RequestParam(value = "hospital", required = true) String hospital,
 | 
	
		
			
				|  |  |             @ApiParam(name = "orderNumber", value = "工单号") @RequestParam(value = "orderNumber", required = false) String orderNumber,
 | 
	
		
			
				|  |  |             @ApiParam(name = "patientName", value = "工单服务对象姓名") @RequestParam(value = "patientName", required = false) String patientName,
 | 
	
		
			
				|  |  |             @ApiParam(name = "phone", value = "发起工单的居民的联系方式") @RequestParam(value = "phone", required = false) String phone,
 | 
	
		
			
				|  |  |             @ApiParam(name = "status", value = "工单状态") @RequestParam(value = "status", required = false) Integer status,
 | 
	
		
			
				|  |  |             @ApiParam(name = "patientType", value = "居民类型") @RequestParam(value = "patientType", required = false) String patientType,
 | 
	
		
			
				|  |  |             @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
 | 
	
		
			
				|  |  |             @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") @RequestParam(value = "size") int size) {
 | 
	
		
			
				|  |  |         try{
 | 
	
		
			
				|  |  |             JSONObject result = doctorDoorCoachOrderService.queryBriefList(dispatcher,hospital, orderNumber, patientName, phone, status,patientType, page, size);
 | 
	
		
			
				|  |  |             if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
 | 
	
		
			
				|  |  |                 return baseController.error(-1,result.getString(ResponseContant.resultMsg));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             int count = result.getIntValue(ResponseContant.count);
 | 
	
		
			
				|  |  |             JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |             object.put("total",count);
 | 
	
		
			
				|  |  |             object.put("detailModelList",result.get(ResponseContant.resultMsg));
 | 
	
		
			
				|  |  |             object.put("currPage",page);
 | 
	
		
			
				|  |  |             object.put("pageSize",size);
 | 
	
		
			
				|  |  |             return baseController.write(200,"查询成功","data",object);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             return baseController.errorResult(e);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = "queryDoctorList")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "服务人员列表(医生列表)")
 | 
	
		
			
				|  |  |     public String queryDoctorList(
 | 
	
		
			
				|  |  |             @ApiParam(name = "hospital", value = "调度员所在的机构code") @RequestParam(value = "hospital", required = false) String hospital,
 | 
	
		
			
				|  |  |             @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = false) String doctorName,
 | 
	
		
			
				|  |  |             @ApiParam(name = "status", value = "医生接单状态,状态为全部时不传") @RequestParam(value = "status", required = false) String status,
 | 
	
		
			
				|  |  |             @ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = false) String patient,
 | 
	
		
			
				|  |  |             @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
 | 
	
		
			
				|  |  |             @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") @RequestParam(value = "size") int size) {
 | 
	
		
			
				|  |  |         try{
 | 
	
		
			
				|  |  |             doctorDoorCoachOrderService.initDoorStatus(hospital);
 | 
	
		
			
				|  |  |             JSONObject result = doctorDoorCoachOrderService.queryDoctorList(patient,hospital, doctorName, status, page, size);
 | 
	
		
			
				|  |  |             if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
 | 
	
		
			
				|  |  |                 return baseController.error(-1,result.getString(ResponseContant.resultMsg));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             int count = result.getIntValue(ResponseContant.count);
 | 
	
		
			
				|  |  |             JSONObject object = new JSONObject();
 | 
	
		
			
				|  |  |             object.put("total",count);
 | 
	
		
			
				|  |  |             if (count > 0){
 | 
	
		
			
				|  |  |                 object.put("detailModelList",result.get(ResponseContant.resultMsg));
 | 
	
		
			
				|  |  |             }else {
 | 
	
		
			
				|  |  |                 List list = new ArrayList();
 | 
	
		
			
				|  |  |                 object.put("detailModelList",list);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             object.put("currPage",page);
 | 
	
		
			
				|  |  |             object.put("pageSize",size);
 | 
	
		
			
				|  |  |             return baseController.write(200,"查询成功","data",object);
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             return baseController.errorResult(e);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @GetMapping(value = "getServiceDynamic")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "管理员调度实时动态")
 | 
	
		
			
				|  |  |     public String getServiceDynamic(
 | 
	
		
			
				|  |  |             @ApiParam(name = "page", value = "分页大小", required = true) @RequestParam(value = "page") int page,
 | 
	
		
			
				|  |  |             @ApiParam(name = "size", value = "页码", required = true) @RequestParam(value = "size") int size) {
 | 
	
		
			
				|  |  |         try{
 | 
	
		
			
				|  |  |             return baseController.write(200,"查询成功","data",adminDoorCoachOrderService.getServiceDynamic(page,size));
 | 
	
		
			
				|  |  |         }catch (Exception e){
 | 
	
		
			
				|  |  |             return baseController.errorResult(e);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |