|  | @ -1,7 +1,9 @@
 | 
												
													
														
															|  | package com.yihu.jw.care.service.security;
 |  | package com.yihu.jw.care.service.security;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import com.alibaba.fastjson.JSON;
 | 
												
													
														
															|  | import com.alibaba.fastjson.JSONArray;
 |  | import com.alibaba.fastjson.JSONArray;
 | 
												
													
														
															|  | import com.alibaba.fastjson.JSONObject;
 |  | import com.alibaba.fastjson.JSONObject;
 | 
												
													
														
															|  | 
 |  | import com.alibaba.fastjson.serializer.SerializerFeature;
 | 
												
													
														
															|  | import com.fasterxml.jackson.databind.ObjectMapper;
 |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
												
													
														
															|  | import com.yihu.jw.care.dao.device.PatientDeviceDao;
 |  | import com.yihu.jw.care.dao.device.PatientDeviceDao;
 | 
												
													
														
															|  | import com.yihu.jw.care.dao.security.*;
 |  | import com.yihu.jw.care.dao.security.*;
 | 
												
											
												
													
														
															|  | @ -10,7 +12,6 @@ import com.yihu.jw.care.util.MessageUtil;
 | 
												
													
														
															|  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 |  | 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.device.PatientDevice;
 | 
												
													
														
															|  | import com.yihu.jw.entity.care.securitymonitoring.*;
 |  | import com.yihu.jw.entity.care.securitymonitoring.*;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.message.dao.SystemMessageDao;
 |  | import com.yihu.jw.hospital.message.dao.SystemMessageDao;
 | 
												
											
												
													
														
															|  | @ -29,10 +30,7 @@ import org.springframework.stereotype.Service;
 | 
												
													
														
															|  | import org.springframework.transaction.annotation.Transactional;
 |  | import org.springframework.transaction.annotation.Transactional;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import java.text.SimpleDateFormat;
 |  | import java.text.SimpleDateFormat;
 | 
												
													
														
															|  | import java.util.Date;
 |  | 
 | 
												
													
														
															|  | import java.util.List;
 |  | 
 | 
												
													
														
															|  | import java.util.Map;
 |  | 
 | 
												
													
														
															|  | import java.util.Random;
 |  | 
 | 
												
													
														
															|  | 
 |  | import java.util.*;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | /**
 |  | /**
 | 
												
													
														
															|  |  * Created by Bing on 2021/4/6.
 |  |  * Created by Bing on 2021/4/6.
 | 
												
											
												
													
														
															|  | @ -106,16 +104,25 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |             return result;
 |  |             return result;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //签约防走失服务包
 |  | 
 | 
												
													
														
															|  |         List<ServicePackageRecordDO> signRecords = servicePackageService.servicePackageByPatient(orderDO.getPatient(),"3");
 |  | 
 | 
												
													
														
															|  |         if (signRecords.size()<0) {
 |  | 
 | 
												
													
														
															|  | 
 |  |         BasePatientDO patientDO = basePatientDao.findById(orderDO.getPatient());
 | 
												
													
														
															|  | 
 |  |         if (patientDO==null){
 | 
												
													
														
															|  |             result.put("resultFlag", 0);
 |  |             result.put("resultFlag", 0);
 | 
												
													
														
															|  |             String failMsg = "当前服务对象未完成签约,请完成签约后再预约服务!";
 |  | 
 | 
												
													
														
															|  | 
 |  |             String failMsg = "当前服务对象未建档";
 | 
												
													
														
															|  |             result.put("resultMsg", failMsg);
 |  |             result.put("resultMsg", failMsg);
 | 
												
													
														
															|  |             logger.error(failMsg);
 |  |             logger.error(failMsg);
 | 
												
													
														
															|  |             return result;
 |  |             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(),
 |  |         boolean bool = securityMonitoringOrderDao.existsByPatientAndStatusIn(orderDO.getPatient(),
 | 
												
													
														
															|  |                 new Integer[]{SecurityMonitoringOrderDO.Status.waitForSend.getType(),
 |  |                 new Integer[]{SecurityMonitoringOrderDO.Status.waitForSend.getType(),
 | 
												
											
												
													
														
															|  | @ -132,31 +139,67 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |             logger.error(failMsg);
 |  |             logger.error(failMsg);
 | 
												
													
														
															|  |             return result;
 |  |             return result;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         orderDO.setHospital(jsonObjectParam.getJSONObject("hospital").get("code").toString());
 |  | 
 | 
												
													
														
															|  |         orderDO.setCreateTime(new Date());
 |  |         orderDO.setCreateTime(new Date());
 | 
												
													
														
															|  |         //判断创建预警服务类型,发起类型(1本人发起 2家人待预约 3医生代预约)
 |  |         //判断创建预警服务类型,发起类型(1本人发起 2家人待预约 3医生代预约)
 | 
												
													
														
															|  |         orderDO.setType(3);//发起类型
 |  |         orderDO.setType(3);//发起类型
 | 
												
													
														
															|  |         orderDO.setServiceStatus("2");
 |  |         orderDO.setServiceStatus("2");
 | 
												
													
														
															|  |         this.save(orderDO);
 |  |         this.save(orderDO);
 | 
												
													
														
															|  | 
 |  |         result.put("resultFlag", 1);
 | 
												
													
														
															|  | 
 |  |         result.put("resultMsg",orderDO);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //创建咨询
 |  | 
 | 
												
													
														
															|  |         org.json.JSONObject successOrNot = null;
 |  | 
 | 
												
													
														
															|  |         try {
 |  | 
 | 
												
													
														
															|  | //            successOrNot = consultTeamService.addDoorServiceConsult(orderDO.getId());
 |  | 
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             successOrNot = null;//TODO 接单时创建两个人聊天
 |  | 
 | 
												
													
														
															|  |         } catch (Exception e) {
 |  | 
 | 
												
													
														
															|  |             String failMsg = "创建咨询时异常: " + e.getMessage();
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getSecurityOrderDetail(String orderID){
 | 
												
													
														
															|  | 
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  | 
 |  |         SecurityMonitoringOrderDO orderDO = securityMonitoringOrderDao.findOne(orderID);
 | 
												
													
														
															|  | 
 |  |         if (orderDO==null){
 | 
												
													
														
															|  | 
 |  |             String failMsg = "工单不存在!";
 | 
												
													
														
															|  |             result.put("resultFlag", 0);
 |  |             result.put("resultFlag", 0);
 | 
												
													
														
															|  |             result.put("resultMsg", failMsg);
 |  |             result.put("resultMsg", failMsg);
 | 
												
													
														
															|  |             logger.error(failMsg);
 |  |             logger.error(failMsg);
 | 
												
													
														
															|  |             return result;
 |  |             return result;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         if (Integer.parseInt(successOrNot.get("resultFlag").toString()) == 0) {
 |  | 
 | 
												
													
														
															|  |             return JSONObject.parseObject(successOrNot.toString());
 |  | 
 | 
												
													
														
															|  | 
 |  |         Integer conclusionStatus = Integer.valueOf(orderDO.getConclusionStatus()==null?"0":(orderDO.getConclusionStatus()+""));
 | 
												
													
														
															|  | 
 |  |         String conclusionStatusName = "";
 | 
												
													
														
															|  | 
 |  |         switch (conclusionStatus){
 | 
												
													
														
															|  | 
 |  |             case 1:conclusionStatusName="待补录";break;
 | 
												
													
														
															|  | 
 |  |             case 2:conclusionStatusName="已登记";break;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (conclusionStatus==2){
 | 
												
													
														
															|  | 
 |  |             SecurityMonitoringConclusionDO conclusionDO = securityMonitoringConclusionDao.findByOrderId(orderDO.getId());
 | 
												
													
														
															|  | 
 |  |             if (conclusionDO!=null){
 | 
												
													
														
															|  | 
 |  |                 orderDO.setMonitoringConclusion(conclusionDO);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         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()+"");
 | 
												
													
														
															|  | 
 |  |         String statusName = "";
 | 
												
													
														
															|  | 
 |  |         switch (statustemp){
 | 
												
													
														
															|  | 
 |  |             case -1:statusName="已取消";break;
 | 
												
													
														
															|  | 
 |  |             case 1:statusName="待处置";break;
 | 
												
													
														
															|  | 
 |  |             case 2:statusName="前往居民定位";break;
 | 
												
													
														
															|  | 
 |  |             case 3:statusName="已签到";break;
 | 
												
													
														
															|  | 
 |  |             case 4:statusName="已登记小结";break;
 | 
												
													
														
															|  | 
 |  |             case 5:statusName="待补录";break;
 | 
												
													
														
															|  | 
 |  |             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;
 |  |         return result;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public JSONArray getSecurityOrderList(String doctor, String patient, String status, Integer page, Integer pageSize){
 |  |     public JSONArray getSecurityOrderList(String doctor, String patient, String status, Integer page, Integer pageSize){
 | 
												
											
												
													
														
															|  | @ -172,7 +215,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |         if (StringUtils.isNotBlank(status)){
 |  |         if (StringUtils.isNotBlank(status)){
 | 
												
													
														
															|  |             sql+=" and ord.status='"+Integer.parseInt(status)+"' ";
 |  |             sql+=" and ord.status='"+Integer.parseInt(status)+"' ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         if (StringUtils.isBlank(status)&&status.equals("1")){//状态为空或待处置时 查询该医生签约团队居民的预警
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isBlank(status)||status.equals("1")){//状态为空或待处置时 查询该医生签约团队居民的预警
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         sql+=" order by ord.create_time desc limit " + (page*pageSize) + "," + pageSize;
 |  |         sql+=" order by ord.create_time desc limit " + (page*pageSize) + "," + pageSize;
 | 
												
											
												
													
														
															|  | @ -195,7 +238,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |             tmp.put("doctorName",one.get("doctor_ame"));
 |  |             tmp.put("doctorName",one.get("doctor_ame"));
 | 
												
													
														
															|  |             tmp.put("patientPhone",one.get("patient_phone"));
 |  |             tmp.put("patientPhone",one.get("patient_phone"));
 | 
												
													
														
															|  |             tmp.put("conclusionStatus",one.get("conclusion_status"));
 |  |             tmp.put("conclusionStatus",one.get("conclusion_status"));
 | 
												
													
														
															|  |             Integer conclusionStatus = Integer.valueOf(one.get("conclusion_status")+"");
 |  | 
 | 
												
													
														
															|  | 
 |  |             Integer conclusionStatus = Integer.valueOf(one.get("conclusion_status")==null?"0":(one.get("conclusion_status")+""));
 | 
												
													
														
															|  |             String conclusionStatusName = "";
 |  |             String conclusionStatusName = "";
 | 
												
													
														
															|  |             switch (conclusionStatus){
 |  |             switch (conclusionStatus){
 | 
												
													
														
															|  |                 case 1:conclusionStatusName="待补录";break;
 |  |                 case 1:conclusionStatusName="待补录";break;
 | 
												
											
												
													
														
															|  | @ -387,8 +430,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |             logger.error(failMsg);
 |  |             logger.error(failMsg);
 | 
												
													
														
															|  |             return result;
 |  |             return result;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         result.put(ResponseContant.resultFlag, ResponseContant.success);
 |  | 
 | 
												
													
														
															|  |         result.put(ResponseContant.resultMsg, doorServiceOrder);
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         result = getSecurityOrderDetail(orderId);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         // 发送微信模板消息通知患者医生已接单
 |  |         // 发送微信模板消息通知患者医生已接单
 | 
												
													
														
															|  | //        BasePatientDO patient = basePatientDao.findById(doorServiceOrder.getPatient());//
 |  | //        BasePatientDO patient = basePatientDao.findById(doorServiceOrder.getPatient());//
 | 
												
											
												
													
														
															|  | @ -419,13 +462,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 取消工单
 |  |      * 取消工单
 | 
												
													
														
															|  |      * @param orderId
 |  |      * @param orderId
 | 
												
													
														
															|  |      * @param type
 |  | 
 | 
												
													
														
															|  |      * @param reason
 |  |      * @param reason
 | 
												
													
														
															|  |      * @param dispatcher
 |  | 
 | 
												
													
														
															|  |      * @param dispatcherName
 |  | 
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public JSONObject cancelOrder(String orderId,int type,String reason,String dispatcher,String dispatcherName){
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject cancelOrder(String orderId,int type,String reason,String doctor){
 | 
												
													
														
															|  |         JSONObject result = new JSONObject();
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  |         SecurityMonitoringOrderDO orderDO = securityMonitoringOrderDao.findOne(orderId);
 |  |         SecurityMonitoringOrderDO orderDO = securityMonitoringOrderDao.findOne(orderId);
 | 
												
													
														
															|  |         if(null == orderDO){
 |  |         if(null == orderDO){
 | 
												
											
												
													
														
															|  | @ -436,6 +476,14 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |             return result;
 |  |             return result;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         //接单前可取消工单
 |  |         //接单前可取消工单
 | 
												
													
														
															|  | 
 |  |         BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
 | 
												
													
														
															|  | 
 |  |         if (doctorDO==null){
 | 
												
													
														
															|  | 
 |  |             String failMsg = "【取消工单】操作医生不存在," + orderId;
 | 
												
													
														
															|  | 
 |  |             result.put("resultFlag", 0);
 | 
												
													
														
															|  | 
 |  |             result.put("resultMsg", failMsg);
 | 
												
													
														
															|  | 
 |  |             logger.error(failMsg);
 | 
												
													
														
															|  | 
 |  |             return result;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         if(orderDO.getStatus() > SecurityMonitoringOrderDO.Status.waitForSend.getType()){
 |  |         if(orderDO.getStatus() > SecurityMonitoringOrderDO.Status.waitForSend.getType()){
 | 
												
													
														
															|  |             String failMsg = "只有医生接单前的工单才可取消:," + orderId;
 |  |             String failMsg = "只有医生接单前的工单才可取消:," + orderId;
 | 
												
													
														
															|  |             result.put("resultFlag", 0);
 |  |             result.put("resultFlag", 0);
 | 
												
											
												
													
														
															|  | @ -443,6 +491,8 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |             logger.error(failMsg);
 |  |             logger.error(failMsg);
 | 
												
													
														
															|  |             return result;
 |  |             return result;
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  |         orderDO.setDoctor(doctor);
 | 
												
													
														
															|  | 
 |  |         orderDO.setDoctorName(doctorDO.getName());
 | 
												
													
														
															|  |         orderDO.setCancelType(type);
 |  |         orderDO.setCancelType(type);
 | 
												
													
														
															|  |         orderDO.setCancelTime(new Date());
 |  |         orderDO.setCancelTime(new Date());
 | 
												
													
														
															|  |         orderDO.setCancelReason(reason);
 |  |         orderDO.setCancelReason(reason);
 | 
												
											
												
													
														
															|  | @ -493,8 +543,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  | //        }
 |  | //        }
 | 
												
													
														
															|  | //        pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 30, patient.getOpenid(), patient.getName(), json);
 |  | //        pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 30, patient.getOpenid(), patient.getName(), json);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         result.put("resultFlag", 1);
 |  | 
 | 
												
													
														
															|  |         result.put("resultMsg", "工单服务已取消!");
 |  | 
 | 
												
													
														
															|  | 
 |  |         result = getSecurityOrderDetail(orderId);
 | 
												
													
														
															|  |         return result;
 |  |         return result;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -537,7 +586,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |      * @param signImg
 |  |      * @param signImg
 | 
												
													
														
															|  |      * @return
 |  |      * @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 {
 |  |                                          String signImg, String twoDimensionalCode,String doctorId) throws Exception {
 | 
												
													
														
															|  |         SecurityMonitoringOrderDO doorServiceOrder = securityMonitoringOrderDao.findOne(orderId);
 |  |         SecurityMonitoringOrderDO doorServiceOrder = securityMonitoringOrderDao.findOne(orderId);
 | 
												
													
														
															|  |         doorServiceOrder.setDoctorSignTime(DateUtil.strToDate(signTime));
 |  |         doorServiceOrder.setDoctorSignTime(DateUtil.strToDate(signTime));
 | 
												
											
												
													
														
															|  | @ -553,7 +602,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |                 doorServiceOrder = securityMonitoringOrderDao.save(doorServiceOrder);
 |  |                 doorServiceOrder = securityMonitoringOrderDao.save(doorServiceOrder);
 | 
												
													
														
															|  |                 // 修改医生上门服务工单状态 4服务中
 |  |                 // 修改医生上门服务工单状态 4服务中
 | 
												
													
														
															|  |                 this.updateDispatchStatusBySystem(doorServiceOrder.getDoctor(), 4);//服务中
 |  |                 this.updateDispatchStatusBySystem(doorServiceOrder.getDoctor(), 4);//服务中
 | 
												
													
														
															|  |                 return doorServiceOrder;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 return  getSecurityOrderDetail(orderId);
 | 
												
													
														
															|  |             }else {
 |  |             }else {
 | 
												
													
														
															|  |                 logger.info("扫码签到失败");
 |  |                 logger.info("扫码签到失败");
 | 
												
													
														
															|  |                 return null;
 |  |                 return null;
 | 
												
											
												
													
														
															|  | @ -563,7 +612,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |             doorServiceOrder = securityMonitoringOrderDao.save(doorServiceOrder);
 |  |             doorServiceOrder = securityMonitoringOrderDao.save(doorServiceOrder);
 | 
												
													
														
															|  |             // 修改医生上门服务工单状态 4服务中
 |  |             // 修改医生上门服务工单状态 4服务中
 | 
												
													
														
															|  |             this.updateDispatchStatusBySystem(doorServiceOrder.getDoctor(), 4);
 |  |             this.updateDispatchStatusBySystem(doorServiceOrder.getDoctor(), 4);
 | 
												
													
														
															|  |             return doorServiceOrder;
 |  | 
 | 
												
													
														
															|  | 
 |  |             return getSecurityOrderDetail(orderId);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -580,15 +629,31 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 编辑保存服务工单小结
 |  |      * 编辑保存服务工单小结
 | 
												
													
														
															|  |      * @param model
 |  | 
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      * @throws Exception
 |  |      * @throws Exception
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public SecurityMonitoringConclusionDO updateDoorConclusion(String model, 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 objectMapper = new ObjectMapper();
 | 
												
													
														
															|  |         objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
 |  |         objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
 | 
												
													
														
															|  |         SecurityMonitoringConclusionDO doorConclusion = objectMapper.readValue(model, SecurityMonitoringConclusionDO.class);
 |  | 
 | 
												
													
														
															|  |         SecurityMonitoringOrderDO one = securityMonitoringOrderDao.findOne(doorConclusion.getOrderId());
 |  | 
 | 
												
													
														
															|  | 
 |  |         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());
 |  |         BaseDoctorDO doctorVO = baseDoctorDao.findById(one.getDoctor());
 | 
												
													
														
															|  |         if (doorConclusion != null && org.apache.commons.lang.StringUtils.isNotEmpty(doorConclusion.getId())) {
 |  |         if (doorConclusion != null && org.apache.commons.lang.StringUtils.isNotEmpty(doorConclusion.getId())) {
 | 
												
													
														
															|  |             doorConclusion.setUpdateTime(new Date());
 |  |             doorConclusion.setUpdateTime(new Date());
 | 
												
											
												
													
														
															|  | @ -606,15 +671,16 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |         one.setExamPaperStatus(examPapeStatus);
 |  |         one.setExamPaperStatus(examPapeStatus);
 | 
												
													
														
															|  |         one.setConclusionStatus(2);
 |  |         one.setConclusionStatus(2);
 | 
												
													
														
															|  |         securityMonitoringOrderDao.save(one);
 |  |         securityMonitoringOrderDao.save(one);
 | 
												
													
														
															|  |         return doorConclusion;
 |  | 
 | 
												
													
														
															|  | 
 |  |         return getSecurityOrderDetail(orderId);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 跳过登记服务小结
 |  |      * 跳过登记服务小结
 | 
												
													
														
															|  |      * @param orderId
 |  |      * @param orderId
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public void cancelConclusion(String orderId) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject cancelConclusion(String orderId) {
 | 
												
													
														
															|  |         securityMonitoringOrderDao.updateConclusionStatus(orderId);
 |  |         securityMonitoringOrderDao.updateConclusionStatus(orderId);
 | 
												
													
														
															|  | 
 |  |         return getSecurityOrderDetail(orderId);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
											
												
													
														
															|  | @ -648,11 +714,12 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |         return doorConclusion;
 |  |         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);
 |  |         SecurityMonitoringOrderDO one = securityMonitoringOrderDao.findOne(orderId);
 | 
												
													
														
															|  |         one.setDoctorConfirmFinishImg(finishImg);
 |  |         one.setDoctorConfirmFinishImg(finishImg);
 | 
												
													
														
															|  |         one.setStatus(SecurityMonitoringOrderDO.Status.complete.getType());
 |  |         one.setStatus(SecurityMonitoringOrderDO.Status.complete.getType());
 | 
												
													
														
															|  |         one.setDoctorConfirmFinishTime(new Date());
 |  |         one.setDoctorConfirmFinishTime(new Date());
 | 
												
													
														
															|  | 
 |  |         one.setCompleteTime(one.getDoctorConfirmFinishTime());
 | 
												
													
														
															|  |         // 更新记录
 |  |         // 更新记录
 | 
												
													
														
															|  |         this.setUpdateColumnInfo(one);
 |  |         this.setUpdateColumnInfo(one);
 | 
												
													
														
															|  |         securityMonitoringOrderDao.save(one);
 |  |         securityMonitoringOrderDao.save(one);
 | 
												
											
												
													
														
															|  | @ -688,7 +755,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
 | 
												
													
														
															|  |         }catch (Exception e){
 |  |         }catch (Exception e){
 | 
												
													
														
															|  |             logger.error(e.getMessage());
 |  |             logger.error(e.getMessage());
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         return doorServiceOrderDO;
 |  | 
 | 
												
													
														
															|  | 
 |  |         return getSecurityOrderDetail(orderId);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 |