Selaa lähdekoodia

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

LAPTOP-KB9HII50\70708 3 vuotta sitten
vanhempi
commit
0e0a251696

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DeviceDetail.java

@ -169,7 +169,7 @@ public class DeviceDetail extends IdEntity {
        this.serverIp = serverIp;
    }
    @Column(name = "manufacturerCode")
    @Column(name = "manufacturer_code")
    public String getManufacturerCode() {
        return manufacturerCode;
    }

+ 41 - 0
common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java

@ -117,6 +117,47 @@ public class HttpClientUtil {
    }
    public  String postWithTimeOUt(String url, List<NameValuePair> params, String chatSet,int outTime) {
        // 创建默认的httpClient实例.
        CloseableHttpClient httpclient = HttpClients.createDefault();
        // 创建httppost
        HttpPost httppost = new HttpPost(url);
        UrlEncodedFormEntity uefEntity;
        RequestConfig requestConfig = RequestConfig.custom()
                .setConnectTimeout(outTime)
                .setConnectionRequestTimeout(outTime)
                .setStaleConnectionCheckEnabled(true)
                .setSocketTimeout(outTime).build();
        httppost.setConfig(requestConfig);
        try {
            uefEntity = new UrlEncodedFormEntity(params, chatSet);
            httppost.setEntity(uefEntity);
            CloseableHttpResponse response = httpclient.execute(httppost);
            try {
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    /**
     * 发送get请求
     *

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

@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -206,6 +207,7 @@ public class ConsultTeamService {
        templateJson.put("id",orderId);
        templateJson.put("OrderType",20);
        List<String> familyArchiveType3 = new ArrayList<>();
        for (int i=0;i<familyArr.size();i++){
            JSONObject tmp = familyArr.getJSONObject(i);
            String patientId = tmp.getString("id");
@ -215,6 +217,10 @@ public class ConsultTeamService {
            participants.put(patientId, 0);//家庭成员拉入会话
            String archiveType = tmp.getString("archiveType");
            if ("3".equals(archiveType)){
                if (familyArchiveType3.contains(patientId)){//避免重复发送
                    continue;
                }
                familyArchiveType3.add(patientId);
                String name = tmp.getString("name");
                //创建家属系统消息
                SystemMessageDO messageDO = new SystemMessageDO();
@ -422,6 +428,8 @@ public class ConsultTeamService {
        JSONObject templateJson = new JSONObject();
        templateJson.put("id",orderId);
        templateJson.put("OrderType",22);
        List<String> familyArchiveType3 = new ArrayList<>();
        for (int i=0;i<familyArr.size();i++){
            JSONObject tmp = familyArr.getJSONObject(i);
            String patientId = tmp.getString("id");
@ -432,6 +440,10 @@ public class ConsultTeamService {
            participants.put(patientId, 0);
            String archiveType = tmp.getString("archiveType");
            if ("3".equals(archiveType)){
                if (familyArchiveType3.contains(patientId)){//避免重复发送
                    continue;
                }
                familyArchiveType3.add(patientId);
                String name = tmp.getString("name");
                //创建家属系统消息
                SystemMessageDO messageDO = new SystemMessageDO();

+ 3 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -138,7 +138,7 @@ public class StatisticsService {
            filter2 = " and org_code not in ('" + orgCodes + "') ";
        }
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0 " + filter2;
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status <> -1 " + filter2;
        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql, Integer.class);
        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 " + filter;
        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql, Integer.class);
@ -288,7 +288,7 @@ public class StatisticsService {
                filter2 = " and org_code not in ('" + orgCodes + "') ";
            }
            String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0 "+filter2;
            String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status <> -1 "+filter2;
            Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql, Integer.class);
            String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 "+filter;
            Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql, Integer.class);
@ -420,7 +420,7 @@ public class StatisticsService {
            filter = " and hospital not in ('" + orgCodes + "') ";
            filter2 = " and org_code not in ('" + orgCodes + "') ";
        }
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status >= 0" + filter2;
        String emergencyCallSql = "SELECT COUNT(1) FROM base_emergency_assistance_order WHERE status <> -1 " + filter2;
        Integer emergencyCallNum = jdbcTemplate.queryForObject(emergencyCallSql, Integer.class);
        String securityMonitoringSql = "SELECT COUNT(1) FROM base_security_monitoring_order where 1=1 " + filter;
        Integer securityMonitoringNum = jdbcTemplate.queryForObject(securityMonitoringSql, Integer.class);

+ 27 - 8
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/PatientSosContactsJob.java

@ -42,7 +42,11 @@ public class PatientSosContactsJob implements Job {
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("PATIENT_SOS_CONTACTS_JOB start");
        String sql = " select pd.device_sn,pd.category_code,wd.iccid as sim,sc.* from  wlyy_patient_device pd inner join wlyy_devices wd " +
        String sql = " UPDATE base_patient_sos_contacts set success_flag=0,update_info = null,error_info=null where \n" +
                " `success_flag` <> '1' AND `del` = '1' ";
        jdbcTemplate.execute(sql);
        sql = " select pd.device_sn,pd.category_code,wd.iccid as sim,sc.* from  wlyy_patient_device pd inner join wlyy_devices wd " +
                " on pd.device_sn = wd.device_code and pd.del=0 " +
                "INNER JOIN base_patient_sos_contacts sc on sc.patient = pd.user and sc.del=1 " +
                "where  sc.success_flag=0 and pd.category_code in('7','4','16')  group by wd.device_code ";
@ -108,14 +112,29 @@ public class PatientSosContactsJob implements Job {
                                phone2 = nums.get(i);
                            }
                        }
                        yunXunDeviceService.setSos(device_sn,phone1,phone2,phone3);
                        if (!sosContactsDO.getUpdateInfo().contains(device_sn)){
                            sosContactsDO.setUpdateInfo(sosContactsDO.getUpdateInfo()+",{deviceSn:"+device_sn+":unknow}");
                        }
                        if (1==sosContactsDO.getSuccessFlag()||0==sosContactsDO.getSuccessFlag()){
                            sosContactsDO.setSuccessFlag(1);
                        }else {
                        String yxResponse =  yunXunDeviceService.setSos(device_sn,phone1,phone2,phone3);
                        if (StringUtils.isBlank(yxResponse)){//请求失败或超时
                            if (!sosContactsDO.getUpdateInfo().contains(device_sn)){
                                sosContactsDO.setUpdateInfo(sosContactsDO.getUpdateInfo()+",{deviceSn:"+device_sn+":error}");
                            }
                            sosContactsDO.setSuccessFlag(-1);
                        }else {
                            JSONObject yxResponseObj = JSONObject.parseObject(yxResponse);
                            if (200==yxResponseObj.getInteger("status")){//返回成功
                                if (!sosContactsDO.getUpdateInfo().contains(device_sn)){
                                    sosContactsDO.setUpdateInfo(sosContactsDO.getUpdateInfo()+",{deviceSn:"+device_sn+":success}");
                                }
                                if (1==sosContactsDO.getSuccessFlag()||0==sosContactsDO.getSuccessFlag()){
                                    sosContactsDO.setSuccessFlag(1);
                                }else {
                                    sosContactsDO.setSuccessFlag(-1);
                                }
                            } else { //返回失败
                                if (!sosContactsDO.getUpdateInfo().contains(device_sn)){
                                    sosContactsDO.setUpdateInfo(sosContactsDO.getUpdateInfo()+",{deviceSn:"+device_sn+":"+yxResponseObj.getString("message")+"}");
                                }
                                sosContactsDO.setSuccessFlag(-1);
                            }
                        }
                    }
                    sosContactsDao.save(sosContactsDO);

+ 16 - 6
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/job/device/YunXunDeviceService.java

@ -2,11 +2,16 @@ package com.yihu.jw.care.job.device;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.StringUtil;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
 * Created with IntelliJ IDEA.
 * 云芯拐杖设备对接
@ -29,9 +34,9 @@ public class YunXunDeviceService {
     * @param phone2
     * @param phone3
     */
    public void setSos(String sn,String phone1,String phone2,String phone3){
    public String setSos(String sn,String phone1,String phone2,String phone3){
        if(StringUtil.isBlank(phone1)){
            return;
            return "";
        }
        //[IC*334588000000156*0027*SOS,00000000000,00000000000]
        String order = "SOS,"+phone1;
@ -42,21 +47,26 @@ public class YunXunDeviceService {
            order += ","+phone3;
        }
        String instruction = "[IC*"+sn+"*"+hex10To16(order.length())+"*"+order+"]";
        sendInstruction(sn,instruction);
        return sendInstruction(sn,instruction);
    }
    /**
     * 发送指令接口
     * @param instruction
     */
    public void sendInstruction(String sn,String instruction){
    public String sendInstruction(String sn,String instruction){
        try {
            String url = "http://www.www.cityihealth.com:43210/yunxin/sendMessage?deviceSN="+sn+"&message="+instruction;
            String response = httpClientUtil.get(url,"UTF-8");
            String url = "http://www.cityihealth.com:43210/yunxin/sendMessage?deviceSN="+sn+"&message="+instruction;
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("deviceSN",sn));
            params.add(new BasicNameValuePair("message",instruction));
            String response = httpClientUtil.postWithTimeOUt(url,params,"UTF-8",10000);
            logger.info("sendInstruction="+response);
            return response;
        }catch (Exception e){
            e.printStackTrace();
        }
        return "";
    }
    /**

+ 24 - 1
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/web/JobController.java

@ -4,6 +4,7 @@ import com.yihu.jw.care.job.BirthdayReminderJob;
import com.yihu.jw.care.job.QuartzHelper;
import com.yihu.jw.care.job.consult.FinishConsultJob;
import com.yihu.jw.care.job.device.DeviceLostAssociationJob;
import com.yihu.jw.care.job.device.YunXunDeviceService;
import com.yihu.jw.care.job.message.DoctorSendUnreadJob;
import com.yihu.jw.care.job.message.PatientSendUnreadJob;
import com.yihu.jw.care.service.BirthdayReminderService;
@ -14,11 +15,13 @@ import com.yihu.jw.care.util.SystemConf;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@ -43,6 +46,8 @@ public class JobController extends BaseController {
    private BirthdayReminderService birthdayReminderService;
    @Autowired
    private WlyysimFlowVoiceService wlyysimFlowVoiceService;
    @Autowired
    private YunXunDeviceService yunXunDeviceService;
    @RequestMapping(value = "/deviceLostAssociationJob", method = RequestMethod.POST)
    @ApiOperation("医养物联网检测大屏失联率")
@ -329,6 +334,24 @@ public class JobController extends BaseController {
        }
    }
    @RequestMapping(value = "/yxDeviceSetPhone", method = RequestMethod.POST)
    @ApiOperation("物联网卡流量语音初始化查询")
    public String yxDeviceSetPhone(
            @ApiParam(name = "device_sn",required = false)
            @RequestParam(value = "device_sn")String device_sn,
            @ApiParam(name = "phone1",required = false)
            @RequestParam(value = "phone1")String phone1,
            @ApiParam(name = "phone2",required = false)
            @RequestParam(value = "phone2",required = false)String phone2,
            @ApiParam(name = "phone3",required = false)
            @RequestParam(value = "phone3",required = false)String phone3) {
        try {
           String response = yunXunDeviceService.setSos(device_sn,phone1,phone2,phone3);
            return write(200,response);
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
}

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/IotAnalyzerService.java

@ -69,7 +69,7 @@ public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
//    骨密度	    BMD	            bmd	        g/cm^3
//    骨密度T值	BMD	            bmd_t	    g/cm^3
//    骨密度Z值	BMD	            bmd_z	    g/cm^3
//    中医体质	tcm	            tcm
    public void initIHealthIntoEs(){
        try {