|  | @ -2,6 +2,7 @@ package com.yihu.jw.door.controller.doctor;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.door.controller.BaseController;
 | 
	
		
			
				|  |  | import com.yihu.jw.door.dao.WlyyDoorDoctorDao;
 | 
	
		
			
				|  |  | import com.yihu.jw.door.dao.WlyyDoorServiceOrderDao;
 | 
	
	
		
			
				|  | @ -12,6 +13,7 @@ import com.yihu.jw.door.service.common.HospitalService;
 | 
	
		
			
				|  |  | import com.yihu.jw.door.service.common.ServerPackageService;
 | 
	
		
			
				|  |  | import com.yihu.jw.door.service.prescription.JwDoorPrescriptionService;
 | 
	
		
			
				|  |  | import com.yihu.jw.door.util.StreamUtil;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.door.WlyyDoorConclusionDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.entity.door.WlyyDoorServiceOrderDO;
 | 
	
		
			
				|  |  | import com.yihu.jw.restmodel.ResponseContant;
 | 
	
	
		
			
				|  | @ -62,6 +64,9 @@ public class DoorOrderController extends BaseController {
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private JwDoorPrescriptionService jwDoorPrescriptionService;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @Autowired
 | 
	
		
			
				|  |  |     private BaseDoctorRoleDao baseDoctorRoleDao;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @PostMapping("/initDoorStatus")
 | 
	
		
			
				|  |  |     @ApiOperation(value = "获取医生分派订单开关状态")
 | 
	
	
		
			
				|  | @ -634,7 +639,106 @@ public class DoorOrderController extends BaseController {
 | 
	
		
			
				|  |  |                     if (doctor == null) {
 | 
	
		
			
				|  |  |                         continue;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     String status = wlyyDoorServiceOrderService.findDispatchStatusByDoctor(doctor.get("id").toString());
 | 
	
		
			
				|  |  |                     JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  |                     json.put("status", status);
 | 
	
		
			
				|  |  |                     json.put("id", doctor.get("id"));
 | 
	
		
			
				|  |  |                     // 医生标识
 | 
	
		
			
				|  |  |                     json.put("code", doctor.get("id"));
 | 
	
		
			
				|  |  |                     // 医生姓名
 | 
	
		
			
				|  |  |                     json.put("name", doctor.get("name"));
 | 
	
		
			
				|  |  |                     // 所在医院名称
 | 
	
		
			
				|  |  |                     json.put("hospital", doctor.get("hospital"));
 | 
	
		
			
				|  |  |                     // 所在医院名称
 | 
	
		
			
				|  |  |                     json.put("hospital_name", doctor.get("hospital_name"));
 | 
	
		
			
				|  |  |                     // 科室名称
 | 
	
		
			
				|  |  |                     json.put("dept_name", (doctor.get("dept_name") == null ||
 | 
	
		
			
				|  |  |                             org.apache.commons.lang3.StringUtils.isEmpty(doctor.get("dept_name").toString())) ? " " : doctor.get("dept_name"));
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //                    json.put("level", doctor.get("level") );
 | 
	
		
			
				|  |  |                     json.put("job", doctor.get("job") );
 | 
	
		
			
				|  |  |                     // 职称名称
 | 
	
		
			
				|  |  |                     json.put("job_name", (doctor.get("job_name") == null ||
 | 
	
		
			
				|  |  |                             org.apache.commons.lang3.StringUtils.isEmpty(doctor.get("job_name").toString())) ? " " : doctor.get("job_name"));
 | 
	
		
			
				|  |  |                     // 头像
 | 
	
		
			
				|  |  |                     json.put("photo", doctor.get("photo"));
 | 
	
		
			
				|  |  |                     // 简介
 | 
	
		
			
				|  |  |                     json.put("introduce", doctor.get("introduce"));
 | 
	
		
			
				|  |  |                     // 专长
 | 
	
		
			
				|  |  |                     json.put("expertise", doctor.get("expertise"));
 | 
	
		
			
				|  |  |                     json.put("flag", doctors.contains(String.valueOf(doctor.get("code"))) ? true : false);
 | 
	
		
			
				|  |  |                     json.put("fixed", one != null && String.valueOf(doctor.get("code")).equals(one.getDoctor()) ? true : false);
 | 
	
		
			
				|  |  |                     //出诊费用
 | 
	
		
			
				|  |  |                     json.put("fee", 0);
 | 
	
		
			
				|  |  |                     array.add(json);
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             // 排序
 | 
	
		
			
				|  |  |             Collections.sort(array, new Comparator<JSONObject>() {
 | 
	
		
			
				|  |  |                 @Override
 | 
	
		
			
				|  |  |                 public int compare(JSONObject o1, JSONObject o2) {
 | 
	
		
			
				|  |  |                     Integer flag1 = (Boolean)o1.get("flag") ? 2 : 1;
 | 
	
		
			
				|  |  |                     Integer flag2 = (Boolean)o2.get("flag") ? 2 : 1;
 | 
	
		
			
				|  |  |                     if (flag1 - flag2 > 0) {
 | 
	
		
			
				|  |  |                         return -1;
 | 
	
		
			
				|  |  |                     } else if (flag1 - flag2 < 0) {
 | 
	
		
			
				|  |  |                         return 1;
 | 
	
		
			
				|  |  |                     } else {return 0;}
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  |             Collections.sort(array, new Comparator<JSONObject>() {
 | 
	
		
			
				|  |  |                 @Override
 | 
	
		
			
				|  |  |                 public int compare(JSONObject o1, JSONObject o2) {
 | 
	
		
			
				|  |  |                     Integer fixed = (Boolean)o1.get("fixed") ? 2 : 1;
 | 
	
		
			
				|  |  |                     Integer fixed2 = (Boolean)o2.get("fixed") ? 2 : 1;
 | 
	
		
			
				|  |  |                     int sort = fixed - fixed2;
 | 
	
		
			
				|  |  |                     if (sort > 0) {
 | 
	
		
			
				|  |  |                         return -1;
 | 
	
		
			
				|  |  |                     } else if (sort < 0) {
 | 
	
		
			
				|  |  |                         return 1;
 | 
	
		
			
				|  |  |                     } else {
 | 
	
		
			
				|  |  |                         return 0;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  |             return write(200, "获取医院医生列表成功!", "list", array);
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             error(e);
 | 
	
		
			
				|  |  |             return error(-1, "获取医院医生列表失败!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     @ApiOperation("社区医院下护士列表查询接口 没分页")
 | 
	
		
			
				|  |  |     @RequestMapping(value = "getNurseListByHospitalNoPage",method =RequestMethod.POST)
 | 
	
		
			
				|  |  |     @ResponseBody
 | 
	
		
			
				|  |  |     public String getNurseListByHospitalNoPage(
 | 
	
		
			
				|  |  |             @RequestParam(required = true) String orderId,
 | 
	
		
			
				|  |  |             @RequestParam(required = false) String hospital,
 | 
	
		
			
				|  |  |             @RequestParam(required = false) String name,
 | 
	
		
			
				|  |  |             @RequestParam(required = false) Integer type) {
 | 
	
		
			
				|  |  |         try {
 | 
	
		
			
				|  |  |             List<JSONObject> array = new ArrayList<>();
 | 
	
		
			
				|  |  |             WlyyDoorServiceOrderDO one = doorServiceOrderDao.findOne(orderId);
 | 
	
		
			
				|  |  |             // 被服务的居民的次数(非代理居民)
 | 
	
		
			
				|  |  | //            Integer times = wlyyDoorServiceOrderService.countPatientDoorTimes(one.getPatient());
 | 
	
		
			
				|  |  |             List<String> doctors = doorDoctorDao.findDoctors(orderId);
 | 
	
		
			
				|  |  |             List<Map<String, Object>> list = hospitalService.getDoctorsByhospitalNoPage(hospital, name, type, 0);
 | 
	
		
			
				|  |  |             if (list != null) {
 | 
	
		
			
				|  |  |                 for (Map<String, Object> doctor : list) {
 | 
	
		
			
				|  |  |                     if (doctor == null) {
 | 
	
		
			
				|  |  |                         continue;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     List<BaseDoctorRoleDO> baseDoctorRoleDOS = baseDoctorRoleDao.findByDoctorCode(doctor.get("id").toString());
 | 
	
		
			
				|  |  |                     if (baseDoctorRoleDOS.size()<1){
 | 
	
		
			
				|  |  |                         continue;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     if (!baseDoctorRoleDOS.get(0).getRoleCode().equals("nurse")){
 | 
	
		
			
				|  |  |                         continue;
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     String status = wlyyDoorServiceOrderService.findDispatchStatusByDoctor(doctor.get("id").toString());
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  |                     json.put("status", status);
 | 
	
		
			
				|  |  |                     json.put("id", doctor.get("id"));
 | 
	
		
			
				|  |  |                     // 医生标识
 | 
	
		
			
				|  |  |                     json.put("code", doctor.get("id"));
 |