Kaynağa Gözat

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

yeshijie 4 yıl önce
ebeveyn
işleme
686f9f6269
17 değiştirilmiş dosya ile 260 ekleme ve 76 silme
  1. 18 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 16 0
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  3. 18 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/emergency/EmergencyOrderVO.java
  4. 4 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/AqgConfig.java
  5. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/assistance/EmergencyAssistanceDao.java
  6. 5 5
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java
  7. 34 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/DoctorDoorCoachOrderController.java
  8. 3 5
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/PatientDoorCoachOrderController.java
  9. 2 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java
  10. 11 8
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java
  11. 48 23
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java
  12. 7 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java
  13. 24 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java
  14. 25 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java
  15. 0 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java
  16. 3 2
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java
  17. 40 17
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

+ 18 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -338,7 +338,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            return null;
        }
        logger.info("findOutpatientList patNo " + patNo);
        return entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,ksdm);
        List<WlyyOutpatientVO> wlyyOutpatientVOList  =  entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,ksdm);
        if (!ksdm.equalsIgnoreCase("1500010")){
            List<WlyyOutpatientVO> wlyyOutpatientVOList1  =  entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,"1500010");
            if (wlyyOutpatientVOList!=null&&wlyyOutpatientVOList.size()!=0){
                if(wlyyOutpatientVOList1!=null&&wlyyOutpatientVOList1.size()!=0){
                    for (WlyyOutpatientVO wlyyOutpatientVO:wlyyOutpatientVOList1){
                        logger.info("==="+wlyyOutpatientVO);
                        if (wlyyOutpatientVO!=null){
                            wlyyOutpatientVOList.add(wlyyOutpatientVO);
                        }
                    }
                }
            }else {
                wlyyOutpatientVOList = new ArrayList<>();
                wlyyOutpatientVOList = wlyyOutpatientVOList1;
            }
        }
        return wlyyOutpatientVOList;
    }
    /**

+ 16 - 0
business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java

@ -794,6 +794,22 @@ public class ImUtil {
		return obj.getInteger("count");
//		}else{
//			return 0;
//		}
	}
	/**
	 *获取某个会话某个对象的未读消息数。
	 * @param
	 * @return
	 */
	public Integer UserSessionsUnreadMessageCount(String session,String userid){
		String url = im_host + "api/v2/sessions/"+session+"/unread_message_count?user_id="+userid;
		String ret = HttpClientUtil.get(url,"utf-8");
		JSONObject obj = JSON.parseObject(ret);
//		if(obj.getInteger("count") ==200){
		return obj.getInteger("count");
//		}else{
//			return 0;
//		}
	}

+ 18 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/emergency/EmergencyOrderVO.java

@ -12,6 +12,7 @@ import java.util.Map;
 */
public class EmergencyOrderVO {
    //预警信息
    private String id;
    private String orderId;
    private Integer status;//工单状态
    private String statusName;//工单状态
@ -38,6 +39,7 @@ public class EmergencyOrderVO {
    //附加信息
    private Map<String,Object> information;//附加信息
    private String phone;
    //围栏状态 fences
    //小结
@ -47,6 +49,14 @@ public class EmergencyOrderVO {
    private String otherDoctorDistance;//其他医生定位信息
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getOrderId() {
        return orderId;
    }
@ -222,4 +232,12 @@ public class EmergencyOrderVO {
    public void setOtherDoctorDistance(String otherDoctorDistance) {
        this.otherDoctorDistance = otherDoctorDistance;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
}

+ 4 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/config/AqgConfig.java

@ -26,16 +26,17 @@ public class AqgConfig {
     * 修改亲情号码
     */
    public static final String sos_numbers = baseUrl +"/api/device/{0}/sos_numbers/{1}";
    public static final String X1sos_numbers = baseUrl +"/api/device/{0}/4g/sos_numbers/{1}";
    /**
     * 获取设备最新位置数据
     */
    public static final String device_last_locationdata = baseUrl +"/api/device/{0}/data/locationdata/";
    public static final String device_last_locationData = baseUrl +"/api/device/{0}/data/locationdata/";
    /**
     * 设置智能手环安全区域
     */
    public static final String fence_area = baseUrl +"/api/device/{0}/fences/{1}";
    public static final String S3fence_area = baseUrl +"/api/device/{0}/fences/{1}";
    public static final String X1fence_area = baseUrl +"/api/device/{0}/4g/fences/{1}";
    public static final String username = "13559485270";

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/assistance/EmergencyAssistanceDao.java

@ -15,7 +15,7 @@ public interface EmergencyAssistanceDao extends PagingAndSortingRepository<Emerg
    List<EmergencyAssistanceDO> queryByPatientAndStatusIn(String patient, Integer[] status, Sort sort);
    EmergencyAssistanceDO findByPatientAndStatus(String patient,Integer status);
    List<EmergencyAssistanceDO> findByPatientAndStatus(String patient,Integer status);
    EmergencyAssistanceDO findByProxyPatientAndStatus(String proxyPatient,Integer status);
    List<EmergencyAssistanceDO> findByProxyPatientAndStatus(String proxyPatient,Integer status);
}

+ 5 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/assistance/EmergencyAssistanceEndpoint.java

@ -49,7 +49,7 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "doctorGetOrderDetail")
    @ApiOperation(value = "医生查看救助详情")//不可查看已取消
    @ApiOperation(value = "医生查看救助详情")
    public ObjEnvelop doctorGetOrderDetail(@ApiParam(name="orderId",value = "工单id")
                                     @RequestParam(value = "orderId") String orderId,
                                     @ApiParam(name="doctor",value = "doctor")
@ -198,9 +198,9 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "医生编辑救助服务小结")
    @ObserverRequired
    public ObjEnvelop updateConclusion(@ApiParam(value = "字典emergency_reason值",name = "emergency_reason",required = true)
                                       @RequestParam Integer emergency_reason,
                                       @RequestParam(value = "emergency_reason") Integer emergency_reason,
                                       @ApiParam(value = "字典emergency_treatment_status值",name = "treatment_status",required = true)
                                       @RequestParam Integer treatment_status,
                                       @RequestParam(value = "treatment_status") Integer treatment_status,
                                       @ApiParam(value = "工单id", name = "orderId")
                                       @RequestParam(value = "orderId") String orderId,
                                       @ApiParam(value = "服务小结", name = "conclusion")
@ -260,7 +260,7 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("定位更新成功",result.getJSONObject("resultMsg"));
            return ObjEnvelop.getSuccess("定位更新成功",result.getString("resultMsg"));
        }catch (Exception e){
            e.printStackTrace();
            return ObjEnvelop.getError("定位更新失败"+e.getMessage());
@ -331,7 +331,7 @@ public class EmergencyAssistanceEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop errorWarning(@ApiParam(value = "工单id", name = "orderId", required = true)
                                   @RequestParam(value = "orderId") String orderId,
                                   @ApiParam(value = "误报警类型 字典emergency_cancel的code", name = "emergencyCancel", required = true)
                                   @RequestParam(value = "doctor", defaultValue = "4") Integer emergencyCancel){
                                   @RequestParam(value = "emergencyCancel", defaultValue = "4") Integer emergencyCancel){
        try {
            JSONObject result = assistanceService.errorWarning(orderId,emergencyCancel,getUID());
            if (result.getIntValue("resultFlag") == 0) {

+ 34 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/DoctorDoorCoachOrderController.java

@ -4,13 +4,18 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.doorCoach.DoctorDoorCoachOrderService;
import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachConclusionDO;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachOrderDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -40,6 +45,10 @@ public class DoctorDoorCoachOrderController extends BaseController {
    private PatientDoorCoachOrderService patientDoorCoachOrderService;
    @Autowired
    private DoctorDoorCoachOrderService doctorDoorCoachOrderService;
    @Autowired
    private ImService imService;
    @Autowired
    private ConsultTeamService consultTeamService;
    @PostMapping(value = "proxyCreate")
    @ApiOperation(value = "创建上门预约咨询--医生代预约")
@ -508,6 +517,8 @@ public class DoctorDoorCoachOrderController extends BaseController {
        }
    }
    /**
     * 获取服务项目
     *
@ -589,4 +600,27 @@ public class DoctorDoorCoachOrderController extends BaseController {
            return error(-1, "操作失败!");
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.DodtorIM.getConsultInfoAndPatientInfo)
    @ApiOperation(value = "获取咨询问题,图片,居民信息", notes = "获取咨询问题,图片,居民信息")
    public ObjEnvelop getConsultInfoAndPatientInfo(
            @ApiParam(name = "consult", value = "咨询CODE")
            @RequestParam(value = "consult",required = false) String consult,
            @ApiParam(name = "patientCode", value = "居民COEE")
            @RequestParam(value = "patientCode",required = false) String patientCode)throws Exception {
        return ObjEnvelop.getSuccess("请求成功", imService.getConsultInfoAndPatientInfo(consult, patientCode));
    }
    @RequestMapping(value = "queryByConsultCode",method = RequestMethod.GET)
    @ApiOperation("根据咨询code查询关联业务项详情")
    public ObjEnvelop queryByConsultCode(@ApiParam(name = "code", value = "咨询code") @RequestParam(value = "code", required = true) String code,
                                     @ApiParam(name = "type", value = "咨询类型") @RequestParam(value = "type", required = true) Integer type){
        try{
            JSONObject detail = consultTeamService.queryByConsultCode(code,type);
            return ObjEnvelop.getSuccess("查询成功", detail.get("data"));
        }catch (Exception e){
            error(e);
            return ObjEnvelop.getError("查询失败");
        }
    }
}

+ 3 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doorCoach/PatientDoorCoachOrderController.java

@ -57,8 +57,7 @@ public class PatientDoorCoachOrderController extends EnvelopRestEndpoint {
        try{
            result = patientDoorCoachOrderService.create(jsonData);
        }catch (Exception e){
            e.printStackTrace();
            return failed(e.getMessage());
            return failedException(e);
        }
        if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
            return failed(result.getString(ResponseContant.resultMsg));
@ -96,8 +95,7 @@ public class PatientDoorCoachOrderController extends EnvelopRestEndpoint {
                return failed(result.getString(ResponseContant.resultMsg));
            }
        }catch (Exception e){
            e.printStackTrace();
            return failed(e.getMessage());
            return failedException(e);
        }
        return success(result.get(ResponseContant.resultMsg));
@ -194,7 +192,7 @@ public class PatientDoorCoachOrderController extends EnvelopRestEndpoint {
                // 根据接单医生code获取最近一次服务orderId
                orderId = patientDoorCoachOrderService.getOrderIdByPatient(patientCode);
                if (StringUtils.isEmpty(orderId)) {
                    return ObjEnvelop.getError( "获取失败, 该医生暂无工单" );
                    return ObjEnvelop.getSuccess( "获取失败, 该医生暂无工单",null);
                }
            }
            // 根据orderId获取工单信息

+ 2 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/message/PatientMessageEndpoint.java

@ -79,8 +79,8 @@ public class PatientMessageEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = "/updateMessageRead")
    @ApiOperation("已读消息")
    public Envelop updateMessageRead(@ApiParam(name = "messageId",required = true)
                                         @RequestParam(value = "patient")String messageId){
                                         @RequestParam(value = "messageId")String messageId){
        patientMessageService.updateMessageRead(messageId);
        return Envelop.getSuccess("查询成功");
        return Envelop.getSuccess("修改成功");
    }
}

+ 11 - 8
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/security/SecurityMonitoringOrderEndpoint.java

@ -8,6 +8,7 @@ import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -49,7 +50,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "getSecurityOrderList")
    @ApiOperation(value = "获取安防工单列表")
    public ListEnvelop getSecurityOrderList(@ApiParam(name="doctor",value = "医生ID,当前查看列表医生",required = false)
    public PageEnvelop getSecurityOrderList(@ApiParam(name="doctor",value = "医生ID,当前查看列表医生",required = false)
                                            @RequestParam(value = "doctor",required = false)String doctor,
                                            @ApiParam(name="serverDoctor",value = "处置医生di 即为患者提供服务的医生")
                                            @RequestParam(value = "serverDoctor",required = false)String serverDoctor,
@ -66,10 +67,10 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
        try {
            page = page>1?page-1:0;
            return ListEnvelop.getSuccess("查询成功",securityMonitoringOrderService.getSecurityOrderList(doctor,serverDoctor,patientName, patient, status, page, pageSize));
            return securityMonitoringOrderService.getSecurityOrderList(doctor,serverDoctor,patientName, patient, status, page, pageSize);
        }catch (Exception e){
            e.printStackTrace();
            return ListEnvelop.getError("查询失败");
            return PageEnvelop.getError("查询失败");
        }
    }
@ -90,10 +91,12 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "getSecurityOrderDetail")
    @ApiOperation(value = "获取安防工单详情")//
    public ObjEnvelop getSecurityOrderDetail(@ApiParam(name="orderId",value = "orderId",required = true)
                                            @RequestParam(value = "orderId")String orderId){
                                            @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);
            JSONObject result = securityMonitoringOrderService.getSecurityOrderDetail(orderId,doctor);
            if (result.getIntValue("resultFlag") == 0) {
                return ObjEnvelop.getError(result.getString("resultMsg"));
            }
@ -109,7 +112,7 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop errorWarning(@ApiParam(value = "工单id", name = "orderId", required = true)
                                   @RequestParam(value = "orderId") String orderId,
                                   @ApiParam(value = "误报警类型 字典emergency_cancel的code", name = "emergencyCancel", required = true)
                                   @RequestParam(value = "doctor", defaultValue = "4") Integer emergencyCancel){
                                   @RequestParam(value = "emergencyCancel", defaultValue = "4") Integer emergencyCancel){
        try {
            JSONObject result = securityMonitoringOrderService.errorWarning(orderId,emergencyCancel,getUID());
            if (result.getIntValue("resultFlag") == 0) {
@ -196,9 +199,9 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    @ApiOperation("编辑保存服务工单小结")
    public ObjEnvelop updateDoorConclusion(
            @ApiParam(value = "字典emergency_reason值",name = "emergency_reason",required = true)
            @RequestParam Integer emergency_reason,
            @RequestParam(value = "emergency_reason") Integer emergency_reason,
            @ApiParam(value = "字典emergency_treatment_status值",name = "treatment_status",required = true)
            @RequestParam Integer treatment_status,
            @RequestParam(value = "treatment_status") Integer treatment_status,
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId") String orderId,
            @ApiParam(value = "服务小结", name = "conclusion")

+ 48 - 23
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/assistance/EmergencyAssistanceService.java

@ -218,10 +218,10 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            }
        }
        emergencyAssistanceDao.save(assistanceDO);
        return getOrderDetail(assistanceDO.getId());
        return getOrderDetail(assistanceDO.getId(),null);
    }
    public JSONObject getOrderDetail(String orderID){
    public JSONObject getOrderDetail(String orderID,String doctor){
        JSONObject result = new JSONObject();
        EmergencyOrderVO emergencyOrderVO = new EmergencyOrderVO();
        EmergencyAssistanceDO assistanceDO = emergencyAssistanceDao.findOne(orderID);
@ -231,6 +231,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        emergencyOrderVO.setId(assistanceDO.getId());
        if (assistanceDO.getOrderSource()==2){//手环发起的紧急救助获取手环坐标
            try {
                List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByUserAndCategoryCode(assistanceDO.getPatient(),"4");
@ -276,6 +277,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        emergencyOrderVO.setPatient(assistanceDO.getPatient());
        emergencyOrderVO.setPatientName(assistanceDO.getPatientName());
        emergencyOrderVO.setSex(patientDO.getSex());
        emergencyOrderVO.setPhone(assistanceDO.getPatientPhone());
        if(StringUtils.isNotBlank(patientDO.getIdcard())){
            emergencyOrderVO.setAge((IdCardUtil.getAgeForIdcard(patientDO.getIdcard()))+"");
@ -319,10 +321,21 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            Map<String,Object> tmp = new HashMap<>();
            tmp.put("name","系统预警");
            tmp.put("status",0);
            tmp.put(statusName,"未读");
            if (assistanceDO.getOrderSource()==2){
                Map<String,Object> tmp2 = new HashMap<>();
                tmp2.put("name","电话通知");
                tmp2.put("status",0);
                tmp2.put(statusName,"未呼叫");
                arr.add(tmp2);
            }
            SystemMessageDO messageDO = systemMessageDao.findByRelationCodeAndReceiver(assistanceDO.getId(),patientId);
            if (messageDO != null){
                if (StringUtils.isNotBlank(messageDO.getIsRead())){
                    tmp.put("status",Integer.parseInt(messageDO.getIsRead()));
                    if (Integer.parseInt(messageDO.getIsRead())==1){
                        tmp.put(statusName,"已读");
                    }
                }
            }
            arr.add(tmp);
@ -347,8 +360,10 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            Map<String,Object> tmp = new HashMap<>();
            tmp.put("name","系统预警");
            tmp.put("status",0);
            tmp.put("statusName","未响应");
            if (emergencyWarnDoctorResponseDao.findByDoctorAndOrderId(doctorDO.getId(),assistanceDO.getId())!=null){
                tmp.put("status",1);
                tmp.put("statusName","已响应");
            }
            arr.add(tmp);
            noticeObj.put("response",arr);
@ -403,9 +418,20 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        if (null != consult) {
            String sessionId = assistanceDO.getPatient() + "_" + consult.getId() + "_" + consult.getType();
            jsonObject.put("sessionId",sessionId);
            if (1==assistanceDO.getStatus()&&StringUtils.isNotBlank(doctor)){//查询未读数量
                try {
                    Integer count = imUtill.UserSessionsUnreadMessageCount(sessionId,doctor);
                    jsonObject.put("UnRead",count);
                }catch (Exception e){
                    jsonObject.put("sessionId",sessionId);
                    jsonObject.put("UnRead",0);
                }
            }
        }
        else {
            jsonObject.put("sessionId",null);
            jsonObject.put("UnRead",0);
        }
        result.put(ResponseContant.resultFlag, ResponseContant.success);
        result.put(ResponseContant.resultMsg,jsonObject);
@ -433,13 +459,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        if (assistanceDO.getStatus()==-1){
            String failMsg = "当前工单已取消 无法查看";
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        return getOrderDetail(orderID);
        return getOrderDetail(orderID,doctor);
    }
    /**
@ -469,7 +489,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
//            result.put(ResponseContant.resultMsg,failMsg);
//            return result;
//        }
        return getOrderDetail(orderID);
        return getOrderDetail(orderID,null);
    }
    /**
@ -480,6 +500,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
    public JSONObject getTabStatusCounts(String patient,String doctor){
        JSONObject result = new JSONObject();
        JSONObject tmpObj = new JSONObject();
        tmpObj.put("status_-2",0);//误报警
        tmpObj.put("status_-1",0);//已取消
        tmpObj.put("status_0",0);//已完成
        tmpObj.put("status_1",0);//申请中
@ -512,15 +533,15 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
    public JSONObject existApplyStatus(String patient){
        JSONObject result = new JSONObject();
        JSONObject tmpObj = new JSONObject();
        EmergencyAssistanceDO assistanceDO = emergencyAssistanceDao.findByProxyPatientAndStatus(patient,1);
        if (assistanceDO==null){
        List<EmergencyAssistanceDO> assistanceDO = emergencyAssistanceDao.findByProxyPatientAndStatus(patient,1);
        if (assistanceDO.size()==0){
            tmpObj.put("exist","false");
            result.put(ResponseContant.resultFlag, ResponseContant.success);
            result.put(ResponseContant.resultMsg,tmpObj);
            return result;
        }
        else {
            JSONObject detail  = getOrderDetail(assistanceDO.getId());
            JSONObject detail  = getOrderDetail(assistanceDO.get(0).getId(),null);
            tmpObj.put("exist","true");
            tmpObj.put("assistanceDO",detail.getJSONObject("resultMsg"));
            result.put(ResponseContant.resultFlag, ResponseContant.success);
@ -681,7 +702,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            return result;
        }
        emergencyAssistanceDao.save(assistanceDO);
        return getOrderDetail(orderId);
        return getOrderDetail(orderId,null);
    }
    public JSONObject updateDoctorLocation(String doctor,String orderId,String doctorAddress,String doctorLat,String doctorLon){
@ -707,7 +728,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
                assistanceDO.setDoctorLat(doctorLat);
                assistanceDO.setDoctorLon(doctorLon);
                emergencyAssistanceDao.save(assistanceDO);
                return getOrderDetail(orderId);
                return getOrderDetail(orderId,null);
            }
        }
        else {
@ -726,13 +747,17 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
            result.put(ResponseContant.resultMsg,failMsg);
            return result;
        }
        EmergencyAssistanceDO assistanceDO = emergencyAssistanceDao.findByPatientAndStatus(patient,1);
        if (assistanceDO!=null){
            assistanceDO.setServeAddress(patientAddress);
            assistanceDO.setServeLat(patientLat);
            assistanceDO.setServeLon(patientLon);
            emergencyAssistanceDao.save(assistanceDO);
            return getOrderDetail(assistanceDO.getId());
        List<EmergencyAssistanceDO> assistanceDO = emergencyAssistanceDao.findByPatientAndStatus(patient,1);
        if (assistanceDO.size()>0){
            for (EmergencyAssistanceDO tmp:assistanceDO){
                tmp.setServeAddress(patientAddress);
                tmp.setServeLat(patientLat);
                tmp.setServeLon(patientLon);
                emergencyAssistanceDao.save(tmp);
            }
            result.put(ResponseContant.resultFlag, ResponseContant.success);
            result.put(ResponseContant.resultMsg,"查询成功");
        }
        else {
            result.put(ResponseContant.resultFlag, ResponseContant.success);
@ -781,7 +806,7 @@ public class EmergencyAssistanceService extends BaseJpaService<EmergencyAssistan
        assistanceDO.setEmergencyCancel(emergencyCancel);
        emergencyAssistanceDao.save(assistanceDO);
        result = getOrderDetail(orderId);
        result = getOrderDetail(orderId,null);
        return result;
    }

+ 7 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/consult/ConsultTeamService.java

@ -65,6 +65,8 @@ public class ConsultTeamService {
    private SystemMessageDao systemMessageDao;
    @Autowired
    private PatientDoorCoachOrderService doorCoachOrderService;
    @Autowired
    private PatientDoorCoachOrderService patientDoorCoachOrderService;
    public JSONObject updateIMMsg(String sessionId,String sessionType,String msgId,String content){
@ -105,9 +107,9 @@ public class ConsultTeamService {
        }
        switch (type) {
            case 20:
//                WlyyDoorServiceOrderDO orderDO = wlyyDoorServiceOrderDao.findOne(consult.getRelationCode());
//                JSONObject patientInfo = wlyyDoorServiceOrderService.queryOrderCardInfo(orderDO);
            case 21:
                BaseDoorCoachOrderDO orderDO = baseDoorCoachOrderDao.findOne(consult.getRelationCode());
                JSONObject patientInfo = patientDoorCoachOrderService.queryOrderCardInfo(orderDO);
                result.put("data", patientInfo);
                break;
            default:
@ -486,4 +488,6 @@ public class ConsultTeamService {
        }
        return true;
    }
}

+ 24 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/course/CourseService.java

@ -24,6 +24,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -435,18 +436,40 @@ public class CourseService {
        String sql = "SELECT id,`name`,longitude,latitude FROM base.base_org where del = 1 and type = 4";
        List<Map<String , Object>> positionList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = new ArrayList<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String nowDate = sdf.format(new Date());
        if (positionList.size() > 0){
            for (int i=0;i<positionList.size();i++){
                String sql1 = "SELECT id,`name`,photo,address,longitude,latitude ,funDistance("+positionList.get(i).get("latitude")+","+positionList.get(i).get("longitude")+","+lat2+","+lon2+") funDistance FROM base.base_org where id = '"+positionList.get(i).get("id")+"'";
                String sql1 = "SELECT id,code,`name`,mobile,photo,address,longitude,latitude ,funDistance("+positionList.get(i).get("latitude")+","+positionList.get(i).get("longitude")+","+lat2+","+lon2+") funDistance FROM base.base_org where id = '"+positionList.get(i).get("id")+"'";
                List<Map<String , Object>> mapList = jdbcTemplate.queryForList(sql1);
                Integer num = 0;
                // 判断该机构是否开放报名
                String ksbm = "SELECT COUNT(1) a FROM base_recruit_students WHERE '"+nowDate+"' > create_time AND '"+nowDate+"' < end_time AND del = 1 AND org_code = '"+mapList.get(0).get("code")+"'";
                num = jdbcTemplate.queryForObject(ksbm,Integer.class);
                if (num > 0){
                    String sqlNum = "SELECT allm.num - bbm.num num\n" +
                            "FROM (SELECT num FROM base_recruit_students WHERE org_code = '"+mapList.get(0).get("code")+"') allm,(\n" +
                            "SELECT COUNT(rsr.id) num FROM base_recruit_students rs,base_recruit_students_record rsr WHERE '"+nowDate+"' >rs.start_time AND rs.org_code = '"+mapList.get(0).get("code")+"'\n" +
                            "AND '"+nowDate+"' < rs.end_time AND rs.del = 1 AND rs.id = rsr.recruit_students_id AND rsr.status IN (2,3,6)) bbm";
                    num = jdbcTemplate.queryForObject(sqlNum,Integer.class);
                } else {
                    num = -1; //未开放报名
                }
                String sqlCourse = "SELECT GROUP_CONCAT(DISTINCT `name` SEPARATOR '、') course FROM base_course WHERE org_code = '"+mapList.get(0).get("code")+"' AND del = 1";
                String course = jdbcTemplate.queryForObject(sqlCourse,String.class);
                JSONObject obj = new JSONObject();
                obj.put("id",mapList.get(0).get("id"));
                obj.put("orgCode",mapList.get(0).get("code"));
                obj.put("name",mapList.get(0).get("name"));
                obj.put("photo",mapList.get(0).get("photo"));
                obj.put("address",mapList.get(0).get("address"));
                obj.put("longitude",mapList.get(0).get("longitude"));
                obj.put("latitude",mapList.get(0).get("latitude"));
                obj.put("mobile",mapList.get(0).get("mobile"));
                obj.put("funDistance",mapList.get(0).get("funDistance"));
                obj.put("num",num);
                obj.put("course",course);
                list.add(obj);
            }
            if (list.size() > 0){

+ 25 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -796,7 +796,18 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    |
     */
    public com.alibaba.fastjson.JSONObject updAqgDeviceSosInfo(String deviceSn,String seqid,String name,String num,String dial_flag,String clear){
        String url = MessageFormat.format(AqgConfig.sos_numbers, deviceSn,seqid);
        List<DevicePatientDevice> devices = patientDeviceDao.findByDeviceSn(deviceSn);
        String url ="";
        if ("4".equals(devices.get(0).getCategoryCode())){//手表
            Device device = deviceDao.findOne(devices.get(0).getDeviceId());
            if (device!=null){
                if ("X1".equals(device.getModel())){
                    url = MessageFormat.format(AqgConfig.X1sos_numbers, deviceSn,seqid);
                }
            }
        }else {
            url = MessageFormat.format(AqgConfig.sos_numbers, deviceSn,seqid);
        }
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        if(StringUtils.isBlank(clear)){
            param.add("name", name);
@ -818,7 +829,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     * @throws Exception
     */
    public com.alibaba.fastjson.JSONObject getDeviceLastLocation(String deviceSn,String type) throws Exception{
        String url = MessageFormat.format(AqgConfig.device_last_locationdata, deviceSn);
        String url = MessageFormat.format(AqgConfig.device_last_locationData, deviceSn);
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        param.add("type", type);
        HttpEntity<com.alibaba.fastjson.JSONObject> response = httpClientUtil.aqgCookieHttp(url, param, HttpMethod.GET, getCookie());
@ -858,7 +869,18 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
     */
    public com.alibaba.fastjson.JSONObject updateDeviceFenceArea(String deviceSn,Integer fenceNO,String enable,String name,String freq,
                                                                 String time_begin,String time_end,String safe_area ,String clear) throws Exception{
        String url = MessageFormat.format(AqgConfig.fence_area, deviceSn,fenceNO);
        List<DevicePatientDevice> devices = patientDeviceDao.findByDeviceSn(deviceSn);
        String url ="";
        if ("4".equals(devices.get(0).getCategoryCode())){//手表
            Device device = deviceDao.findOne(devices.get(0).getDeviceId());
            if (device!=null){
                if ("X1".equals(device.getModel())){
                    url = MessageFormat.format(AqgConfig.X1fence_area, deviceSn,fenceNO);
                }
            }
        }else {
            url = MessageFormat.format(AqgConfig.S3fence_area, deviceSn,fenceNO);
        }
        MultiValueMap<String, String> param = new LinkedMultiValueMap<>();
        if(StringUtils.isBlank(clear)){
            if (StringUtils.isNotBlank(safe_area)){

+ 0 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/DoctorDoorCoachOrderService.java

@ -967,7 +967,6 @@ public class DoctorDoorCoachOrderService {
                    map.put("position",hospital1.getLongitude()+","+hospital1.getLatitude());
                }
            }
            logger.info("服务医生人员sql:"+finalSql);
        } catch (Exception e) {
            result.put(ResponseContant.resultFlag, ResponseContant.fail);
            result.put(ResponseContant.resultMsg, "从数据库查询 服务医生人员 列表信息失败:" + e.getMessage());

+ 3 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java

@ -353,7 +353,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
    }
    public List<Map<String,Object>> selectItemsByHospital(String hospital,String serverItemName){
        String sql ="select dict_code code,dict_value name,ext1 fee from base_business_sys_dict where 1=1 ";
        String sql ="select org_code,dict_code code,dict_value name,ext1 fee from base_business_sys_dict where dict_name='DOOR_APPLY_ITEM' ";
        if (StringUtils.isNotBlank(hospital)){
            sql +=" and org_code='"+hospital+"' ";
        }
@ -361,6 +361,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
            sql += " and dict_value like '%"+serverItemName+"%' ";
        }
        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql);
        return result;
    }
@ -561,7 +562,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
        }
        result.put("serveTown",orderDO.getServeTown());
        result.put("serveAddress",orderDO.getServeAddress());
        result.put("type",11);
        result.put("type",21);
        return result;
    }
    /**

+ 40 - 17
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/security/SecurityMonitoringOrderService.java

@ -21,6 +21,7 @@ import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.restmodel.emergency.EmergencyOrderVO;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.care.util.MessageUtil;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -215,7 +216,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        return result;
    }
    public JSONObject getSecurityOrderDetail(String orderID){
    public JSONObject getSecurityOrderDetail(String orderID,String doctor){
        JSONObject result = new JSONObject();
        EmergencyOrderVO emergencyOrderVO = new EmergencyOrderVO();
        SecurityMonitoringOrderDO orderDO = securityMonitoringOrderDao.findOne(orderID);
@ -226,6 +227,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            logger.error(failMsg);
            return result;
        }
        emergencyOrderVO.setId(orderDO.getId());
        BasePatientDO patientDO = basePatientDao.findById(orderDO.getPatient());
        Integer statustemp = Integer.valueOf(orderDO.getStatus()+"");
        String statusName = "";
@ -295,10 +297,14 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            Map<String,Object> tmp = new HashMap<>();
            tmp.put("name","系统预警");
            tmp.put("status",0);
            tmp.put(statusName,"未读");
            SystemMessageDO messageDO = systemMessageDao.findByRelationCodeAndReceiver(orderDO.getId(),patientId);
            if (messageDO != null){
                if (StringUtils.isNotBlank(messageDO.getIsRead())){
                    tmp.put("status",Integer.parseInt(messageDO.getIsRead()));
                    if (Integer.parseInt(messageDO.getIsRead())==1){
                        tmp.put(statusName,"已读");
                    }
                }
            }
            arr.add(tmp);
@ -327,8 +333,10 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                Map<String,Object> tmp = new HashMap<>();
                tmp.put("name","系统预警");
                tmp.put("status",0);
                tmp.put("statusName","未响应");
                if (emergencyWarnDoctorResponseDao.findByDoctorAndOrderId(doc.getId(),orderDO.getId())!=null){
                    tmp.put("status",1);
                    tmp.put("statusName","已响应");
                }
                arr.add(tmp);
                noticeObj.put("response",arr);
@ -357,9 +365,20 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        if (null != consult) {
            String sessionId = orderDO.getPatient() + "_" + consult.getId() + "_" + consult.getType();
            jsonObject.put("sessionId",sessionId);
            if (1==orderDO.getStatus()&&StringUtils.isNotBlank(doctor)){//查询未读数量
                try {
                    Integer count = imUtil.UserSessionsUnreadMessageCount(sessionId,doctor);
                    jsonObject.put("UnRead",count);
                }catch (Exception e){
                    jsonObject.put("sessionId",sessionId);
                    jsonObject.put("UnRead",0);
                }
            }
        }
        else {
            jsonObject.put("sessionId",null);
            jsonObject.put("UnRead",0);
        }
        result.put("resultFlag", 1);
@ -387,34 +406,38 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        orderDO.setEmergencyCancel(emergencyCancel);
        securityMonitoringOrderDao.save(orderDO);
        result = getSecurityOrderDetail(orderId);
        result = getSecurityOrderDetail(orderId,null);
        return result;
    }
    public JSONArray getSecurityOrderList(String doctor,String serverDoctor,String patientName, String patient, String status, Integer page, Integer pageSize){
    public PageEnvelop getSecurityOrderList(String doctor, String serverDoctor, String patientName, String patient, String status, Integer page, Integer pageSize){
        String sqlCount = "select count(ord.id) from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                "where 1=1 ";
        String fliter = "  ";
        String sql = " select p.id patientCode,p.name,p.sex,p.photo,p.idcard,ord.id orderId,ord.number,ord.serve_desc,ord.create_time,ord.`status`,ord.doctor," +
                "ord.doctor_name,ord.patient_phone,ord.conclusion_status from base_security_monitoring_order ord INNER JOIN base_patient p on p.id = ord.patient " +
                "where 1=1 ";
        if (StringUtils.isNotBlank(doctor)){
            sql+=" and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
            fliter+=" and  EXISTS ( SELECT 1 from base_service_package_sign_record sr,base_service_package_record r, base_service_package_item i ," +
                    "base_team_member m " +
                    "where ord.patient = CONVERT(sr.patient USING utf8) and  sr.id = r.sign_id and sr.status=1 and " +
                    " r.service_package_id = i.service_package_id and  m.team_code = i.team_code  and i.del = 1 and sr.`status`=1  and i.code='preventLost' and m.doctor_code = '"+doctor+"' and m.del = '1') ";
        }
        if (StringUtils.isNotBlank(serverDoctor)){
            sql +=" and ord.doctor = '"+serverDoctor+"' ";
            fliter +=" and ord.doctor = '"+serverDoctor+"' ";
        }
        if (StringUtils.isNotBlank(patientName)){
            sql+=" and (ord.patient_name like '%"+patientName+"%' or p.idcard='"+patientName+"')  ";
            fliter+=" and (ord.patient_name like '%"+patientName+"%' or p.idcard='"+patientName+"')  ";
        }
        if (StringUtils.isNotBlank(patient)){
            sql+=" and ord.patient='"+patient+"' ";
            fliter+=" and ord.patient='"+patient+"' ";
        }
        if (StringUtils.isNotBlank(status)){
            sql+=" and ord.status='"+Integer.parseInt(status)+"' ";
            fliter+=" and ord.status='"+Integer.parseInt(status)+"' ";
        }
        sql+=" order by ord.create_time desc limit " + (page*pageSize) + "," + pageSize;
        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql);
        Long count = jdbcTemplate.queryForObject(sqlCount+fliter,Long.class);
        fliter+=" order by ord.create_time desc limit " + (page*pageSize) + "," + pageSize;
        List<Map<String,Object>> sqlResult = jdbcTemplate.queryForList(sql+fliter);
        JSONArray result = new JSONArray();
        for (Map<String,Object>one:sqlResult){
@ -462,7 +485,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                tmp.put("deviceFlag","0");
            }
        }
        return result;
        return PageEnvelop.getSuccessListWithPage("success",result,page,pageSize,count);
    }
    public List<Map<String,Object>> getSecurityOrderUnCompleteList(String doctor){
        List<Map<String,Object>> result = new ArrayList<>();
@ -638,7 +661,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        //  待接单消息设为已操作, 434 医生接单-- 王五接受了服务工单12345678
//        messageUtil.createMessage("医生接单","634",doorServiceOrder.getPatient(),doorServiceOrder.getPatientName(),
//                doorServiceOrder.getId(), doorServiceOrder.getDoctor(),doorServiceOrder.getDoctorName() ,null, doorServiceOrder.getDoctorName() + "接受了服务工单"+ doorServiceOrder.getNumber());
        return getSecurityOrderDetail(orderId);
        return getSecurityOrderDetail(orderId,null);
    }
@ -721,7 +744,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
//        }
//        pushMsgTask.putWxMsg(tokenUtils.getAccessToken(), 30, patient.getOpenid(), patient.getName(), json);
        result = getSecurityOrderDetail(orderId);
        result = getSecurityOrderDetail(orderId,null);
        return result;
    }
@ -763,7 +786,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            return getSecurityOrderDetail(orderId);
        }*/
        return getSecurityOrderDetail(orderId);
        return getSecurityOrderDetail(orderId,null);
    }
    /**
@ -825,7 +848,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        one.setStatus(SecurityMonitoringOrderDO.Status.complete.getType());//已完成
        one.setConclusionStatus(2);
        securityMonitoringOrderDao.save(one);
        return getSecurityOrderDetail(orderId);
        return getSecurityOrderDetail(orderId,null);
    }
    /**
@ -846,7 +869,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
            throw new Exception(failMsg);
        }
        securityMonitoringOrderDao.updateConclusionStatus(orderId);
        return getSecurityOrderDetail(orderId);
        return getSecurityOrderDetail(orderId,null);
    }
    /**
@ -901,7 +924,7 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
//        // 发送微信通知  待付款
//        BasePatientDO patient = basePatientDao.findById(one.getPatient());
        return getSecurityOrderDetail(orderId);
        return getSecurityOrderDetail(orderId,null);
    }
    /**