Browse Source

Merge branch 'dev' of liubing/wlyy2.0 into dev

liubing 3 years ago
parent
commit
d3a2941ddf

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/SystemMessageDao.java

@ -70,6 +70,6 @@ public interface SystemMessageDao extends PagingAndSortingRepository<SystemMessa
    void delMessageByRelationCode(List<String> relationCode);
    @Modifying
    @Query("update SystemMessageDO m set m.isRead=1 ,m.over=0 where m.type=?1 and m.relationCode=?2 ")
    void readByTypeAndRelationCode(String type,String relationCode);
    @Query("update SystemMessageDO m set m.isRead=1 ,m.over=0,m.data=?3 where m.type=?1 and m.relationCode=?2 ")
    void readByTypeAndRelationCode(String type,String relationCode,String data);
}

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

@ -1,7 +1,9 @@
package com.yihu.jw.care.endpoint.message;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.aop.ObserverRequired;
import com.yihu.jw.care.service.message.PatientMessageService;
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;
@ -125,8 +127,12 @@ public class PatientMessageEndpoint extends EnvelopRestEndpoint {
                                 @ApiParam(name = "safe_area",value = "lon1,lat1;lon2,lat2; 5个坐标 形成一个封闭区域  A;B;C;D;A ")
                                 @RequestParam(value = "safe_area",required = false)String safe_area){
        try {
            patientMessageService.ConfirmFences(messageId,safe_area);
            return Envelop.getSuccess("已确认");
            JSONObject result = patientMessageService.ConfirmFences(messageId,safe_area);
            if (result.getInteger(ResponseContant.resultFlag)==ResponseContant.success){
                return ObjEnvelop.getSuccess("已确认","");
            }else {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
        }catch (Exception e){
            return failedException2(e);
        }

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

@ -350,9 +350,15 @@ public class SecurityMonitoringOrderEndpoint extends EnvelopRestEndpoint {
    @ResponseBody
    public ObjEnvelop findMonitorPatientsByDoctor(@ApiParam(name = "doctor",  required = true)@RequestParam(value = "doctor")String doctor,
                                                  @ApiParam(name = "topicItem", value = "专题code,关联security_topic_dict字典", required = true)
                                                  @RequestParam(value = "topicItem",required = true,defaultValue = "preventLost") String topicItem) {
                                                  @RequestParam(value = "topicItem",required = true,defaultValue = "preventLost") String topicItem,
                                                  @ApiParam(name = "page")
                                                  @RequestParam(value = "page",required = false) Integer page,
                                                  @ApiParam(name = "pageSize")
                                                  @RequestParam(value = "pageSize",required = false) Integer pageSize,
                                                  @ApiParam(name = "detail", value = "是否返回专题详情0否 1是")
                                                  @RequestParam(value = "detail",required = false,defaultValue = "0") Integer detail) {
        try {
            return ObjEnvelop.getSuccess( "查询成功", securityMonitoringOrderService.findMonitorPatientsByDoctor(doctor,topicItem));
            return ObjEnvelop.getSuccess( "查询成功", securityMonitoringOrderService.findMonitorPatientsByDoctor(doctor,topicItem,page,pageSize,detail));
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }

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

@ -1931,7 +1931,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                patientSafeAreaConfirm.setManageStatus(0);
                for (Map<String,Object> tmp:relatives){
                    messageUtil.saveSystemMessage("",patient,"监护确认","44",doctorDO.getId(),doctorDO.getName(),tmp.get("id").toString(),
                            tmp.get("name").toString(),null,null,"0" );
                            tmp.get("name").toString(),null,"0","0" );
                }
            }else {//无家属 直接确认
                patientSafeAreaConfirm.setManageStatus(1);

+ 16 - 6
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/message/PatientMessageService.java

@ -21,6 +21,7 @@ import com.yihu.jw.entity.care.securitymonitoring.BaseEmergencyWarnLogDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
@ -184,12 +185,16 @@ public class PatientMessageService {
     * @param safe_area
     */
    @Transactional(rollbackFor =Exception.class )
    public void ConfirmFences(String msgId,String safe_area){
    public JSONObject ConfirmFences(String msgId,String safe_area){
        JSONObject result = new JSONObject();
        SystemMessageDO systemMessageDO = systemMessageDao.findOne(msgId);
        if (systemMessageDO!=null){
            systemMessageDO.setDel("0");
            systemMessageDao.save(systemMessageDO);
        if ("1".equals(systemMessageDO.getData())){
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"已有家属确认管理,无需再次确认!");
            return result;
        }
        List<PatientSafeAreaDO> patientSafeAreaDOs = patientSafeAreaDao.findByPatient2(systemMessageDO.getRelationCode());
        PatientSafeAreaDO patientSafeAreaDO = null;
@ -197,7 +202,9 @@ public class PatientMessageService {
            patientSafeAreaDO = patientSafeAreaDOs.get(0);
        }else {
            return;
            result.put(ResponseContant.resultFlag,ResponseContant.fail);
            result.put(ResponseContant.resultMsg,"居民未绑定防走失设备!");
            return result;
        }
        if (StringUtils.isNotBlank(safe_area)&&null != patientSafeAreaDO){
            patientSafeAreaDO.setSafeAreaGz(safe_area);
@ -211,6 +218,9 @@ public class PatientMessageService {
        //修改数据
        patientSafeAreaConfirmDao.manageByPatient(patientSafeAreaDO.getPatient());
        systemMessageDao.readByTypeAndRelationCode(patientSafeAreaDO.getPatient(),"44");
        systemMessageDao.readByTypeAndRelationCode("44",patientSafeAreaDO.getPatient(),"1");
        result.put(ResponseContant.resultFlag,ResponseContant.success);
        result.put(ResponseContant.resultMsg,"已确认");
        return result;
    }
}

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

@ -1575,6 +1575,11 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
                        JSONObject locationTmp = response.getJSONObject("last_location");
                        Double lon = locationTmp.getJSONArray("coordinates").getDouble(0);
                        Double lat = locationTmp.getJSONArray("coordinates").getDouble(1);
                        if (!response.getBoolean("online")){//设备离线 取居民表定位
                            result.put("X1online",false);
                        }else {
                            result.put("X1online",true);
                        }
                        JSONObject tmp = gpsUtil.gcj02_To_Bd09(lat,lon);
                        tmp.put("city",response.getString("last_city"));
                        tmp.put("province",response.getString("last_province"));
@ -2058,7 +2063,9 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        }
    }
    public List<Map<String,Object>> findMonitorPatientsByDoctor(String doctor,String topicItem){
    public JSONObject findMonitorPatientsByDoctor(String doctor,String topicItem,Integer page,Integer pageSize,Integer detail){
        JSONObject result = new JSONObject();
        String sql = " SELECT DISTINCT p.id,p.name,p.residential_area residentialArea,p.photo,p.idcard,p.mobile, " +
                " p.openid,p.sex,p.pad_imei padImei " +
                " from base_patient p , base_service_package_sign_record sr,base_service_package_record r,base_team_member m  " +
@ -2071,7 +2078,39 @@ public class SecurityMonitoringOrderService extends BaseJpaService<SecurityMonit
        if ("preventLost".equals(topicItem)){//有绑定围栏的居民
            filter += " and EXISTS (select 1 from wlyy_patient_safe_area sf where sf.patient = p.id and sf.del=1 and sf.manage_status=1) ";
        }
        return jdbcTemplate.queryForList(sql+filter);
        List<Map<String,Object>> list =  jdbcTemplate.queryForList(sql+filter);
        result.put("total",list.size());
        if (1 == detail){//获取详情
            JSONArray monitorInfos = new JSONArray();
            page = page>0?page-1:0;
            Integer totalPage = 0;
            if(list.size()%pageSize==0){
                totalPage =list.size()/pageSize;
            }else{
                totalPage = list.size()/pageSize+1;
            }
            Integer currentIndexFrom = page*pageSize;
            Integer currentIndexEnd = page*pageSize+pageSize;
            result.put("totalPage",totalPage);
            result.put("currentPage",page+1);
            for (int i=currentIndexFrom;i<list.size()&&i<currentIndexEnd;i++){
                Map<String,Object> patientTmp = list.get(i);
                JSONObject object = patientMonitoringInfo(patientTmp.get("id").toString(),topicItem);
                object.put("patientInfo",patientTmp);
                monitorInfos.add(object);
            }
            result.put("topicInfo",monitorInfos);
        }else {
            JSONArray monitorInfos = new JSONArray();
            for (int i=0;i<list.size();i++){
                Map<String,Object> patientTmp = list.get(i);
                JSONObject object = new JSONObject();
                object.put("patientInfo",patientTmp);
                monitorInfos.add(object);
            }
            result.put("topicInfo",monitorInfos);
        }
        return result;
    }
}

+ 8 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/service/DeviceService.java

@ -366,7 +366,14 @@ public class DeviceService {
    public void byLocation(String imei,String time_begin,boolean is_reply,boolean is_track,String city,String address,double lon,double lat,String type) {
        try {
            if(StringUtils.isNotBlank(imei)){
                List<DevicePatientDevice> devicePatientDeviceDos = patientDeviceDao.findByDeviceSn(imei);
                if (devicePatientDeviceDos.size()>0){
                    DevicePatientDevice deviceDO = devicePatientDeviceDos.get(0);
                    BasePatientDO patientDO = patientDao.findById(deviceDO.getUser());
                    JSONObject position = gpsUtil.gcj02_To_Bd09(lat,lon);
                    patientDO.setLatLon(position.getDouble("lat")+","+position.getDouble("lon"));
                    patientDao.save(patientDO);
                }
            }
        } catch (Exception e) {

+ 4 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java

@ -37,6 +37,10 @@ public class DeviceLostMessageUtil {
    public void deviceLostMessage(List<String> devices){
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        for (String id:devices){
            List<SystemMessageDO> sendMessageBefore = systemMessageDao.queryByRelationCodeAndTypeIn(id,new String[]{"43"});
            if (sendMessageBefore.size()>0){//删除之前的离线消息
                systemMessageDao.delete(sendMessageBefore);
            }
            List<DevicePatientDevice> pds =  patientDeviceDao.findByDeviceSn(id);
            if (pds.size()>0){
                DevicePatientDevice deviceDO = pds.get(0);

+ 4 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/util/DeviceLostMessageUtil.java

@ -38,6 +38,10 @@ public class DeviceLostMessageUtil {
    public void deviceLostMessage(List<String> devices){
        List<SystemMessageDO> messageDOS = new ArrayList<>();
        for (String id:devices){
            List<SystemMessageDO> sendMessageBefore = systemMessageDao.queryByRelationCodeAndTypeIn(id,new String[]{"43"});
            if (sendMessageBefore.size()>0){//删除之前的离线消息
                systemMessageDao.delete(sendMessageBefore);
            }
            List<DevicePatientDevice> pds =  patientDeviceDao.findByDeviceSn(id);
            if (pds.size()>0){
                DevicePatientDevice deviceDO = pds.get(0);