Kaynağa Gözat

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

wangzhinan 1 yıl önce
ebeveyn
işleme
b5f8944658

+ 47 - 11
business/base-service/src/main/java/com/yihu/jw/article/service/BaseMenuManageService.java

@ -21,10 +21,8 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -746,7 +744,6 @@ public class BaseMenuManageService {
    }
    public MixEnvelop findArticleByMenuId(String menuId,String title,Integer page,Integer pageSize,String isContent){
        Pageable pageRequest = PageRequest.of(page-1,pageSize);
        List<String> menuIds = new ArrayList<>();
        if (StringUtils.isNoneBlank(menuId)){
            String str[]= menuId.split(",");
@ -760,18 +757,57 @@ public class BaseMenuManageService {
        List<KnowledgeArticleDictDO> list;
        if(StringUtils.isNotBlank(title)){
            count = knowledgeArticleDictDao.getCountByCategorySecond(menuIds,title);
            list=knowledgeArticleDictDao.findByCategorySecondAndPage(menuIds,title,pageRequest);
        }else {
            count = knowledgeArticleDictDao.getCountByCategorySecond(menuIds);
            list=knowledgeArticleDictDao.findByCategorySecondAndPage(menuIds,pageRequest);
        }
        List<KnowledgeArticleDictDO> listnew = new ArrayList<>();
        BeanUtils.copyProperties(listnew,list);
        String sqlTmp = " content,";
        if(!"1".equals(isContent)){
            for (KnowledgeArticleDictDO dictDO:list){
                dictDO.setContent(null);
            }
            sqlTmp =  "  null  content ," ;
        }
        String sql = "select id   ,\n" +
                "  title   ,\n" +
                "  subtitle   ,\n" +
                "  intro   ,\n" +
                "  type,\n" +
                "  category_first   ,\n" +
                "  category_first_name   ,\n" +
                "  category_second   ,\n" +
                "  category_second_name   ,\n" +
                sqlTmp +
                "  image   ,\n" +
                "  img   ,\n" +
                "  url,\n" +
                "  vedio_url   ,\n" +
                "  create_user   ,\n" +
                "  create_time,\n" +
                "  update_time,\n" +
                "  del,\n" +
                "  status,\n" +
                "  used,\n" +
                "  source   ,\n" +
                "  cancel_reason   ,\n" +
                "  read_count,\n" +
                "  collection,\n" +
                "  fabulous,\n" +
                "  comment,\n" +
                "  is_share,\n" +
                "  create_user_name   ,\n" +
                "  create_user_dept   ,\n" +
                "  create_user_dept_name   ,\n" +
                "  check_time,\n" +
                "  release_status,\n" +
                "  release_time,\n" +
                "  puplish_type,\n" +
                "  recommend_doctor,\n" +
                "  puplish_type_name,\n" +
                "  recommend_doctor_name from wlyy_knowledge_article_dict a where a.del=1 and " +
                " a.category_second IN ( '"+menuId.replaceAll(",","'")+"' ) and a.release_status=1  ";
        if(StringUtils.isNotBlank(title)){
            sql += " and a.title like %"+title+"%";
        }
        sql += "  order by  a.release_time desc,a.create_time desc limit "+(page-1)*pageSize+","+pageSize;
        list = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(KnowledgeArticleDictDO.class));
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setTotalCount(count);

+ 31 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/DsyyEntranceService.java

@ -27,7 +27,7 @@ import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.oauth.OauthRsaKeyDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.encrypt.MD5;
@ -53,7 +53,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
 * 第三医院内网his对接服务
@ -137,6 +136,9 @@ public class DsyyEntranceService {
    public static String hospitalUrl = "http://192.168.118.240:10022/";//172.16.100.63
    //请求内网服务
    public static String entranceIotUrl = "http://192.168.101.2:10024/iotDevice/";
    public String getSelectUrl(){
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("hcyyWebSelectService");
@ -194,6 +196,33 @@ public class DsyyEntranceService {
        return sysDictDO.getDictCode();
    }
    //推送物联网体征数据
    public void pushIotDeviceDataInfo(Long id){
        try {
            String url = entranceIotUrl +"uploadDeviceData";
            Map<String,Object> params = new HashedMap();
            params.put("id",id);
            HttpResponse response = HttpUtils.doPost(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    //推送物联网设备数据
    public void pushIotDeviceInfo(Long id){
        try {
            String url = entranceIotUrl +"deviceRegistration";
            Map<String,Object> params = new HashedMap();
            params.put("id",id);
            HttpResponse response = HttpUtils.doPost(url,params);
            String content = response.getContent();
            logger.info("response:"+content);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**
     * his 调用
     * @param api

+ 1 - 15
common/common-entity/src/db/2023.sql

@ -339,21 +339,6 @@ CREATE TABLE `wlyy_patient_health_standard` (
  UNIQUE KEY `idx_wlyy_patient_health_standard_1` (`patient`,`type`)
) ENGINE=InnoDB AUTO_INCREMENT=134944 DEFAULT CHARSET=utf8mb4 COMMENT='患者健康指标预警值';
CREATE TABLE `hm_token` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '业务无关主键',
  `patient` varchar(50) NOT NULL COMMENT 'i健康patient',
  `access_token` varchar(255) DEFAULT NULL COMMENT '华米token',
  `refresh_token` varchar(255) DEFAULT NULL,
  `token_type` varchar(50) DEFAULT NULL COMMENT 'token类型',
  `expires_in` varchar(50) DEFAULT NULL COMMENT 'token有效期',
  `create_time` varchar(50) DEFAULT NULL,
  `user_id` varchar(255) DEFAULT NULL COMMENT '华米端id',
  `gender` int(2) DEFAULT NULL COMMENT '华米端性别',
  `nick_name` varchar(255) DEFAULT NULL COMMENT '华米端用户昵称',
  `avatar` varchar(255) DEFAULT NULL COMMENT '头像地址',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 COMMENT='华米token信息表';
CREATE TABLE `dm_device_category` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '业务无关主键',
@ -476,3 +461,4 @@ CREATE TABLE `wlyy_patient_device_log` (
   PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12773 DEFAULT CHARSET=utf8mb4;
ALTER table wlyy_patient_health_index add COLUMN `is_upload` tinyint(1) DEFAULT NULL COMMENT '是否上传物联网 0和null否 1是,2失败';

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/device/DevicePatientHealthIndex.java

@ -57,6 +57,8 @@ public class DevicePatientHealthIndex extends IdEntity {
	private String hospital;//医院
	private String hospitalName;//医院名称
	private Integer isUpload;//是否上传物联网 0和null否 1是,2失败
	@Transient
	private Integer flag;//标识智能设备或者健康小屋
@ -247,4 +249,13 @@ public class DevicePatientHealthIndex extends IdEntity {
	public void setHospitalName(String hospitalName) {
		this.hospitalName = hospitalName;
	}
	@Column(name = "is_upload")
	public Integer getIsUpload() {
		return isUpload;
	}
	public void setIsUpload(Integer isUpload) {
		this.isUpload = isUpload;
	}
}

+ 7 - 6
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/zy/IotDeviceController.java

@ -7,6 +7,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -22,7 +23,7 @@ public class IotDeviceController extends EnvelopRestEndpoint {
    private IotDeviceService iotDeviceService;
    @GetMapping(value = "/uploadDeviceInfo")
    @PostMapping(value = "/uploadDeviceInfo")
    @ApiOperation(value = "设备状态信息上传")
    public Envelop uploadDeviceInfo() {
        try {
@ -33,20 +34,20 @@ public class IotDeviceController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "/uploadDeviceData")
    @PostMapping(value = "/uploadDeviceData")
    @ApiOperation(value = "设备业务数据信息上传")
    public Envelop uploadDeviceData() {
    public Envelop uploadDeviceData(Long id) {
        try {
            return success(iotDeviceService.uploadDeviceData());
            return success(iotDeviceService.uploadDeviceData(id));
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("查询失败");
        }
    }
    @GetMapping(value = "/deviceRegistration")
    @PostMapping(value = "/deviceRegistration")
    @ApiOperation(value = "设备相关基础信息注册")
    public Envelop deviceRegistration() {
    public Envelop deviceRegistration(Long id) {
        try {
            return success(iotDeviceService.deviceRegistration());
        }catch (Exception e){

+ 47 - 3
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/service/IotDeviceService.java

@ -1,13 +1,18 @@
package com.yihu.jw.entrance.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.device.dao.DevicePatientHealthIndexDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.iot.gateway.GcToken;
import com.yihu.jw.entrance.util.zysoft.SDKRunnerService;
import com.yihu.jw.entrance.util.zysoft.ZysoftBaseService;
import com.yihu.jw.gateway.dao.GcTokenDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -38,6 +43,10 @@ public class IotDeviceService {
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private GcTokenDao gcTokenDao;
    @Autowired
    private DevicePatientHealthIndexDao patientHealthIndexDao;
    @Autowired
    private BasePatientDao patientDao;
    /**
     * 获取accesstoken,i健康写法暂时不能用
@ -72,11 +81,46 @@ public class IotDeviceService {
    }
    //设备业务数据信息上传
    @Transactional
    public String uploadDeviceData(){
    public String uploadDeviceData(Long id){
        if(id == null){
            return " id is null";
        }
        DevicePatientHealthIndex healthIndex = patientHealthIndexDao.findById(id).orElse(null);
        if(healthIndex==null){
            return " data is null";
        }
        JSONObject jsonData = new JSONObject();
        jsonData.put("deviceSn",healthIndex.getDeviceSn());
        jsonData.put("hospital","350211A1004");
        BasePatientDO patientDO = patientDao.findById(healthIndex.getUser()).orElse(null);
        if(patientDO!=null){
            jsonData.put("name",patientDO.getName());
            jsonData.put("idcard",patientDO.getIdcard());
        }
        JSONArray data = new JSONArray();
        if(healthIndex.getType()==1){
            jsonData.put("categoryCode","2");
            JSONObject blood = new JSONObject();
            blood.put("blood_sugar",healthIndex.getValue1());
            blood.put("measure_time",DateUtil.dateToStrLong(healthIndex.getRecordDate()));
            data.add(blood);
        }else if(healthIndex.getType()==2){
            jsonData.put("categoryCode","1");
            // 血压:data={ "systolic ": "110", "diastolic ": "78", "pulse ": "66", "heart_rate ": "66", "measure_time ": "2023-02-02 14:07:25"
            JSONObject blood = new JSONObject();
            blood.put("systolic",healthIndex.getValue1());
            blood.put("diastolic",healthIndex.getValue2());
            blood.put("heart_rate",healthIndex.getValue3());
            blood.put("measure_time",DateUtil.dateToStrLong(healthIndex.getRecordDate()));
            data.add(blood);
        }else {
            return " only type 1 or 2";
        }
        jsonData.put("data",data);
        Map<String,String> header = new HashMap<>();
        String jsonData = "{\"deviceSn\":\"xty_test\",\"deviceModel\":\"测试\",\"name\":\"血糖仪TEST\",\"hospital\":\"350211A1004\",\"hospitalName\":\"厦门市第三医院\",\"categoryCode\":\"2\",\"categoryName\":\" 血糖仪\",\"commonName\":\" 血糖仪\",\"combinationMethod\":\"1\",\"networkTransmission\":\" 11\",\"deviceUse\":\"2\",\"dropLocation\":\"2\",\"dataAcquisition\":\"IoT_equipment_blood_glucose_mete\",\"companyName\":\"血糖仪厂商名称\",\"companyType\":\"3\"}";
        Map<String,String> params = new HashMap<>();
        params.put("jsonData",jsonData);
        params.put("jsonData",jsonData.toJSONString());
        header.put("accesstoken",getAccessToken());
        String response = sdkRunnerService.post("wlw/uploadDeviceData","设备业务数据信息上传",params,header,true,true);
        return response;

+ 4 - 66
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/health/service/DeviceUploadService.java

@ -14,13 +14,10 @@ import com.yihu.jw.entity.care.device.DevicePatientHealthIndex;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.module.health.controller.Result;
import com.yihu.jw.hospital.utils.CountDistance;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.hospital.utils.DeviceDataPushLogUtil;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.GpsUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.healthIndex.HealthIndexUtil;
import com.yihu.jw.utils.StringUtil;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
@ -57,17 +54,11 @@ public class DeviceUploadService {
    @Autowired
    private SystemMessageDao systemMessageDao;
    @Autowired
    private HealthIndexUtil healthIndexUtil;
    @Autowired
    private ImUtil imUtil;
    @Autowired
    private CountDistance countDistance;
    @Autowired
    private GpsUtil gpsUtil;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private DeviceDataPushLogUtil dataPushLogUtil;
    @Autowired
    private DsyyEntranceService dsyyEntranceService;
    public Result uploadDevicesData(String dataJson, HttpServletRequest request)throws Exception {
        try {
@ -129,6 +120,7 @@ public class DeviceUploadService {
            }
            dataPushLogUtil.savePushLog(deviceSn,paraString,"体征数据接收");
            dataPushLogUtil.updContactStatus(deviceSn,1,false);
            dsyyEntranceService.pushIotDeviceDataInfo(result.getId());
            //保存消息
            BasePatientDO patientDO = patientDao.findById(result.getUser()).orElse(null);
            if (null != patientDO){
@ -144,61 +136,7 @@ public class DeviceUploadService {
                        break;
                }
                if (StringUtils.isNotBlank(typeName)){
/*                    String adminSql = "SELECT py_code FROM wlyy_hospital_sys_dict WHERE dict_name = 'pushOnOff' AND dict_code ='"+6+"' ";
                    String onOff= jdbcTemplate.queryForObject(adminSql,String.class);
                    Boolean kg = Boolean.parseBoolean(onOff);
                    String patientOnOffSql = "select on_off from base_patient_pad_pushonoff where patient = '" + patientDO.getId() + "' and type = 3";
                    Integer integer = jdbcTemplate.queryForObject(patientOnOffSql,Integer.class);
                    if (kg&&integer==0?false:true) {
                        messageDO.setTitle(typeName);
                        messageDO.setType("42");//42体征设备测量
                        messageDO.setSender("system");
                        messageDO.setSenderName("养护助手");
                        messageDO.setRelationCode(result.getId() + "");
                        messageDO.setReceiver(patientDO.getId());
                        messageDO.setReceiverName(patientDO.getName());
//                        messageDO.setUserType(1);
                        messageDO.setOver("1");
                        messageDO.setCode(type);//与体征类型对应
                        JSONArray errorIndex = healthIndexUtil.verifyHealthIndex(Integer.parseInt(type), result.getValue1(), result.getValue2(),
                                result.getValue3(), result.getValue4(), result.getValue5(), result.getValue6(),
                                result.getValue7());
                        messageDO.setData(JSON.toJSONString(errorIndex, SerializerFeature.WriteNullStringAsEmpty));
                        messageDO.setDel("1");
                        messageDO.setCreateTime(new Date());
                        //推送socket
                        com.alibaba.fastjson.JSONObject message = new com.alibaba.fastjson.JSONObject();
                        message.put("title", typeName);
                        message.put("code", messageDO.getCode());
                        message.put("content", messageDO.getData());
                        message.put("relation_code", messageDO.getRelationCode());
                        message.put("content_type", 42);
                        message.put("content_notice", "");
//                        message.put("audioUrl", url);
                        String content_notice = "";
                        for (int i = 0; i < errorIndex.size(); i++) {
                            com.alibaba.fastjson.JSONObject tmp = errorIndex.getJSONObject(i);
                            if (0 != tmp.getInteger("error")) {
                                result.setStatus(1);
                            }
                            if (1 == tmp.getInteger("error")) {
                                content_notice += tmp.getString("indexName") + "、";
                            }
                        }
                        if (StringUtils.isNotBlank(content_notice)) {
                            content_notice = content_notice.substring(0, content_notice.length() - 1);
                            message.put("content_notice", "您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1", content_notice));
                            messageDO.setContent("您的key1过高,请注意饮食,尽量食用少油少盐食物".replace("key1", content_notice));
                            dataPushLogUtil.updContactStatus(deviceSn, 1, true);
                        } else {
                            dataPushLogUtil.updContactStatus(deviceSn, 1, false);
                        }
                        patientHealthIndexDao.save(result);
                        systemMessageDao.save(messageDO);
                        imUtil.sendPatientSystemMessage(messageDO.getReceiver(), JSON.toJSONString(message, SerializerFeature.WriteMapNullValue));
                    }*/
                }
            }
        } catch (Exception e) {