Sfoglia il codice sorgente

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

huangwenjie 4 anni fa
parent
commit
8471929ba5

+ 3 - 3
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/role/RoleVO.java

@ -20,7 +20,7 @@ public class RoleVO extends UuidIdentityVOWithOperator {
	@ApiModelProperty(value = "角色代码", example = "1")
	private String code;
	@ApiModelProperty(value = "1.系统管理员,2.saas管理员,3.机构管理员", example = "1")
	private String type;
	private Integer type;
	@ApiModelProperty(value = "sassId", example = "1")
	private String saasId;
	@ApiModelProperty(value =  "状态: -1 删除,1有效.", example = "1")
@ -58,11 +58,11 @@ public class RoleVO extends UuidIdentityVOWithOperator {
		this.code = code;
	}
	public String getType() {
	public Integer getType() {
		return type;
	}
	public void setType(String type) {
	public void setType(Integer type) {
		this.type = type;
	}

+ 1 - 1
svr/svr-iot/readme.MD

@ -3,7 +3,7 @@ Internet of things  物联网平台
filters 字符串拼接规则
         * like:使用"?"来表示,如:name?'%医'
         * like:使用"?"来表示,如:name?医
         * in:使用"="来表示并用","逗号对值进行分隔,如:status=2,3,4,5
         * not in:使用"<>"来表示并用","逗号对值进行分隔,如:status=2,3,4,5
         * =:使用"="来表示,如:status=2

+ 5 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceInventoryController.java

@ -62,6 +62,10 @@ public class IotDeviceInventoryController extends EnvelopRestEndpoint {
                                                                                              @RequestParam(value = "name", required = false) String name,
                                                                                              @ApiParam(name = "categoryCode", value = "设备类型标识")
                                                                                              @RequestParam(value = "categoryCode", required = false) String categoryCode,
                                                                                              @ApiParam(name = "hospital", value = "社区医院", defaultValue = "")
                                                                                                  @RequestParam(value = "hospital", required = false) String hospital,
                                                                                              @ApiParam(name = "productId", value = "产品id")
                                                                                                  @RequestParam(value = "productId", required = false) String productId,
                                                                                              @ApiParam(name = "type", value = "调拨类型(1入库 2设备调拨出库 3核销出库)")
                                                                                              @RequestParam(value = "type", required = false) Integer type,
                                                                                              @ApiParam(name = "page", value = "第几页", defaultValue = "1")
@ -69,7 +73,7 @@ public class IotDeviceInventoryController extends EnvelopRestEndpoint {
                                                                                              @ApiParam(name = "pageSize", value = "每页记录数")
                                                                                              @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        try {
            return deviceInventoryService.getDeviceInventoryLog(name, categoryCode, type, page, pageSize);
            return deviceInventoryService.getDeviceInventoryLog(name, categoryCode,hospital, productId, type, page, pageSize);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

+ 3 - 4
svr/svr-iot/src/main/java/com/yihu/iot/controller/workType/IotWorkTypeController.java

@ -32,8 +32,8 @@ public class IotWorkTypeController extends EnvelopRestEndpoint {
                                                           @RequestParam(value = "jsonData",required = true)String json){
        try {
            iotWorkTypeService.addType(json);
            return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_add);
            return iotWorkTypeService.addType(json);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -48,8 +48,7 @@ public class IotWorkTypeController extends EnvelopRestEndpoint {
                                                            @RequestParam(value = "jsonData",required = true)String json){
        try {
            iotWorkTypeService.editType(json);
            return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_edit);
           return iotWorkTypeService.editType(json);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/workType/IotWorkTypeDao.java

@ -18,5 +18,5 @@ public interface IotWorkTypeDao extends PagingAndSortingRepository<IotWorkTypeDO
    IotWorkTypeDO findById(String id);
    @Query("from IotWorkTypeDO w where w.name=?1 and w.del=0")
    List<IotWorkTypeDO> findByName(String name);
    IotWorkTypeDO findByName(String name);
}

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -288,7 +288,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        //判断账户是否重复
        IotCompanyDO account = iotCompanyDao.findByEhrUserId(userAgent.getUID());
        if (account==null){
        if (account!=null){
            return MixEnvelop.getSuccess("账户已注册",-1);
        }

+ 7 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceInventoryService.java

@ -149,7 +149,7 @@ public class IotDeviceInventoryService extends BaseJpaService<IotDeviceInventory
        return deviceDOList.size();
    }
    public MixEnvelop<IotDeviceInventoryLogVO, IotDeviceInventoryLogVO> getDeviceInventoryLog(String name, String categoryCode, Integer type, Integer page, Integer pageSize) {
    public MixEnvelop<IotDeviceInventoryLogVO, IotDeviceInventoryLogVO> getDeviceInventoryLog(String name, String categoryCode, String hospital, String productId, Integer type, Integer page, Integer pageSize) {
        String sql = "SELECT l.*, count(d.id) num FROM `iot_device_inventory_log` l LEFT JOIN iot_device d on l.id = d.inventory_log_id where 1=1 ";
        if (StringUtils.isNotBlank(name)) {
            sql += "and l.name like '%" + name + "%' ";
@ -157,6 +157,12 @@ public class IotDeviceInventoryService extends BaseJpaService<IotDeviceInventory
        if (StringUtils.isNotBlank(categoryCode)) {
            sql += "and l.category_code = '" + categoryCode + "' ";
        }
        if (StringUtils.isNotBlank(productId)) {
            sql += "and l.product_id = '" + productId + "' ";
        }
        if (StringUtils.isNotBlank(hospital)) {
            sql += "and l.hospital = '" + hospital + "' ";
        }
        if (type != null) {
            sql += "and l.type = '" + type + "' ";
        }

+ 2 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOverhaulService.java

@ -6,6 +6,7 @@ import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@ -15,6 +16,7 @@ import java.util.List;
 * create by hmf on 2020.5.7
 */
@Service
@Transactional
public class IotDeviceOverhaulService extends BaseJpaService<IotDeviceOverhaulDO, IotDeviceOverhaulDao> {
    @Autowired
    private IotDeviceOverhaulDao deviceOverhaulDao;

+ 32 - 5
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java

@ -58,7 +58,7 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
    @Autowired
    private HttpClientUtil httpClientUtil;
    private final static String jobUrl = "http://localhost:10031/job/reStartById?taskId=data_sim_Balance_remind_job";
    private final static String jobUrl = "http://172.26.0.109:10031/job/reStartById?taskId=data_sim_Balance_remind_job";
    /**
     * 增加SIM卡管理
@ -122,11 +122,15 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
     */
    public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> conditionQueryPage(Integer page, Integer size, String status, String sim, String sn){
        StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_sim c WHERE del=0 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(c.id) count from iot_device_sim c  WHERE del=0 ");
//        StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_sim c WHERE del=0 ");
        StringBuffer sql = new StringBuffer("SELECT c.*,d.patient_name,d.mobile,w.device_sn sn,w.name   FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim" +
                " LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no ");
        StringBuffer sqlCount = new StringBuffer("SELECT  COUNT(c.id) count  FROM iot_device_sim c LEFT JOIN iot_patient_device d ON c.del=0 AND d.del=1 AND c.sim=d.sim " +
                "LEFT JOIN iot_device w ON c.del = 0 AND w.del = 1 AND c.sim=w.sim_no ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(status)){
            sql.append(" and c.status=? ");
            sql.append(" and c.status=").append(status);
            sqlCount.append("and c.status='").append(status).append("' ");
            args.add(status);
        }
@ -140,7 +144,30 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
//        List<IotDeviceSimDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceSimDO.class));
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql.toString());
        ArrayList<IotDeviceSimDO> list = new ArrayList<>();
        mapList.forEach(one->{
            IotDeviceSimDO iotDeviceSimDO = JSONObject.parseObject(JSONObject.toJSONString(one), IotDeviceSimDO.class);
            if (one.get("patient_name")!=null){
                iotDeviceSimDO.setContactsName(one.get("patient_name").toString());
            }
            if (one.get("mobile")!=null){
                iotDeviceSimDO.setContactsMobile(one.get("mobile").toString());
            }
            if (one.get("sn")!=null){
                iotDeviceSimDO.setDeviceSn(one.get("sn").toString());
            }
            if (one.get("name")!=null){
                iotDeviceSimDO.setDeviceName(one.get("name").toString());
            }
            //更新表中数据
            iotDeviceSimDao.save(iotDeviceSimDO);
            list.add(iotDeviceSimDO);
        });
        List<Map<String,Object>> countList = jdbcTemplate.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());

+ 4 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -96,13 +96,13 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        }
        //更新SIM管理的SIM卡信息
        IotDeviceSimDO sim = iotDeviceSimDao.findBySim(patientDevice.getSim());
       /* IotDeviceSimDO sim = iotDeviceSimDao.findBySim(patientDevice.getSim());
        sim.setDeviceName(patientDevice.getDeviceName());
        sim.setDeviceSn(patientDevice.getDeviceSn());
        sim.setContactsName(patientDevice.getPatientName());
        sim.setContactsMobile(patientDevice.getMobile());
        sim.setDel("0");
        iotDeviceSimDao.save(sim);
        iotDeviceSimDao.save(sim);*/
        return patientDeviceDO;
@ -442,6 +442,7 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        if(StringUtils.isNotBlank(patientName)){
            sql += "and d.patient_name like '%" + patientName + "%' ";
        }
        sql += "order by o.update_time desc ";
        //判断是否需要分页
        if (page != null && pageSize != null) {
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
@ -474,6 +475,7 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        if(StringUtils.isNotBlank(hospitalName)){
            sql += "and d.hospital_name like '%" + hospitalName + "%' ";
        }
        sql += "order by d.update_time desc ";
        //判断是否需要分页
        if (page != null && pageSize != null) {
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());

+ 3 - 3
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -77,7 +77,7 @@ public class MonitorPlatformService  {
                    jsonObject.put("page",page);
                    jsonObject.put("size",size);
                    List<LocationDataVO> locationDataVOList = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonObject.toString());
                    figureLabelSerachService.getFigureLabelByList(locationDataVOList);
                    //figureLabelSerachService.getFigureLabelByList(locationDataVOList);
                    envelop.getDetailModelList().addAll(locationDataVOList);
                }
            }
@ -98,8 +98,8 @@ public class MonitorPlatformService  {
            jsonObject.put("page",page);
            jsonObject.put("size",size);
            List<LocationDataVO> locationDataVOList = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonObject.toString());
            figureLabelSerachService.getFigureLabelByList(locationDataVOList);
            //figureLabelSerachService.getFigureLabelByList(locationDataVOList);
            envelop.getDetailModelList().addAll(locationDataVOList);
            envelop.setTotalCount(iotPatientDeviceService.getESCount(jsonObject.toString()));
            return envelop;
        }

+ 18 - 7
svr/svr-iot/src/main/java/com/yihu/iot/service/workType/IotWorkTypeService.java

@ -34,10 +34,15 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
     * 增加业务类型
     * @param json
     */
    public void addType(String json) {
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> addType(String json) {
        IotWorkTypeDO iotWorkTypeDO = JSONObject.parseObject(json, IotWorkTypeDO.class);
        IotWorkTypeDO workTypeDO = iotWorkTypeDao.findByName(iotWorkTypeDO.getName());
        if (workTypeDO!=null){
            return MixEnvelop.getError("该业务类型已存在");
        }
        iotWorkTypeDO.setDel("0");
        iotWorkTypeDao.save(iotWorkTypeDO);
        return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_add);
    }
@ -45,14 +50,18 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
     * 编辑业务类型
     * @param json
     */
    public void editType(String json) {
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> editType(String json) {
        IotWorkTypeDO newType = JSONObject.parseObject(json, IotWorkTypeDO.class);
        IotWorkTypeDO old = iotWorkTypeDao.findOne(newType.getId());
        IotWorkTypeDO workTypeDO = iotWorkTypeDao.findByName(newType.getName());
        if (workTypeDO!=null&&(workTypeDO.getId().equalsIgnoreCase(newType.getId())==false)){
            return MixEnvelop.getError("该业务类型已存在");
        }
        old.setName(newType.getName());
        old.setExplanation(newType.getExplanation());
        old.setDel("0");
        old.setId(old.getId());
        iotWorkTypeDao.save(old);
        return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_edit);
    }
    /**
@ -62,7 +71,7 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> deleteType(String id) {
        IotWorkTypeDO type = iotWorkTypeDao.findOne(id);
        if(type.getDel().equalsIgnoreCase("1")){
            return MixEnvelop.getError("该企业已删除,请勿重复删除");
            return MixEnvelop.getError("该业务类型已删除,请勿重复删除");
        }
        type.setDel("1");
        iotWorkTypeDao.save(type);
@ -83,7 +92,7 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
    /**
     * 分页查询日志信息
     * 分页查询
     * @param page
     * @param size
     * @return
@ -91,9 +100,11 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
     */
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> findAll(Integer page, Integer size) throws ParseException {
        String sql = "select * from iot_work_type w where w.del=0;";
        StringBuffer sql = new StringBuffer("select * from iot_work_type w where w.del=0 ") ;
        sql.append("order by w.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotWorkTypeDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotWorkTypeDO.class));
        List<IotWorkTypeDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotWorkTypeDO.class));
        long count =list.size();

+ 2 - 2
svr/svr-iot/src/main/resources/application.yml

@ -194,9 +194,9 @@ spring:
    password: jkzlehr@123
  elasticsearch:
    cluster-name: jkzl #默认即为elasticsearch  集群名
    cluster-nodes: 10.90.32.2:20010,10.90.32.2:20012 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    cluster-nodes: 10.90.32.2:20011,10.90.32.2:20011 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    jest:
      uris: http://10.90.32.2:20009,http://10.90.32.2:20011
      uris: http://10.90.32.2:20011,http://10.90.32.2:20012
  wlyy:
    url: http://www.xmtyw.cn/wlyytest/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee62

+ 1 - 1
svr/svr-iot/src/main/resources/bootstrap.yml

@ -95,5 +95,5 @@ spring:
  profiles: iotprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      uri: ${wlyy.pring.config.uri:http://192.168.120.216:1221}
      label: ${wlyy.spring.config.label:master}