| 
					
				 | 
			
			
				@ -12,7 +12,6 @@ import com.yihu.jw.care.util.MessageUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.doctor.dao.BaseDoctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.doctor.BaseDoctorDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.patient.BasePatientDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.servicePackage.ServicePackageRecordDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.device.PatientDevice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.care.securitymonitoring.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.hospital.message.dao.SystemMessageDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -115,14 +114,14 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //签约防走失服务包 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<ServicePackageRecordDO> signRecords = servicePackageService.servicePackageByPatient(orderDO.getPatient(),"3"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (signRecords.size()==0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("resultFlag", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String failMsg = "当前服务对象未签约防走失服务包,请完成签约后再发起工单!"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("resultMsg", failMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error(failMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        List<ServicePackageRecordDO> signRecords = servicePackageService.servicePackageByPatient(orderDO.getPatient(),"3"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        if (signRecords.size()==0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            result.put("resultFlag", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            String failMsg = "当前服务对象未签约防走失服务,请签约后再发起预警!"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            result.put("resultMsg", failMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            logger.error(failMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //已取消的订单也可以申请 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        boolean bool = securityMonitoringOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(), 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -173,7 +172,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                orderDO.setMonitoringConclusion(conclusionDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(orderDO, SerializerFeature.WriteMapNullValue)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObject = JSON.parseObject(JSON.toJSONStringWithDateFormat(orderDO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("conclusionStatusName",conclusionStatusName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        Integer statustemp = Integer.valueOf(orderDO.getStatus()+""); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -188,7 +187,15 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            case 6:statusName="待评价";break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            case 7:statusName="已完成";break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(orderDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("patientAddress",patientDO.getAddress()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            jsonObject.put("patientAddress",null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("statusName",statusName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("resultFlag", 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("resultMsg",jsonObject); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -423,8 +430,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error(failMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put(ResponseContant.resultFlag, ResponseContant.success); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put(ResponseContant.resultMsg, doorServiceOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result = getSecurityOrderDetail(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 发送微信模板消息通知患者医生已接单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        BasePatientDO patient = basePatientDao.findById(doorServiceOrder.getPatient());// 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -536,8 +543,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 30, patient.getOpenid(), patient.getName(), json); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("resultFlag", 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result.put("resultMsg", orderDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        result = getSecurityOrderDetail(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -580,7 +586,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param signImg 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public SecurityMonitoringOrderDO signIn(String orderId, String signTime, Integer signWay, String signLocation, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject signIn(String orderId, String signTime, Integer signWay, String signLocation, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                         String signImg, String twoDimensionalCode,String doctorId) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SecurityMonitoringOrderDO doorServiceOrder = securityMonitoringOrderDao.findOne(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        doorServiceOrder.setDoctorSignTime(DateUtil.strToDate(signTime)); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -596,7 +602,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doorServiceOrder = securityMonitoringOrderDao.save(doorServiceOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                // 修改医生上门服务工单状态 4服务中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                this.updateDispatchStatusBySystem(doorServiceOrder.getDoctor(), 4);//服务中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return doorServiceOrder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return  getSecurityOrderDetail(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                logger.info("扫码签到失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -606,7 +612,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doorServiceOrder = securityMonitoringOrderDao.save(doorServiceOrder); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            // 修改医生上门服务工单状态 4服务中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            this.updateDispatchStatusBySystem(doorServiceOrder.getDoctor(), 4); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return doorServiceOrder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return getSecurityOrderDetail(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -626,14 +632,28 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public SecurityMonitoringConclusionDO updateDoorConclusion(Integer manageStatus,String orderId,String conclusion,Integer examPapeStatus) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject updateDoorConclusion(Integer manageStatus,String orderId,String conclusion,Integer examPapeStatus) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject result = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ObjectMapper objectMapper = new ObjectMapper(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SecurityMonitoringConclusionDO doorConclusion = new SecurityMonitoringConclusionDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SecurityMonitoringOrderDO one = securityMonitoringOrderDao.findOne(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (one==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String failMsg = "工单不存在" ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("resultFlag", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            result.put("resultMsg", failMsg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SecurityMonitoringConclusionDO doorConclusion =  securityMonitoringConclusionDao.findByOrderId(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (doorConclusion==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doorConclusion = new SecurityMonitoringConclusionDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doorConclusion.setOrderId(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doorConclusion.setPatient(one.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doorConclusion.setPatientName(one.getPatientName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doorConclusion.setDoctor(one.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doorConclusion.setDoctorName(one.getDoctorName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        doorConclusion.setStatus(manageStatus); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        doorConclusion.setConclusion(conclusion); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BaseDoctorDO doctorVO = baseDoctorDao.findById(one.getDoctor()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (doorConclusion != null && org.apache.commons.lang.StringUtils.isNotEmpty(doorConclusion.getId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            doorConclusion.setUpdateTime(new Date()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -651,15 +671,16 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        one.setExamPaperStatus(examPapeStatus); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        one.setConclusionStatus(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        securityMonitoringOrderDao.save(one); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return doorConclusion; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return getSecurityOrderDetail(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 跳过登记服务小结 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orderId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void cancelConclusion(String orderId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject cancelConclusion(String orderId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        securityMonitoringOrderDao.updateConclusionStatus(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return getSecurityOrderDetail(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -693,11 +714,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return doorConclusion; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public SecurityMonitoringOrderDO saveOrderFinishBydoctor(String orderId ,String finishImg) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONObject saveOrderFinishBydoctor(String orderId ,String finishImg) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        SecurityMonitoringOrderDO one = securityMonitoringOrderDao.findOne(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        one.setDoctorConfirmFinishImg(finishImg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        one.setStatus(SecurityMonitoringOrderDO.Status.complete.getType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        one.setDoctorConfirmFinishTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        one.setCompleteTime(one.getDoctorConfirmFinishTime()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 更新记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        this.setUpdateColumnInfo(one); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        securityMonitoringOrderDao.save(one); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -733,7 +755,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            logger.error(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return doorServiceOrderDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return getSecurityOrderDetail(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 |