Преглед изворни кода

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

# Conflicts:
#	business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
wangzhinan пре 5 година
родитељ
комит
81a3b5805f
22 измењених фајлова са 290 додато и 85 уклоњено
  1. 1 1
      app/app-iot-server/src/main/java/com/yihu/iot/util/excel/reader/IotDeviceImportVOReader.java
  2. 51 42
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  3. 6 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  4. 2 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/platform/IotInterfaceLogVO.java
  5. 2 5
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  6. 13 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java
  7. 20 5
      svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java
  8. 15 2
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java
  9. 24 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceOrderController.java
  10. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceQualityController.java
  11. 24 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java
  12. 2 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyAppDao.java
  13. 3 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyDao.java
  14. 3 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceOrderDao.java
  15. 6 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotInterfaceLogDao.java
  16. 22 8
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java
  17. 2 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceImportRecordService.java
  18. 8 8
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceInventoryService.java
  19. 20 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java
  20. 9 4
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java
  21. 22 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceService.java
  22. 34 7
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceLogService.java

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/iot/util/excel/reader/IotDeviceImportVOReader.java

@ -16,7 +16,7 @@ public class IotDeviceImportVOReader extends AExcelReader {
            Sheet sheet = rwb.getSheet(0) ;
            for (int i = 1; i < sheet.getRows(); i++) {
                IotDeviceImportVO device = new IotDeviceImportVO();
                device.setSn(getCellCont(sheet, i, 0));
                device.setDeviceSn(getCellCont(sheet, i, 0));
                device.setHospital(getCellCont(sheet, i, 1));
                device.setSim(getCellCont(sheet, i, 2).trim());

+ 51 - 42
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -31,15 +31,11 @@ import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
@ -48,7 +44,6 @@ import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.common.utils.DateUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -58,7 +53,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.io.IOException;
import java.util.*;
/**
@ -136,6 +130,9 @@ public class YkyyEntranceService {
    @Autowired
    private DictDoctorDutyDao dictDoctorDutyDao;
    @Autowired
    private YkyyService ykyyService;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
        return hibenateUtils.createSQLQuery(sql,params,page,size);
@ -477,16 +474,6 @@ public class YkyyEntranceService {
                    String mappingCode = jsonObject.getString("DOCTORCODE");
                    doctorMappingDO.setMappingCode(mappingCode);
                    doctorMappingDao.save(doctorMappingDO);
                    baseDoctorDO.setIntroduce(jsonObject.getString("DETAIL"));
                    baseDoctorDO.setExpertise(jsonObject.getString("MAJOR"));
                    String jobTitle = jsonObject.getString("LEVELNAME");
                    baseDoctorDO.setJobTitleName(jobTitle);
                    List<DictDoctorDutyDO> dictDoctorDutyDOS = dictDoctorDutyDao.findByName(jobTitle);
                    if (dictDoctorDutyDOS!=null&&dictDoctorDutyDOS.size()!=0){
                        DictDoctorDutyDO dutyDO = dictDoctorDutyDOS.get(0);
                        baseDoctorDO.setJobTitleCode(dutyDO.getCode());
                    }
                    baseDoctorDao.save(baseDoctorDO);
                }else {
                    baseDoctorDO.setDel("0");
                    baseDoctorDao.save(baseDoctorDO);
@ -933,7 +920,7 @@ public class YkyyEntranceService {
     * @return
     */
    public JSONArray findYpyf(String pydm) throws Exception {
        String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1  and y.pydm is not null";
        String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1 ";
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and y.pydm='"+pydm+"' ";
        }
@ -1020,7 +1007,7 @@ public class YkyyEntranceService {
    }
    public JSONArray synYkICD10() throws Exception {
    public JSONArray findIcd10() throws Exception {
        String sql = "select i.code as \"code\",i.name as \"name\",i.disea_reason as \"disea_reason\",i.death_reason as \"death_reason\",i.py_code as \"py_code\",i.flag as \"flag\",i.add_code as \"add_code\",i.emr as \"emr\" from v_hlw_icd10 i";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
@ -1039,7 +1026,6 @@ public class YkyyEntranceService {
                DictIcd10DO dictIcd10DO = new DictIcd10DO();
                dictIcd10DO.setCode(object.getString("code"));
                dictIcd10DO.setName(object.getString("name"));
                dictIcd10DO.setDescription(object.getString("py_code"));
                ykDictIcd10Dao.save(dictIcd10DO);
            }
        }
@ -1047,27 +1033,6 @@ public class YkyyEntranceService {
    }
    public JSONArray findIcd10(String pyCode) throws Exception {
        String sql = "select i.code as \"code\",i.name as \"name\",i.disea_reason as \"disea_reason\",i.death_reason as \"death_reason\",i.py_code as \"py_code\",i.flag as \"flag\",i.add_code as \"add_code\",i.emr as \"emr\" from v_hlw_icd10 i";
        JSONArray array = new JSONArray();
        if (StringUtils.isNoneBlank(pyCode)){
            sql +="  where i.py_code like '%"+pyCode+"%'";
        }
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ICD10:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    public String findByRealOrder(String code) throws Exception {
@ -1392,7 +1357,7 @@ public class YkyyEntranceService {
                DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
                hlwCf01DO.setYSDM(doctorMappingDO.getMappingCode());
                hlwCf01DO.setJZKH(wlyyPrescriptionVO.getSsc());
                hlwCf01DO.setGUID(wlyyPrescriptionVO.getOrderId());
                hlwCf01DO.setGUID(getCode());
                hlwCf01DO.setSJLY(1);
                if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                    hlwCf01DO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
@ -1561,6 +1526,50 @@ public class YkyyEntranceService {
        return response1.getContent();
    }
    /**
     * 眼科通App消息推送接口
     * @param doctor
     * @param patient
     * @param orderType
     * @return
     */
    public String sendMesToYkt(String doctor, String patient, String orderType) throws Exception {
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        String yktDoctor ="";
        if (doctorMappingDO!=null&&StringUtils.isNoneBlank(doctorMappingDO.getMappingCode())){
            String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
            JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
            if (jsonObject.getInteger("code")==200){
                JSONArray array1 = jsonObject.getJSONArray("data");
                if (array1!=null&&array1.size()!=0){
                    yktDoctor=array1.getJSONObject(0).getString("DOCTORUSERID");
                }
            }
        }else {
            throw new Exception("医生映射表不存在!");
        }
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        if(basePatientDO!=null){
            patient = basePatientDO.getUserId();
        }
        Map<String,Object> params = new HashedMap();
        params.put("doctorId",yktDoctor);
        params.put("patientId",patient);
        params.put("orderType",orderType);
        HttpResponse response = HttpUtils.doPost("http://www.yanketong.com:90/api/share/PushNotificationToDoctor",params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("code");
        if(status!=null&&status == 10000){
            return rs.getString("message");//推送失败原因
        }else{
            return "推送成功";
        }
    }
}

+ 6 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -63,6 +63,7 @@ public class IotRequestMapping {
        public static final String message_fail_upload = "上传失败";
        public static final String message_fail_upload_format = "不支持该文件格式上传";
        public static final String message_fail_jsonData_is_null = "jsonData is null";
        public static final String message_success_download= "下载成功";
    }
    /**
@ -80,6 +81,8 @@ public class IotRequestMapping {
        public static final String findAll = "findAll";
        public static final String enterType = "enterType";
        public static final String conditionQueryPage = "conditionQueryPage";
        public static final String findUserCompanyStatus = "findUserCompanyStatus";
        public static final String findCompanyByAccount = "findCompanyByAccount";
        public static final String findCompanyCertPage = "findCompanyCertPage";
        public static final String findCompanyCertById = "findCompanyCertById";
@ -230,6 +233,7 @@ public class IotRequestMapping {
        public static final String importDevice = "importDevice";
        public static final String isImportDevice = "isImportDevice";
        public static final String uploadDeviceInfo = "uploadDeviceInfo";
        public static final String downloadTemplate = "downloadTemplate";
        public static final String queryImportRecordPage = "queryImportRecordPage";
@ -268,6 +272,7 @@ public class IotRequestMapping {
        public static final String updOrder = "updOrder";
        public static final String createOrder = "createOrder";
        public static final String findAllOrderNo = "findAllOrderNo";
        public static final String findAllOrderBySupplierName = "findAllOrderBySupplierName";
        public static final String findPurcharsePage = "findPurcharsePage";
        public static final String findPurcharseById = "findPurcharseById";
@ -366,6 +371,7 @@ public class IotRequestMapping {
        public static final String findInterfaceById ="findInterfaceById";
        public static final String findAll ="findAll";
        public static final String findAllLog ="findAllLog";
        public static final String findInterfaceLog ="findInterfaceLog";
        public static final String conditionQueryPage ="conditionQueryPage";
        public static final String delete ="delete";
        public static final String dataConsumption ="dataConsumption";

+ 2 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/platform/IotInterfaceLogVO.java

@ -1,5 +1,6 @@
package com.yihu.jw.restmodel.iot.platform;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
@ -31,6 +32,7 @@ public class IotInterfaceLogVO extends BaseVO implements Serializable {
    @ApiModelProperty("调用状态 1:成功   0:失败")
    private int  state;//调用状态 1:成功   0:失败
    @ApiModelProperty("调用时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date time;//调用时间
    @ApiModelProperty("应用名称")
    private String  appName;//应用名称

+ 2 - 5
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java

@ -20,10 +20,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.axis.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.Date;
@ -219,6 +216,6 @@ public class YkyyController extends EnvelopRestEndpoint {
        result.put("fzCount",prescriptionService.getWaitVideoCount(doctor.getId(),"1","1"));//图文复诊数量
        return success("请求成功",result);
    }
    
    
}

+ 13 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java

@ -415,4 +415,17 @@ public class YkyyController extends EnvelopRestEndpoint {
        wxTemplateService.sendWxTemple(userName,senderName,idCard,phone,title,content,contentString,url);
        return success("操作成功");
    }
    
    
    @PostMapping(value = "/sendMesToYkt")
    @ApiOperation(value = "眼科通App消息推送接口")
    public Envelop sendMesToYkt(
            @ApiParam(name = "doctor", value = "医生code", required = true)
            @RequestParam(value = "doctor")String doctor,
            @ApiParam(name = "patient", value = "居民code", required = true)
            @RequestParam(value = "patient")String patient,
            @ApiParam(name = "orderType", value = "订单类型(1图文、2电话 3视频)", required = true)
            @RequestParam(value = "orderType")String orderType) throws Exception{
        return success(ykyyEntranceService.sendMesToYkt(doctor,patient,orderType));
    }
}

+ 20 - 5
svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -2,6 +2,7 @@ package com.yihu.iot.controller.company;
import com.yihu.iot.service.company.IotCompanyCertificateService;
import com.yihu.iot.service.company.IotCompanyService;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.iot.company.IotCompanyCertificateDO;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -11,15 +12,10 @@ import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.elasticsearch.action.ValidateActions;
import org.elasticsearch.common.recycler.Recycler;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
@ -38,6 +34,11 @@ public class IotCompanyController extends EnvelopRestEndpoint {
    @Autowired
    private IotCompanyCertificateService iotCompanyCertificateService;
    @Autowired
    private UserAgent userAgent;
    @GetMapping(value = IotRequestMapping.Company.findCompanyPage)
    @ApiOperation(value = "分页查找企业", notes = "分页查找企业")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findCompanyPage(@ApiParam(name = "accountType", value = "注册类型", defaultValue = "")
@ -335,4 +336,18 @@ public class IotCompanyController extends EnvelopRestEndpoint {
    @GetMapping(value = IotRequestMapping.Company.findCompanyByAccount)
    @ApiOperation(value = "根据账号查询企业状态", notes = "根据账号查询企业状态")
    public MixEnvelop<IotCompanyVO,IotCompanyVO>findCompanyByAccount(){
        try{
            return  iotCompanyService.findCompanyByAccount();
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 15 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java

@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@ -280,7 +281,7 @@ public class IotDeviceController extends EnvelopRestEndpoint {
        }
    }
    @PostMapping(value = IotRequestMapping.Device.uploadDeviceInfo)
    /*@PostMapping(value = IotRequestMapping.Device.uploadDeviceInfo)
    @ApiOperation(value = "导入设备sn码相关信息", notes = "导入设备sn码相关信息")
    public MixEnvelop<IotDeviceImportVO, IotDeviceImportVO> uploadStream(@ApiParam(value = "文件", required = true)
                                                                                     @RequestParam(value = "file", required = true) MultipartFile file,
@ -289,7 +290,19 @@ public class IotDeviceController extends EnvelopRestEndpoint {
            return iotDeviceService.uploadStream(file, request);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload, IotRequestMapping.api_iot_fail);
            return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload);
        }
    }
    @PostMapping(value = IotRequestMapping.Device.downloadTemplate)
    @ApiOperation(value = "下载导入sn码相关信息模板", notes = "下载导入sn码相关信息模板")
    public MixEnvelop downloadTemplate(HttpServletRequest request, HttpServletResponse response) {
        try {
            iotDeviceService.downloadTemplate(request, response);
            return MixEnvelop.getSuccess(IotRequestMapping.FileUpload.message_success_download);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload);
        }
    }*/
}

+ 24 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceOrderController.java

@ -231,4 +231,28 @@ public class IotDeviceOrderController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceOrder.findAllOrderBySupplierName)
    @ApiOperation(value = "根据供应商名称查询所有订单", notes = "根据供应商名称查询所有订单")
    public MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO> findAllOrderBySupplierName( @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                                  @RequestParam(value = "page", required = false) Integer page,
                                                                                          @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                                  @RequestParam(value = "size", required = false) Integer size,
                                                                                          @ApiParam(name = "supplierName", value = "supplierName")
                                                                                  @RequestParam(value = "supplierName", required = true) String supplierName
    ) {
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotDeviceOrderService.findAllOrderBySupplierName(page, size,supplierName);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

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

@ -140,7 +140,7 @@ public class IotDeviceQualityController extends EnvelopRestEndpoint {
                                                                   @ApiParam(name = "summary", value = "质检总结")
                                            @RequestParam(value = "summary", required = true) String summary,
                                                                   @ApiParam(name = "imgs", value = "质检图像")
                                            @RequestBody List<String> imgs ) {
                                            @RequestParam(value = "imgs",required = false,defaultValue = "") List<String> imgs ) {
        try {
            iotDeviceQualityInspectionPlanService.completePlan(id,actualTime,summary,imgs);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find);

+ 24 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java

@ -282,4 +282,28 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.Platform.findInterfaceLog)
    @ApiOperation(value = "根据接口名称分页查询接口日志信息", notes = "根据接口名称分页查询接口日志信息")
    public MixEnvelop<IotInterfaceLogVO, IotInterfaceLogVO> findInterfaceLog(@ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                                 @RequestParam(value = "page", required = false) Integer page,
                                                                             @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                                 @RequestParam(value = "size", required = false) Integer size,
                                                                             @ApiParam(name = "interfaceName", value = "接口名称", defaultValue = "")
                                                                                 @RequestParam(value = "interfaceName") String interfaceName) {
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find, iotInterfaceLogService.findInterfaceLog(page,size,interfaceName));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 2 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyAppDao.java

@ -22,4 +22,6 @@ public interface IotCompanyAppDao extends PagingAndSortingRepository<IotCompanyA
        @Query("from IotCompanyAppDO w where w.id =?1 and w.del=1")
        IotCompanyAppDO findById(String appId);
        }

+ 3 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyDao.java

@ -25,4 +25,7 @@ public interface IotCompanyDao extends PagingAndSortingRepository<IotCompanyDO,
    @Query("from IotCompanyDO w where w.enterType =?1 and w.status=1 and w.del=1")
    List<IotCompanyDO> findByEnterType(String entryType);
    IotCompanyDO findByAccount(String account);
}

+ 3 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceOrderDao.java

@ -19,4 +19,7 @@ public interface IotDeviceOrderDao extends PagingAndSortingRepository<IotDeviceO
    List<IotDeviceOrderDO> findByYmd(String ymd);
    IotDeviceOrderDO findByOrderNoAndDel(String orderNo, Integer del);
    @Query("from IotDeviceOrderDO w where w.supplierName =?1 and w.del=1")
    List<IotDeviceOrderDO> findAllBySupplierName(String supplierName);
}

+ 6 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotInterfaceLogDao.java

@ -3,12 +3,18 @@ package com.yihu.iot.dao.platform;
import com.yihu.jw.entity.iot.platform.IotInterfaceLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/4/28
 */
public interface IotInterfaceLogDao extends PagingAndSortingRepository<IotInterfaceLogDO,String>, JpaSpecificationExecutor<IotInterfaceLogDO> {
    @Query("from IotInterfaceLogDO w where w.interfaceName=?1")
    List<IotInterfaceLogDO>  findAllByInterfaceName(String interfaceName);
}

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

@ -1,14 +1,8 @@
package com.yihu.iot.service.company;
import com.yihu.iot.dao.company.IotCompanyAppDao;
import com.yihu.iot.dao.company.IotCompanyCertificateChangeRecordDao;
import com.yihu.iot.dao.company.IotCompanyDao;
import com.yihu.iot.dao.company.IotCompanyTypeDao;
import com.yihu.iot.dao.company.*;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.iot.company.IotCompanyAppDO;
import com.yihu.jw.entity.iot.company.IotCompanyCertificateChangeRecordDO;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.company.IotCompanyTypeDO;
import com.yihu.jw.entity.iot.company.*;
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
@ -48,6 +42,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
    private UserAgent userAgent;
    /**
     * 审核通过 分页查找
     * @param page
@ -372,6 +367,8 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            iotCompanyAppDao.save(iotCompanyAppDO);
        }
        iotCompany.setAccount(userAgent.getUNAME());
        iotCompany.setEhrUserId(userAgent.getUID());
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create,iotCompany);
    }
@ -604,6 +601,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        companyDO.setAuditTime(DateUtil.getNowDate());
        companyDO.setAuditName(uname);
        iotCompanyDao.save(companyDO);
        return MixEnvelop.getSuccess("审核操作成功");
    }
@ -627,6 +625,8 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        companyDO.setAuditMessage(msg);
        companyDO.setAuditName(uname);
        iotCompanyDao.save(companyDO);
        return MixEnvelop.getSuccess("审核操作成功");
    }
@ -668,4 +668,18 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        return iotCompanyDOS;
    }
    /**
     * 根据账号查询企业状态
     * @return
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findCompanyByAccount() {
        IotCompanyDO companyDO = iotCompanyDao.findByAccount(userAgent.getUNAME());
        if (companyDO==null){
            return MixEnvelop.getError("未入驻企业",-1);
        }
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,companyDO.getStatus());
    }
}

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

@ -76,7 +76,7 @@ public class IotDeviceImportRecordService extends BaseJpaService<IotDeviceImport
        HSSFCell cell2 = row.createCell(2);
        HSSFCell cell3 = row.createCell(3);
        //设置单元格的值
        cell0.setCellValue(vo.getSn());
        cell0.setCellValue(vo.getDeviceSn());
        cell1.setCellValue(vo.getHospital());
        cell2.setCellValue(vo.getSim());
        cell3.setCellValue(msg);
@ -103,7 +103,7 @@ public class IotDeviceImportRecordService extends BaseJpaService<IotDeviceImport
                    addRow(sheet,rowNum,iotDeviceImportVO,errorMsg);
                    continue;
                }
                String sn = iotDeviceImportVO.getSn();
                String sn = iotDeviceImportVO.getDeviceSn();
                String hos = iotDeviceImportVO.getHospital();
                String sim = iotDeviceImportVO.getSim();

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

@ -109,10 +109,16 @@ public class IotDeviceInventoryService extends BaseJpaService<IotDeviceInventory
            for (IotDeviceDO deviceDO : deviceDOS) {
                String deviceSn = deviceDO.getDeviceSn();
                Integer type = deviceInventoryLogDO.getType();//调拨类型(1入库 2设备调拨出库 3核销出库)
                //设备出库,更换相关信息
                if (type.equals("1")) {
                    deviceDO.setSaasId(getCode());
                } else {
                    deviceDO.setProductId(jsonObject.getString("productId"));
                    deviceDO.setName(jsonObject.getString("name"));
                    deviceDO.setCategoryCode(jsonObject.getString("categoryCode"));
                    deviceDO.setCategoryName(jsonObject.getString("categoryName"));
                    deviceDO.setManufacturerId(jsonObject.getString("manufacturerId"));
                    deviceDO.setManufacturerName(jsonObject.getString("manufacturerName"));
                } else {//设备出库,更换相关信息
                    deviceDO = iotDeviceDao.findByDeviceSn(deviceSn);
                    if (type.equals("3")) {
                        deviceDO.setDel(0);
@ -123,12 +129,6 @@ public class IotDeviceInventoryService extends BaseJpaService<IotDeviceInventory
                        continue;
                    }
                }
                deviceDO.setProductId(jsonObject.getString("productId"));
                deviceDO.setName(jsonObject.getString("name"));
                deviceDO.setCategoryCode(jsonObject.getString("categoryCode"));
                deviceDO.setCategoryName(jsonObject.getString("categoryName"));
                deviceDO.setManufacturerId(jsonObject.getString("manufacturerId"));
                deviceDO.setManufacturerName(jsonObject.getString("manufacturerName"));
                deviceDO.setHospital(jsonObject.getString("hospital"));
                deviceDO.setHospitalName(jsonObject.getString("hospitalName"));
                if (StringUtils.isNotBlank(orderId)) {

+ 20 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java

@ -443,4 +443,24 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
        });
        return list;
    }
    /**
     * 根据供应商名称查询所有订单
     * @return
     */
    public MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO>  findAllOrderBySupplierName(Integer page, Integer size,String supplierName) {
        List<IotDeviceOrderDO> listDO = iotDeviceOrderDao.findAllBySupplierName(supplierName);
        //DO转VO
        List<IotDeviceOrderVO> iotDeviceOrderVOList = new ArrayList<>();
        convertToModelVOs(listDO,iotDeviceOrderVOList);
        iotDeviceOrderVOList.forEach(one->{
            findType(one);
        });
        long count=listDO.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,iotDeviceOrderVOList, page, size,count);
    }
}

+ 9 - 4
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java

@ -130,8 +130,8 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
            planDO.setActualTime(DateUtil.strToDate(time));
            planDO.setSummary(summary);
            //设置质检小结与质检图像
            String imgJson = JSONObject.toJSONString(imgs);
            planDO.setImg(imgJson);
            planDO.setImg(imgs.toString());
            iotDeviceQualityInspectionPlanDao.save(planDO);
@ -229,6 +229,7 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
     * @return
     */
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> queryPage(String status, String orderNo, String startTime, String endTime, Integer page, Integer size){
//        SELECT  b.* FROM (SELECT  c.* from iot_device_quality_inspection_plan c  WHERE c.del=1 ORDER BY c.plan_time DESC ) b GROUP BY b.order_no;
        StringBuffer sql = new StringBuffer("SELECT  c.* from iot_device_quality_inspection_plan c  WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
@ -248,8 +249,12 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
            sql.append(" and c.plan_time<=? ");
            args.add(endTime);
        }
        sql.append(" GROUP BY c.order_no ORDER BY c.plan_time DESC limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        sql.append(" ORDER BY c.plan_time DESC ");
//    "SELECT  b.* FROM ("+sql+")"+" b GROUP BY b.order_no limit ";
        StringBuffer sql1= new StringBuffer("SELECT  b.* FROM (");
        sql1.append(sql).append(") b GROUP BY b.order_no limit ").append((page-1)*size).append(",").append(size);
        List<IotDeviceQualityInspectionPlanDO> list = jdbcTempalte.query(sql1.toString(),args.toArray(),new BeanPropertyRowMapper(IotDeviceQualityInspectionPlanDO.class));
        long count = list.size();
        //DO转VO

+ 22 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceService.java

@ -29,6 +29,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -491,4 +493,24 @@ public class IotDeviceService extends BaseJpaService<IotDeviceDO,IotDeviceDao> {
//        IotDeviceImportRecordVO vo = this.importDevice(null,fileName,null,importVOList);
        return MixEnvelop.getSuccess(IotRequestMapping.FileUpload.message_success_upload, importVOList);
    }
    public void downloadTemplate(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String path = IotDeviceService.class.getResource("/").getPath().replace("/WEB-INF/classes/", "")
                + File.separator + "deviceTemplate.xls";
        InputStream inputStream = new FileInputStream(path);
        OutputStream outputStream = response.getOutputStream();
        byte[] b = new byte[2048];
        int length = 0;
        while ((length = inputStream.read(b)) > 0) {
            outputStream.write(b, 0, length);
        }
        outputStream.flush();
        if (outputStream != null) {
            outputStream.close();
        }
        if (inputStream != null) {
            inputStream.close();
        }
    }
}

+ 34 - 7
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceLogService.java

@ -11,6 +11,7 @@ import com.yihu.jw.entity.iot.workType.IotWorkTypeDO;
import com.yihu.jw.restmodel.iot.platform.IotInterfaceLogVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
@ -24,6 +25,7 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.Time;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.*;
@ -54,7 +56,7 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
    /**
     * 分页查询日志信息
     * 分页查询所有接口日志信息
     * @param page
     * @param size
     * @return
@ -62,10 +64,8 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
     */
    public MixEnvelop<IotInterfaceLogVO,IotInterfaceLogVO> findAll(Integer page, Integer size) throws ParseException {
        String sql = "select * from iot_interface_log where 1=1;";
        String sorts = "-updateTime";//按更新时间降序
        String sql = "SELECT * FROM (select * from iot_interface_log c where 1=1  ORDER BY c.time desc) b GROUP BY b.interface_name;";
//        List<IotInterfaceLogDO> list = search(null, filters, sorts, page, size);
        List<IotInterfaceLogDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotInterfaceLogDO.class));
@ -83,6 +83,34 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,resultList,page, size,count);
    }
    /**
     * 根据接口名称分页查询接口日志信息
     * @param page
     * @param size
     * @param interfaceName
     * @return
     */
    public MixEnvelop<IotInterfaceLogVO, IotInterfaceLogVO> findInterfaceLog(Integer page, Integer size, String interfaceName) {
        List<IotInterfaceLogDO> list = iotInterfaceLogDao.findAllByInterfaceName(interfaceName);
        ArrayList<IotInterfaceLogVO> resultList = new ArrayList<>();
        list.forEach(one->{
            IotInterfaceLogVO target = new IotInterfaceLogVO();
            BeanUtils.copyProperties(one,target);
            resultList.add(target);
        });
        long count =list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,resultList,page, size,count);
    }
    /**
     * 数据消费
     * @param page
@ -169,9 +197,8 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
     * @param interfaceName 接口名称
     * @param method 方法名
     * @param workTypeId 业务类型
     * @param time 调用时间
     */
    public void saveLog(String appId, String params, String response, HttpServletRequest request,Integer state,String  interfaceName,String method,String workTypeId,Date time){
    public void saveLog(String appId, String params, String response, HttpServletRequest request,Integer state,String  interfaceName,String method,String workTypeId){
        IotInterfaceLogDO interfaceLogDO = new IotInterfaceLogDO();
        //设置应用与公司
@ -210,7 +237,7 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
        interfaceLogDO.setState(state);
        interfaceLogDO.setInterfaceName(interfaceName);
        interfaceLogDO.setMethod(method);
        interfaceLogDO.setTime(time);
        interfaceLogDO.setTime(DateUtil.getNowDate());
        iotInterfaceLogDao.save(interfaceLogDO);
    }