ソースを参照

Merge branch 'dev' of yeshijie/jw2.0 into dev

yeshijie 7 年 前
コミット
96a383667a

+ 20 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceVO.java

@ -27,10 +27,14 @@ public class IotDeviceVO extends BaseVO implements Serializable {
    private Integer isComposite;
    @ApiModelProperty("是否绑定(1已绑定,2未绑定)")
    private Integer isBinding;
    @ApiModelProperty("是否绑定(1已绑定,2未绑定)")
    private String isBindingName;
    @ApiModelProperty("是否平台型(1是,0否)")
    private Integer isPlatform;
    @ApiModelProperty("设备来源(1采购订单关联,2居民绑定,3管理员新增)")
    private String deviceSource;
    @ApiModelProperty("设备来源(1采购订单关联,2居民绑定,3管理员新增)")
    private String deviceSourceName;
    @ApiModelProperty("供应商code")
    private String supplierId;
    @ApiModelProperty("供应商名称")
@ -208,4 +212,20 @@ public class IotDeviceVO extends BaseVO implements Serializable {
    public void setIsBinding(Integer isBinding) {
        this.isBinding = isBinding;
    }
    public String getIsBindingName() {
        return isBindingName;
    }
    public void setIsBindingName(String isBindingName) {
        this.isBindingName = isBindingName;
    }
    public String getDeviceSourceName() {
        return deviceSourceName;
    }
    public void setDeviceSourceName(String deviceSourceName) {
        this.deviceSourceName = deviceSourceName;
    }
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductBaseInfoVO.java

@ -61,6 +61,8 @@ public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    private String originPlace;
    @ApiModelProperty("产地类型(1国产,2进口)")
    private Integer originType;
    @ApiModelProperty("产地类型名称")
    private String originTypeName;
    @ApiModelProperty("是否需要冷链(1是,0否)")
    private Integer isColdChain;
    @ApiModelProperty("授权id")
@ -269,4 +271,12 @@ public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    public void setInstrumentClassifyName(String instrumentClassifyName) {
        this.instrumentClassifyName = instrumentClassifyName;
    }
    public String getOriginTypeName() {
        return originTypeName;
    }
    public void setOriginTypeName(String originTypeName) {
        this.originTypeName = originTypeName;
    }
}

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

@ -99,6 +99,9 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * @return
     */
    public IotCompanyVO convertToModelVO(IotCompanyDO iotCompanyDO){
        if(iotCompanyDO==null){
            return null;
        }
        IotCompanyVO target = new IotCompanyVO();
        BeanUtils.copyProperties(iotCompanyDO, target);
        target.setBusinessEndTime(DateUtil.dateToStrShort(iotCompanyDO.getBusinessEndTime()));

+ 35 - 4
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceService.java

@ -3,6 +3,7 @@ package com.yihu.iot.service.device;
import com.yihu.base.fastdfs.FastDFSHelper;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.iot.dao.device.*;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.jw.iot.device.*;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
@ -46,6 +47,8 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
    private IotPatientDeviceDao iotPatientDeviceDao;
    @Autowired
    private IotDeviceQualityInspectionPlanDao iotDeviceQualityInspectionPlanDao;
    @Autowired
    private IotSystemDictService iotSystemDictService;
    /**
     * 新增
@ -170,6 +173,7 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
                one.setIsBinding(2);
            }
        });
        translateDictForList(iotDeviceVOList);
        return Envelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotDeviceVOList, page, size,count);
    }
@ -186,8 +190,8 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
     * @return
     */
    public Envelop<IotDeviceVO> queryPage(String sn,String hospital,String orderId,String purcharseId,Integer isBinding,Integer page,Integer size){
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_device c ,iot_patient_device t WHERE c.del=1 and t.del=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_device c ,iot_patient_device t WHERE c.del=1 and t.del=1 ");
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_device c left join iot_patient_device t on t.del = 1 AND c.device_sn = t.device_sn  WHERE c.del=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_device c left join iot_patient_device t on t.del = 1 AND c.device_sn = t.device_sn  WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(orderId)){
@ -211,8 +215,14 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
            args.add(sn);
            args.add(sn);
        }
        sql.append(" and c.device_sn = t.device_sn ");
        sqlCount.append("  and c.device_sn = t.device_sn '");
        if(isBinding==1){
            sql.append(" and t.id is not null ");
            sqlCount.append("  and t.id is not null ");
        }else {
            sql.append(" and t.id is null ");
            sqlCount.append("  and t.id is null ");
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
@ -225,6 +235,7 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        iotDeviceVOList.forEach(one->{
            one.setIsBinding(isBinding);
        });
        translateDictForList(iotDeviceVOList);
        return Envelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,iotDeviceVOList, page, size,count);
    }
@ -298,4 +309,24 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
        return Envelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,importRecordVOList, page, size,count);
    }
    /**
     * 字典翻译
     * @param iotDeviceVOList
     */
    public void translateDictForList(List<IotDeviceVO> iotDeviceVOList){
        if(iotDeviceVOList.size()>0){
            //字典翻译
            Map<String,String> deviceBindingMap = iotSystemDictService.findByDictName("DEVICE_BINDING");
            Map<String,String> deviceSourceMap = iotSystemDictService.findByDictName("DEVICE_SOURCE");
            iotDeviceVOList.forEach(infoVO->{
                if(infoVO.getIsBinding()!=null){
                    infoVO.setIsBindingName(deviceBindingMap.get(infoVO.getIsBinding().toString()));
                }
                if(StringUtils.isNotBlank(infoVO.getDeviceSource())){
                    infoVO.setDeviceSourceName(deviceSourceMap.get(infoVO.getDeviceSource()));
                }
            });
        }
    }
}

+ 22 - 10
svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoService.java

@ -143,10 +143,14 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
        iotProductBaseInfoDao.save(baseInfoDO);
        //扩展信息
        IotProductExtendInfoDO extendInfoDOOld = iotProductExtendInfoDao.findByProductId(productId);
        extendInfoDO.setSaasId(extendInfoDOOld.getSaasId());
        extendInfoDO.setDel(1);
        extendInfoDO.setProductId(productId);
        iotProductExtendInfoDao.save(extendInfoDO);
        extendInfoDOOld.setContraindication(extendInfoDO.getContraindication());
        extendInfoDOOld.setDescription(extendInfoDO.getDescription());
        extendInfoDOOld.setProductImg(extendInfoDO.getProductImg());
        extendInfoDOOld.setSpecification(extendInfoDO.getSpecification());
        extendInfoDOOld.setStandard(extendInfoDO.getStandard());
        extendInfoDOOld.setUseRange(extendInfoDO.getUseRange());
        extendInfoDOOld.setVersion(extendInfoDO.getVersion());
        iotProductExtendInfoDao.save(extendInfoDOOld);
        //附件
        List<IotProductAttachmentDO> attachmentDOOldList = iotProductAttachmentDao.findByProductId(productId);
        iotProductAttachmentDao.delete(attachmentDOOldList);
@ -240,17 +244,21 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
        if(iotCompanyVOList.size()>0){
            //字典翻译
            Map<String,String> product68Map = iotSystemDictService.findByDictName("PRODUCT_68_TYPE");
            Map<String,String> originMap = iotSystemDictService.findByDictName("ORIGIN_TYPE");
            Map<String,String> productTypeMap = iotSystemDictService.findByDictName("PRODUCT_TYPE");
            Map<String,String> originTypeMap = iotSystemDictService.findByDictName("ORIGIN_TYPE");
            Map<String,String> productSmallMap = iotSystemDictService.findByDictName("PRODUCT_SMALL_TYPE");
            iotCompanyVOList.forEach(infoVO->{
                if(StringUtils.isNotBlank(infoVO.getType())){
                    infoVO.setTypeName(originMap.get(infoVO.getType()));
                    infoVO.setTypeName(productTypeMap.get(infoVO.getType()));
                }
                if(StringUtils.isNotBlank(infoVO.getInstrumentClassify())){
                    infoVO.setInstrumentClassifyName(product68Map.get(infoVO.getInstrumentClassify()));
                }
                if(StringUtils.isNotBlank(infoVO.getProductSubclass())){
                    infoVO.setProductSubclassName(productSmallMap.get(infoVO.getType()));
                    infoVO.setProductSubclassName(productSmallMap.get(infoVO.getProductSubclass()));
                }
                if(infoVO.getOriginType()!=null){
                    infoVO.setOriginTypeName(originTypeMap.get(infoVO.getOriginType().toString()));
                }
            });
        }
@ -264,16 +272,20 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
        if(infoVO!=null){
            //字典翻译
            Map<String,String> product68Map = iotSystemDictService.findByDictName("PRODUCT_68_TYPE");
            Map<String,String> originMap = iotSystemDictService.findByDictName("ORIGIN_TYPE");
            Map<String,String> productTypeMap = iotSystemDictService.findByDictName("PRODUCT_TYPE");
            Map<String,String> productSmallMap = iotSystemDictService.findByDictName("PRODUCT_SMALL_TYPE");
            Map<String,String> originTypeMap = iotSystemDictService.findByDictName("ORIGIN_TYPE");
            if(StringUtils.isNotBlank(infoVO.getType())){
                infoVO.setTypeName(originMap.get(infoVO.getType()));
                infoVO.setTypeName(productTypeMap.get(infoVO.getType()));
            }
            if(StringUtils.isNotBlank(infoVO.getInstrumentClassify())){
                infoVO.setInstrumentClassifyName(product68Map.get(infoVO.getInstrumentClassify()));
            }
            if(StringUtils.isNotBlank(infoVO.getProductSubclass())){
                infoVO.setProductSubclassName(productSmallMap.get(infoVO.getType()));
                infoVO.setProductSubclassName(productSmallMap.get(infoVO.getProductSubclass()));
            }
            if(infoVO.getOriginType()!=null){
                infoVO.setOriginTypeName(originTypeMap.get(infoVO.getOriginType().toString()));
            }
        }
    }