Przeglądaj źródła

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

huangwenjie 5 lat temu
rodzic
commit
03cf7ebafb
71 zmienionych plików z 4997 dodań i 278 usunięć
  1. 15 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 187 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/XzyyPrescriptionService.java
  3. 10 30
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  4. 25 125
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  5. 116 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  6. 88 5
      business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java
  7. 1 1
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  8. 102 1
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  9. 488 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwGhmxDO.java
  10. 317 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwYsMzJbzdDO.java
  11. 258 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwYsMzJzLsDO.java
  12. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceDO.java
  13. 70 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceOverhaulDO.java
  14. 36 1
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceQualityInspectionPlanDO.java
  15. 161 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceSimDO.java
  16. 40 1
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotPatientDeviceDO.java
  17. 32 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotQualityRecordDO.java
  18. 80 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/message/IotMessageDO.java
  19. 103 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotCompanyAppInterfaceDO.java
  20. 150 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotInterfaceAuditDO.java
  21. 85 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotInterfaceAuditDetailDO.java
  22. 20 0
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
  23. 57 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  24. 1 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceVO.java
  25. 101 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotPatientDeviceVO.java
  26. 42 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/platform/IotAppInterfacesVO.java
  27. 44 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/platform/IotInterfaceAuditVO.java
  28. 7 0
      common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java
  29. 144 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  30. 7 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/RegisterService.java
  31. 250 2
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java
  32. 12 0
      server/svr-authentication/src/main/resources/application.yml
  33. 43 2
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  34. 6 28
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java
  35. 15 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  36. 77 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java
  37. 31 0
      svr/svr-iot-job/src/main/java/com/yihu/jw/job/wlw/DeviceQualityPlanJob.java
  38. 51 0
      svr/svr-iot-job/src/main/java/com/yihu/jw/service/channel/DeviceQualityPlanService.java
  39. 9 1
      svr/svr-iot/pom.xml
  40. 3 6
      svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java
  41. 2 6
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java
  42. 94 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceOverhaulController.java
  43. 30 4
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceQualityController.java
  44. 142 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceSimController.java
  45. 85 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java
  46. 147 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceAuditController.java
  47. 92 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java
  48. 56 3
      svr/svr-iot/src/main/java/com/yihu/iot/controller/workType/IotWorkTypeController.java
  49. 10 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceDao.java
  50. 19 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceOverhaulDao.java
  51. 3 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceQualityInspectionPlanDao.java
  52. 15 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceSimDao.java
  53. 7 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotPatientDeviceDao.java
  54. 17 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/message/IotMessageDao.java
  55. 23 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotCompanyAppInterfaceDao.java
  56. 21 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotInterfaceAuditDao.java
  57. 17 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotInterfaceAuditDetailDao.java
  58. 5 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/workType/IotWorkTypeDao.java
  59. 3 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyCertificateService.java
  60. 9 8
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java
  61. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceInventoryService.java
  62. 40 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOverhaulService.java
  63. 47 20
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java
  64. 172 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java
  65. 165 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java
  66. 10 10
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java
  67. 75 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotCompanyAppInterfaceService.java
  68. 215 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceAuditService.java
  69. 72 5
      svr/svr-iot/src/main/java/com/yihu/iot/service/workType/IotWorkTypeService.java
  70. 19 0
      svr/svr-iot/src/main/resources/application.yml
  71. 90 1
      svr/svr-iot/src/main/resources/bootstrap.yml

+ 15 - 5
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -40,6 +40,8 @@ import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
@ -170,6 +172,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private YkyyService ykyyService;
    @Value("${demo.flag}")
@ -1807,8 +1813,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        prescriptionDO.setDoctor(outpatientDO.getDoctor());
        prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(prescriptionDO.getOutpatientId());
            prescriptionDO.setOrderNo(businessOrderDO.getOrderNo());
            prescriptionDO.setAdmNo(outpatientDO.getAdmNo());
        }
        WlyyPrescriptionDO prescription = prescriptionDao.save(prescriptionDO);
@ -1922,12 +1926,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            prescription.setRegFee(getChargeFee(outpatientDO.getDoctor()));
            //保存费用
            prescriptionDao.save(prescription);
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                ykyyEntranceService.findByRealOrder(prescription.getId());
            }
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                outpatientDO.setStatus("2");
                outpatientDao.save(outpatientDO);
                businessOrderService.savePrescriptionOrder(prescription.getId());
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                BusinessOrderDO businessOrderDO1 = businessOrderDao.selectByRelationCode(prescription.getId());
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
                if(prescriptionDOList!=null&&prescriptionDOList.size()!=0){
                    WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDOList.get(0);
                    ykyyService.updateDrugorderInfo(businessOrderDO.getOrderNo(),businessOrderDO1.getYkOrderId(),wlyyPrescriptionDO.getRealOrder());
                }
                ykyyEntranceService.findByRealOrder(prescription.getId());
                result.put("code", 1);
                result.put("mes", "诊断完成");
                return result;

+ 187 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/XzyyPrescriptionService.java

@ -0,0 +1,187 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2020/05/07.
 */
@Service
@Transactional
public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, PrescriptionDao> {
    private static final Logger logger = LoggerFactory.getLogger(XzyyPrescriptionService.class);
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private PatientRegisterDao patientRegisterDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private PatientMappingDao patientMappingDao;
    /**
     * 挂号接口
     * @param outPatientId
     * @param doctor
     * @return
     */
    public JSONObject registerOutPatient(String outPatientId, String doctor){
        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outPatientId);
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        if (doctorMappingDO == null) {
            throw new RuntimeException("未找到医生映射信息");
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
        if (patientMappingDO==null){
            throw new RuntimeException("未找到居民映射信息");
        }
        //查找居民当天挂号记录
        String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
        List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctor(outpatientDO.getPatient(), date, doctor);
        if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
            WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
            //判断是否已经挂号,如果已经挂号
            if (StringUtils.isNotBlank(registerDO.getRegisterNo())) {
                JSONObject res = new JSONObject();
                res.put("@RESULT", "0");
                logger.info("已经挂号 res: " + res.toString());
                //更新挂号流水号
                outpatientDO.setConNo(registerDO.getConNo());
                outpatientDO.setRegisterNo(registerDO.getRegisterNo());
                outpatientDO.setAdmDate(registerDO.getCreateTime());
                outpatientDao.save(outpatientDO);
                return res;
            }
        }
        JSONArray response =  xzzxEntranceService.registeredOperate(doctorMappingDO.getMappingCode(),outpatientDO.getDept(),patientMappingDO.getMappingCode(),doctorDO.getChargeType());
        JSONObject res = response.getJSONObject(0);
        logger.info("挂号结果 res: " + response.toString());
        String rsCode = res.getString("registerNo");
        if ("0".equals(rsCode)) {
            //存储挂号号
            String serialNo = (String) res.get("registerNo");
            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setAdmDate(new Date());
            logger.info("挂号流水 registerNo: ");
            outpatientDao.save(outpatientDO);
            //存储就诊记录
            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
            // 存储挂号医生与挂号科室
            registerDO.setDoctor(outpatientDO.getDoctor());
            registerDO.setDoctorName(outpatientDO.getDoctorName());
            registerDO.setDept(outpatientDO.getDept());
            registerDO.setDeptName(outpatientDO.getDeptName());
            registerDO.setPatient(outpatientDO.getPatient());
            registerDO.setPatientName(outpatientDO.getPatientName());
            //挂号流水号与挂号次数
            registerDO.setRegisterNo(serialNo);
            registerDO.setCreateTime(new Date());
            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
            patientRegisterDao.save(registerDO);
        } else if ("-2".equals(rsCode)) {
            String serialNo = (String) res.get("registerNo");
            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setAdmDate(new Date());
            logger.info("挂号流水 registerNo: " + serialNo );
            outpatientDao.save(outpatientDO);
            //存储就诊记录
            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
            registerDO.setDoctor(outpatientDO.getDoctor());
            registerDO.setDoctorName(outpatientDO.getDoctorName());
            registerDO.setDept(outpatientDO.getDept());
            registerDO.setDeptName(outpatientDO.getDeptName());
            registerDO.setPatient(outpatientDO.getPatient());
            registerDO.setPatientName(outpatientDO.getPatientName());
            registerDO.setRegisterNo(serialNo);
            registerDO.setCreateTime(new Date());
            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
            patientRegisterDao.save(registerDO);
        }
        //保存日志
        WlyyHttpLogDO log = new WlyyHttpLogDO();
        log.setCode("registerOutPatient");
        log.setName("挂号");
        log.setPatient(outpatientDO.getPatient());
        log.setDoctor(doctor);
        log.setResponse(response.toString());
        log.setRequest("outPatientId=" + outPatientId + "&doctor=" + doctor);
        log.setStatus(rsCode);
        log.setCreateTime(new Date());
        wlyyHttpLogDao.save(log);
        return res;
    }
}

+ 10 - 30
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java

@ -446,37 +446,17 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        if(wxWechatDO==null){
            throw new Exception("can't find wechat:the wxId is "+wechatId);
        }
        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
        if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
            BusinessOrderDO businessOrderDO = new BusinessOrderDO();
            businessOrderDO.setCreateTime(new Date());
            businessOrderDO.setUpdateTime(new Date());
            businessOrderDO.setStatus(0);
            businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDO.setUploadStatus(0);
            businessOrderDO.setPayType(1);
            businessOrderDO.setRelationCode(code);
            businessOrderDO.setRelationName("处方结算");
            businessOrderDO.setOrderCategory("4");
            businessOrderDO.setOrderType(4);
            businessOrderDO.setDoctor(wlyyPrescriptionDO.getDoctor());
            businessOrderDO.setPatient(wlyyPrescriptionDO.getPatientCode());
            businessOrderDO.setPatientName(wlyyPrescriptionDO.getPatientName());
            businessOrderDO.setPayPrice(wlyyPrescriptionDO.getDrugFee()*100);
            businessOrderDO.setDescription("处方结算");
            businessOrderDO = businessOrderDao.save(businessOrderDO);
            if (businessOrderDO!=null){
                List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
                String openId = "";
                if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                    openId = patientWechatDos.get(0).getOpenid();
                }
                String url = wxWechatDO.getBaseUrl();
                String notifyUrl =url;
                String totalFee =businessOrderDO.getPayPrice().intValue()+"";
                map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, WeChatConfig.TRADE_TYPE_JSAPI,openId,businessOrderDO.getOrderNo(),notifyUrl);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(code);
        if (businessOrderDO!=null){
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            String openId = "";
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                openId = patientWechatDos.get(0).getOpenid();
            }
            String url = wxWechatDO.getBaseUrl();
            String notifyUrl =url;
            String totalFee =businessOrderDO.getPayPrice().intValue()+"";
            map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, WeChatConfig.TRADE_TYPE_JSAPI,openId,businessOrderDO.getOrderNo(),notifyUrl);
        }
        return map;
    }

+ 25 - 125
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -900,7 +900,7 @@ public class XzzxEntranceService{
    /**
     * 查询患者就诊卡
     * @param patient 身份证号
     * @param patient 居民code
     * @return
     */
    public JSONArray selectPateintCard(String patient) throws Exception {
@ -922,6 +922,7 @@ public class XzzxEntranceService{
            if (array!=null&&array.size()!=0){
                JSONObject object1 = array.getJSONObject(0);
                if (patientMappingDO==null){
                    patientMappingDO = new PatientMappingDO();
                    patientMappingDO.setIdcard(patientDO.getIdcard());
                    patientMappingDO.setPatientName(patientDO.getName());
                    patientMappingDO.setPatient(patientDO.getId());
@ -969,29 +970,31 @@ public class XzzxEntranceService{
        String response="";
        String url = entranceUrl+"findOutpatientInfo?patient="+patient+"&conNo="+conNo;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject jsonObject = JSONObject.parseObject(response);
        if (jsonObject.getInteger("status")==200){
            array = JSONArray.parseArray(jsonObject.getString("obj")).getJSONArray(0);
            JSONObject object = array.getJSONObject(0);
            outpatientVO.setAdmNo(isEmty(object.getString("admNo")));
            outpatientVO.setOriginAdmNo(isEmty(object.getString("originAdmNo")));
            outpatientVO.setRegisterNo(isEmty(object.getString("registerNo")));
            outpatientVO.setOriginRegisterNo(isEmty(object.getString("originRegisterNo")));
            outpatientVO.setDept(isEmty(object.getString("dept")));
            outpatientVO.setDeptName(isEmty(object.getString("deptName")));
            outpatientVO.setPatient(isEmty(object.getString("patient")));
            outpatientVO.setPatientName(isEmty(object.getString("patientName")));
            outpatientVO.setDoctor(isEmty(object.getString("doctor")));
            outpatientVO.setIdcard(isEmty(object.getString("idcard")));
            outpatientVO.setMjz(isEmty(object.getString("mjz")));
            outpatientVO.setIcd10(isEmty(object.getString("icd10")));
            outpatientVO.setIcd10Name(isEmty(object.getString("icd10Name")));
            outpatientVO.setAdmDate(DateUtil.strToDate(object.getString("admDate")));
            outpatientVO.setConDate(DateUtil.strToDate(object.getString("conDate")));
            outpatientVO.setDescription(isEmty(object.getString("description")));
            outpatientVO.setDiseaseImg(isEmty(object.getString("diseaseImg")));
            outpatientVO.setCreateTime(DateUtil.strToDate(object.getString("createTime")));
            outpatientVO.setStatus(isEmty(object.getString("status")));
            outpatientVO.setAdmNo(isEmty(object.getString("ADMNO")));
            outpatientVO.setOriginAdmNo(isEmty(object.getString("ORIGINADMNO")));
            outpatientVO.setRegisterNo(isEmty(object.getString("REGISTERNO")));
            outpatientVO.setOriginRegisterNo(isEmty(object.getString("ORIGINREGISTERNO")));
            outpatientVO.setDept(isEmty(object.getString("DEPT")));
            outpatientVO.setDeptName(isEmty(object.getString("DEPTNAME")));
            outpatientVO.setPatient(isEmty(object.getString("PATIENT")));
            outpatientVO.setPatientName(isEmty(object.getString("PATIENTNAME")));
            outpatientVO.setDoctor(isEmty(object.getString("DOCTOR")));
            outpatientVO.setDoctorName(isEmty(object.getString("DOCTORNAME")));
            outpatientVO.setIdcard(isEmty(object.getString("IDCARD")));
            outpatientVO.setMjz(isEmty(object.getString("MJZ")));
            outpatientVO.setIcd10(isEmty(object.getString("ICDCODE")));
            outpatientVO.setIcd10Name(isEmty(object.getString("ICDNAME")));
            outpatientVO.setAdmDate(DateUtil.strToDate(object.getString("ADMDATE")));
            outpatientVO.setConDate(DateUtil.strToDate(object.getString("CONDATE")));
            outpatientVO.setDescription(isEmty(object.getString("DESCRIPTION")));
            outpatientVO.setDiseaseImg(isEmty(object.getString("DISEASEIMG")));
            outpatientVO.setCreateTime(DateUtil.strToDate(object.getString("CREATETIME")));
            outpatientVO.setStatus(isEmty(object.getString("STATUS")));
        }
        return outpatientVO;
    }
@ -1015,6 +1018,7 @@ public class XzzxEntranceService{
        }
        String url = entranceUrl+"getOriginPrescriptionList?registerSn="+registerSn+"&patNo="+patNo+"&admNo="+admNo+params;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
        if (object.getInteger("status")==200){
            array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
@ -1193,6 +1197,7 @@ public class XzzxEntranceService{
        String response="";
        String url = entranceUrl+"registered?doctor="+doctor+"&dept="+dept+"&sickId="+sickId+"&clinicclass"+clinicclass;
        response = httpClientUtil.get(url,"GBK");
        logger.info("response:"+response);
        JSONObject object = JSONObject.parseObject(response);
        if (object.getInteger("status")==200){
            array = JSONArray.parseArray(object.getString("obj")).getJSONArray(0);
@ -1206,112 +1211,7 @@ public class XzzxEntranceService{
//============================hospital业务层==================start====================
    /**
     * 挂号接口
     * @param outPatientId
     * @param doctor
     * @param chargeType
     * @return
     */
    public JSONObject registerOutPatient(String outPatientId, String doctor,String chargeType){
        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outPatientId);
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        if (doctorMappingDO == null) {
            throw new RuntimeException("未找到医生映射信息");
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
        if (patientMappingDO==null){
            throw new RuntimeException("未找到居民映射信息");
        }
        //查找居民当天挂号记录
        String date = DateUtil.dateToStr(new Date(), "yyyy-MM-dd");
        List<WlyyPatientRegisterDO> patientRegisterDOs = patientRegisterDao.findByPatientAndDateAndDoctor(outpatientDO.getPatient(), date, doctor);
        if (patientRegisterDOs != null && patientRegisterDOs.size() > 0) {
            WlyyPatientRegisterDO registerDO = patientRegisterDOs.get(0);
            //判断是否已经挂号,如果已经挂号
            if (StringUtils.isNotBlank(registerDO.getRegisterNo())) {
                JSONObject res = new JSONObject();
                res.put("@RESULT", "0");
                logger.info("已经挂号 res: " + res.toString());
                //更新挂号流水号
                outpatientDO.setConNo(registerDO.getConNo());
                outpatientDO.setRegisterNo(registerDO.getRegisterNo());
                outpatientDO.setAdmDate(registerDO.getCreateTime());
                outpatientDao.save(outpatientDO);
                return res;
            }
        }
        JSONArray response =  registeredOperate(doctorMappingDO.getMappingCode(),outpatientDO.getDept(),patientMappingDO.getMappingCode(),chargeType);
        JSONObject res = response.getJSONObject(0);
        logger.info("挂号结果 res: " + response.toString());
        String rsCode = res.getString("registerNo");
        if ("0".equals(rsCode)) {
            //存储挂号号
            String serialNo = (String) res.get("registerNo");
            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setAdmDate(new Date());
            logger.info("挂号流水 registerNo: ");
            outpatientDao.save(outpatientDO);
            //存储就诊记录
            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
            // 存储挂号医生与挂号科室
            registerDO.setDoctor(outpatientDO.getDoctor());
            registerDO.setDoctorName(outpatientDO.getDoctorName());
            registerDO.setDept(outpatientDO.getDept());
            registerDO.setDeptName(outpatientDO.getDeptName());
            registerDO.setPatient(outpatientDO.getPatient());
            registerDO.setPatientName(outpatientDO.getPatientName());
            //挂号流水号与挂号次数
            registerDO.setRegisterNo(serialNo);
            registerDO.setCreateTime(new Date());
            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
            patientRegisterDao.save(registerDO);
        } else if ("-2".equals(rsCode)) {
            String serialNo = (String) res.get("registerNo");
            outpatientDO.setRegisterNo(serialNo);
            outpatientDO.setAdmDate(new Date());
            logger.info("挂号流水 registerNo: " + serialNo );
            outpatientDao.save(outpatientDO);
            //存储就诊记录
            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
            registerDO.setDoctor(outpatientDO.getDoctor());
            registerDO.setDoctorName(outpatientDO.getDoctorName());
            registerDO.setDept(outpatientDO.getDept());
            registerDO.setDeptName(outpatientDO.getDeptName());
            registerDO.setPatient(outpatientDO.getPatient());
            registerDO.setPatientName(outpatientDO.getPatientName());
            registerDO.setRegisterNo(serialNo);
            registerDO.setCreateTime(new Date());
            registerDO.setDate(DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
            patientRegisterDao.save(registerDO);
        }
        //保存日志
        WlyyHttpLogDO log = new WlyyHttpLogDO();
        log.setCode("registerOutPatient");
        log.setName("挂号");
        log.setPatient(outpatientDO.getPatient());
        log.setDoctor(doctor);
        log.setResponse(response.toString());
        log.setRequest("outPatientId=" + outPatientId + "&doctor=" + doctor);
        log.setStatus(rsCode);
        log.setCreateTime(new Date());
        wlyyHttpLogDao.save(log);
        return res;
    }
    /**

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

@ -27,6 +27,7 @@ import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
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;
@ -124,7 +125,8 @@ public class YkyyEntranceService {
    @Autowired
    private YkDictIcd10Dao ykDictIcd10Dao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
@ -1046,6 +1048,9 @@ public class YkyyEntranceService {
                WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(object,WlyyPrescriptionInfoVO.class);
                wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
            }
            //诊断
            synPrescriptionDiagnosis(prescriptionVO);
            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            synPrecriptionHis(prescriptionVO,code);
        }
@ -1054,6 +1059,110 @@ public class YkyyEntranceService {
    }
    /**
     * 诊断
     * @param wlyyPrescriptionVO
     */
    public void synPrescriptionDiagnosis(WlyyPrescriptionVO wlyyPrescriptionVO) throws Exception{
        String doctor = wlyyPrescriptionVO.getDoctor();
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        String patient = wlyyPrescriptionVO.getPatientCode();
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        Integer GHXH = 0;
        //挂号明细表HLW_GHMX
        HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
        hlwGhmxDO.setSBXH(0);
        hlwGhmxDO.setJZXH(1);
        hlwGhmxDO.setGHCS(1);
        hlwGhmxDO.setGHJE(0);
        hlwGhmxDO.setZLJE(0);
        hlwGhmxDO.setZJFY(0);
        hlwGhmxDO.setBLJE(0);
        hlwGhmxDO.setXJJE(0);
        hlwGhmxDO.setZPJE(0);
        hlwGhmxDO.setZHJE(0);
        hlwGhmxDO.setHBWC(0);
        hlwGhmxDO.setQTYS(0);
        hlwGhmxDO.setTHBZ(0);
        hlwGhmxDO.setCZPB(0);
        hlwGhmxDO.setMZLB(0);
        hlwGhmxDO.setYSPB(0);
        hlwGhmxDO.setSFFS(0);
        hlwGhmxDO.setJZZT(2);
        if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
            hlwGhmxDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
        }
        hlwGhmxDO.setKSDM(wlyyPrescriptionVO.getDept());
        hlwGhmxDO.setBRID(Integer.parseInt(patientMappingDO.getMappingCode()));
        String jsonString = JSONObject.toJSONString(hlwGhmxDO);
        Map<String,Object> params = new HashedMap();
        params.put("json",jsonString);
        params.put("table","HlwGhmxDO");
        logger.info("HlwGhmxDO:"+jsonString);
        HttpResponse response = HttpUtils.doGet(saveUrl,params);
        if (response.getStatus()==200){
            String content = response.getContent();
            logger.info("content"+content);
            JSONObject jsonObject = JSONObject.parseObject(content);
            JSONObject object = jsonObject.getJSONObject("obj");
            if (object!=null){
                GHXH = object.getInteger("sbxh");
                logger.info("GHXH=========="+GHXH);
            }
            logger.info("表hlwGhmxDO同步成功!");
        }
        //就诊历史表HLWYS_MZ_JZLS
        HlwYsMzJzLsDO hlwYsMzJzLsDO = new HlwYsMzJzLsDO();
        hlwYsMzJzLsDO.setJZXH(0);
        hlwYsMzJzLsDO.setGHXH(GHXH);
        hlwYsMzJzLsDO.setBRBH(Integer.parseInt(patientMappingDO.getMappingCode()));
        hlwYsMzJzLsDO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
        hlwYsMzJzLsDO.setYSDM(doctorMappingDO.getMappingCode());
        hlwYsMzJzLsDO.setKSSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
        hlwYsMzJzLsDO.setJZZT(9);
        if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
            hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
        }
        String jsonString2 = JSONObject.toJSONString(hlwYsMzJzLsDO);
        Map<String,Object> params2 = new HashedMap();
        params2.put("json",jsonString2);
        params2.put("table","HlwYsMzJzLsDO");
        logger.info("HlwYsMzJzLsDO:"+jsonString2);
        HttpResponse response2 = HttpUtils.doGet(saveUrl,params2);
        if (response2.getStatus()==200){
            logger.info("content"+response2.getContent());
            logger.info("表hlwYsMzJzLsDO同步成功!");
        }
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionVO.getId());
        for (WlyyPrescriptionDiagnosisDO diagnosisDO : diagnosisDOs){
            //疾病诊断表HLWYS_MZ_JBZD
            HlwYsMzJbzdDO hlwYsMzJbzdDO = new HlwYsMzJbzdDO();
            //hlwYsMzJbzdDO.setJLBH(0);
            hlwYsMzJbzdDO.setJZXH(0);
            if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                hlwYsMzJbzdDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
            }
            hlwYsMzJbzdDO.setYSDM(doctorMappingDO.getMappingCode());
            hlwYsMzJbzdDO.setICD(diagnosisDO.getCode());
            hlwYsMzJbzdDO.setMSZD(diagnosisDO.getName());
            String jsonString1 = JSONObject.toJSONString(hlwYsMzJbzdDO);
            Map<String,Object> params1 = new HashedMap();
            params1.put("json",jsonString1);
            params1.put("table","HlwYsMzJbzdDO");
            logger.info("HlwYsMzJbzdDO:"+jsonString1);
            HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
            if (response1.getStatus()==200){
                logger.info("content"+response1.getContent());
                logger.info("表hlwYsMzJbzdDO同步成功!");
            }
        }
    }
    public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception {
        HlwCf01DO hlwCf01DO = new HlwCf01DO();
        logger.info("开始===================");
@ -1181,6 +1290,12 @@ public class YkyyEntranceService {
                    hlwCf02DO.setGYTJ(wlyyPrescriptionInfoVO.getYpyf());
                    hlwCf02DO.setPSPB(0);
                    hlwCf02DO.setYYTS(1);
                    hlwCf02DO.setYCJL(wlyyPrescriptionInfoVO.getDosage()!=null?Double.parseDouble(wlyyPrescriptionInfoVO.getDosage()):0);
                    hlwCf02DO.setZBBZ(0);
                    hlwCf02DO.setYDFYBZ(0);
                    hlwCf02DO.setTYSQSL(0);
                    hlwCf02DO.setZJFLAG(0);
                    hlwCf02DO.setSPZT(0);
                    if (wlyyPrescriptionInfoVO.getHisCode()!=null){
                        hlwCf02DO.setSBXH(wlyyPrescriptionInfoVO.getHisCode());
                    }

+ 88 - 5
business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java

@ -299,13 +299,88 @@ public class YkyyService {
  /*  public String forgetPassword(String tel,String password){
    /**
     * 更新药品订单信息
     * @param orderNo 订单号
     * @param drugorder 药品订单[商城订单编号]
     * @param cfsb 处方识别号
     * @return
     */
    public String updateDrugorderInfo(String orderNo,String drugorder,String cfsb){
        String response="";
        String url = yktUrl+"doc_jkzl/update_drugorder_infor?order_no="+orderNo+"&drugorder="+drugorder+"$cfsb="+cfsb;
        response = httpClientUtil.get(url,"GBK");
        logger.info("更新药品订单信息:"+response);
        return response;
    }
    /**增加处方订单接口
     *
     * drugType	String	药品类型【1,到院 2、到商城】
    orderId	String	订单Id
    userId	String	用户Id
    Shopping	String	药品列表
    commodityName	String	药品名称
    commodityPrice	String	价格
    purchaseQuantity	String	数量
    DrugUnit	String	单位
    MedicineDoctor	String	医生Id
    [{"commodityName":"","commodityPrice":"","DrugUnit":"","MedicineDoctor":""}]
     * @return
     */
    public String addOrder4Jkzl(String drugType,String orderId,String userId,JSONArray array ){
        String response="";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("drugType",drugType);//药品类型【1,到院 2、到商城】
        jsonObject.put("orderId","");//订单Id
        jsonObject.put("userId",userId);//用户Id
        jsonObject.put("Shopping",array);//药品列表
        String url = "http://www.yanketong.com:90/api/Doctor/AddOrder4Jkzl";
        response = httpClientUtil.sendPost(url,jsonObject.toJSONString());
        logger.info("增加处方订单接口:"+response);
        return response;
    }
    public String GetDoctorInfoByLoginId(String loginId) throws Exception{
        String response = "";
        String url = "http://www.yanketong.com:90/api/doctor/GetDoctorInfoByTel?loginId="+loginId;
        response = httpClientUtil.get(url,"utf-8");
        logger.info("根据电话获取医生信息接口:"+response);
        if (StringUtils.isNoneBlank(response)){
            JSONObject json = JSONObject.parseObject(response);
            if (json.getString("code").equalsIgnoreCase("10000")){
                String verifyCode = json.getJSONObject("value").getString("verifyCode");
                return verifyCode;
            }else {
                throw new Exception("获取失败");
            }
        }else {
            throw new Exception("获取失败");
        }
    }
    /**获取眼科通忘记密码信息
     *
     * @param tel
     * @param password
     * @param vercode
     * @return
     */
    public String forgetPassword(String tel,String password,String vercode){
        String response="";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("loginid",tel);
        jsonObject.put("password",password);
        jsonObject.put("VerCode",vercode);
        String url = "http://www.yanketong.com:90/api/Patient/ForgotPassword";
        response = httpClientUtil.httpPost(url,"GBK");
        logger.info("获取眼科通登录信息:"+response);
        response = httpClientUtil.sendPost(url,jsonObject.toJSONString());
        logger.info("获取眼科通忘记密码信息:"+response);
        return response;
    }*/
    }
    /**
     * 同步眼科通数据
@ -313,7 +388,8 @@ public class YkyyService {
     * @return
     * @throws Exception
     */
    public void registerYkt(String patient) throws Exception {
    public String registerYkt(String patient) throws Exception {
        String yktId1 = "";
        BasePatientDO basePatientDO  = patientDao.findById(patient);
        if (basePatientDO!=null){
            String userId = basePatientDO.getUserId();
@ -327,6 +403,7 @@ public class YkyyService {
                        JSONObject jsonObject = array.getJSONObject(0);
                        if (jsonObject!=null){
                            String yktId = jsonObject.getString("ID");
                            yktId1=yktId;
                            basePatientDO.setYktId(yktId);
                            patientDao.save(basePatientDO);
                        }
@ -339,6 +416,7 @@ public class YkyyService {
                        if (object2.getString("code").equalsIgnoreCase("200")){
                            JSONObject object3 = object2.getJSONObject("data");
                            String yktId = object3.getString("ID");
                            yktId1=yktId;
                            basePatientDO.setYktId(yktId);
                            patientDao.save(basePatientDO);
                        }
@ -369,6 +447,7 @@ public class YkyyService {
                                    JSONObject jsonObject1 = array.getJSONObject(0);
                                    if (jsonObject1!=null){
                                        String yktId = jsonObject1.getString("ID");
                                        yktId1=yktId;
                                        userId = jsonObject1.getString("ASSUSERID");
                                        basePatientDO.setYktId(yktId);
                                        basePatientDO.setUserId(userId);
@ -383,6 +462,7 @@ public class YkyyService {
                                    if (object2.getString("code").equalsIgnoreCase("200")){
                                        JSONObject object3 = object2.getJSONObject("data");
                                        String yktId = object3.getString("ID");
                                        yktId1=yktId;
                                        basePatientDO.setYktId(yktId);
                                        userId = object3.getString("ASSUSERID");
                                        basePatientDO.setUserId(userId);
@ -407,6 +487,7 @@ public class YkyyService {
                            JSONObject jsonObject1 = array.getJSONObject(0);
                            if (jsonObject1!=null){
                                String yktId = jsonObject1.getString("ID");
                                yktId1=yktId;
                                userId = jsonObject1.getString("ASSUSERID");
                                basePatientDO.setYktId(yktId);
                                basePatientDO.setUserId(userId);
@ -422,6 +503,7 @@ public class YkyyService {
                            if (object2.getString("code").equalsIgnoreCase("200")){
                                JSONObject object3 = object2.getJSONObject("data");
                                String yktId = object3.getString("ID");
                                yktId1=yktId;
                                basePatientDO.setYktId(yktId);
                                userId = object3.getString("ASSUSERID");
                                basePatientDO.setUserId(userId);
@ -436,6 +518,7 @@ public class YkyyService {
                }
            }
        }
        return yktId1;
    }

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -808,7 +808,6 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                    "JOIN muc_messages m ON m.session_id = t.session_id AND m.`timestamp` >= t.create_time AND m.`timestamp` <= t.end_time " +
                    "AND t.id = '"+info.get("consult").toString()+"' ORDER BY m.`timestamp` ASC";*/
            List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sqlMessage);
            String content="";
            JSONArray array = new JSONArray();
            for (Map<String,Object> map:list1){
                String sql1= "SELECT\n" +
@ -877,6 +876,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                jb.put("visit_time", info.get("czrq")==null?"1900-01-01":DateUtil.dateToStrLong((Date)info.get("czrq")));
                jb.put("visit_finish_time", info.get("end_time")==null?"1900-01-01":DateUtil.dateToStrLong((Date)info.get("end_time")));
                jb.put("complaint_content", info.get("content"));
                logger.info("complaint_content"+info.get("content"));
               /* String procFile="";
                if (info.get("content")!=null){
                    JSONArray array = JSONArray.parseArray(info.get("content").toString());

+ 102 - 1
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -12,12 +12,14 @@ import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.dao.BusinessOrderDao;
@ -79,9 +81,103 @@ public class BusinessOrderService {
    private PrescriptionDao prescriptionDao;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    /**
     *
     * 处方下单
     * drugType	String	药品类型【1,到院 2、到商城】
     orderId	String	订单Id
     userId	String	用户Id
     Shopping	String	药品列表
     commodityName	String	药品名称
     commodityPrice	String	价格
     purchaseQuantity	String	数量
     DrugUnit	String	单位
     MedicineDoctor	String	医生Id
     [{"commodityName":"","commodityPrice":"","DrugUnit":"","MedicineDoctor":""}]
     * @return
     * @throws Exception
     */
    public List<BusinessOrderDO> savePrescriptionOrder(String code) throws Exception {
        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
        List<BusinessOrderDO> businessOrderDOS = new ArrayList<>();
        if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(wlyyPrescriptionDO.getId());
            if (businessOrderDO==null){
                businessOrderDO = new BusinessOrderDO();
                businessOrderDO.setCreateTime(new Date());
                businessOrderDO.setUpdateTime(new Date());
                businessOrderDO.setStatus(0);
                businessOrderDO.setOrderNo("VAS4"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
                businessOrderDO.setUploadStatus(0);
                businessOrderDO.setPayType(1);
                businessOrderDO.setRelationCode(code);
                businessOrderDO.setRelationName("处方结算");
                businessOrderDO.setOrderCategory("4");
                businessOrderDO.setOrderType(4);
                businessOrderDO.setDoctor(wlyyPrescriptionDO.getDoctor());
                businessOrderDO.setPatient(wlyyPrescriptionDO.getPatientCode());
                businessOrderDO.setPatientName(wlyyPrescriptionDO.getPatientName());
                businessOrderDO.setPayPrice(wlyyPrescriptionDO.getDrugFee()*100);
                businessOrderDO.setDescription("处方结算");
                businessOrderDO = businessOrderDao.save(businessOrderDO);
                businessOrderDOS.add(businessOrderDO);
                wlyyPrescriptionDO.setOrderNo(businessOrderDO.getOrderNo());
                prescriptionDao.save(wlyyPrescriptionDO);
                JSONArray array = new JSONArray();
                List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(code);
                for (WlyyPrescriptionInfoDO prescriptionInfoDO:wlyyPrescriptionInfoDOS){
                    JSONObject object = new JSONObject();
                    //{"commodityName":"","commodityPrice":"","DrugUnit":"","MedicineDoctor":""}
                    object.put("commodityName",prescriptionInfoDO.getDrugName());
                    object.put("commodityPrice",prescriptionInfoDO.getPackRetprice());
                    object.put("DrugUnit",prescriptionInfoDO.getPackUnitName());
                    DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(businessOrderDO.getDoctor());
                    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("医生映射表不存在!");
                    }
                    object.put("MedicineDoctor",yktDoctor);
                    array.add(object);
                }
                BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
                String userId =null;
                if (patientDO!=null){
                    userId = patientDO.getUserId();
                }
                String response = ykyyService.addOrder4Jkzl("1","",userId,array);
                if (StringUtils.isNoneBlank(response)){
                    JSONObject jsonObject = JSONObject.parseObject(response);
                    if (jsonObject.getString("code").equalsIgnoreCase("10000")){
                        String orderId = jsonObject.getString("orderId");
                        String orderNo = jsonObject.getString("orderNo");
                        businessOrderDO.setYkOrderId(orderId);
                        businessOrderDO.setYkOrderNo(orderNo);
                        businessOrderDO.setUploadStatus(1);
                        businessOrderDao.save(businessOrderDO);
                    }
                }
            }
        }
        return businessOrderDOS;
    }
    /**
     * @param businessOrderDO
@ -112,7 +208,12 @@ public class BusinessOrderService {
        String patient = businessOrderDO.getPatient();
        BasePatientDO basePatientDO = patientDao.findById(patient);
        String orderNo = businessOrderDO.getOrderNo();
        String patientId = basePatientDO.getYktId();
        String patientId = "";
        if (StringUtils.isNoneBlank(basePatientDO.getYktId())){
            patientId = basePatientDO.getYktId();
        }else {
            patientId = ykyyService.registerYkt(basePatientDO.getId());
        }
        String orderAmout = businessOrderDO.getPayPrice().toString();
        String description = businessOrderDO.getDescription();
        String state = businessOrderDO.getStatus().toString();

+ 488 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwGhmxDO.java

@ -0,0 +1,488 @@
package com.yihu.jw.entity.hospital.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.util.Date;
/**
 * 挂号明细表
 *
 * */
//@ApiModel(value = "HlwCf01VO", description = "眼科处方表1数据")
@Entity
@Table(name = "v_hlw_ghmx")
public class HlwGhmxDO {
    private Integer sBXH;//NUMBER(18)N0识别序号
    private Integer bRID;//NUMBER(18)Y病人ID号
    private Integer bRXZ;//NUMBER(4)Y病人性质
    private Date gHSJ;//DATEY挂号时间
    private Integer gHLB;//NUMBER(4)Y挂号类别
    private String kSDM;//VARCHAR2(6)Y科室代码
    private String ySDM;//VARCHAR2(10)Y医生代码
    private String jZYS;//VARCHAR2(10)Y接诊医生;该字段院长查询使用,用于按医生统计挂号人数,导数据时根据处方、检查单及发票将医生写入到该字段中
    private Integer jZXH;//NUMBER(4)N1就诊序号
    private Integer gHCS;//NUMBER(4)N1挂号次数
    private Integer gHJE;//NUMBER(10;2)N0挂号金额
    private Integer zLJE;//NUMBER(10;2)N0诊疗金额
    private Integer zJFY;//NUMBER(10;2)N0专家费用
    private Integer bLJE;//NUMBER(10;2)N0病历金额
    private Integer xJJE;//NUMBER(10;2)N0现金金额
    private Integer zPJE;//NUMBER(10;2)N0支票金额
    private Integer zHJE;//NUMBER(10;2)N0帐户金额
    private Integer hBWC;//NUMBER(10;2)N0货币误差
    private Integer qTYS;//NUMBER(10;2)N0其他应收
    private Integer zHLB;//NUMBER(2)Y帐户类别
    private Integer jZJS;//NUMBER(1)Y0就诊结束
    private Integer zDJG;//NUMBER(6)Y诊断结果
    private Integer tHBZ;//NUMBER(1)N0退号标志:0正常、1退号、9申请退号
    private String cZGH;//VARCHAR2(10)Y操作工号
    private Date jZRQ;//DATEY结帐日期
    private Date hZRQ;//DATEY汇总日期
    private Integer cZPB;//NUMBER(4)N0初诊判别
    private Integer jZHM;//VARCHAR2(12)Y就诊号码
    private Integer mZLB;//NUMBER(2)N0门诊类别
    private Integer yYBZ;//NUMBER(1)Y0预约标志
    private Integer ySPB;//NUMBER(1)N0医生判别
    private Integer dZSB;//NUMBER(1)Y导诊识别;导诊识别标志;0表示导诊台未处理;1表示导诊台已经处理
    private Integer sFFS;//NUMBER(1)N0收费方式
    private Integer jZZT;//NUMBER(1)N0就诊状态;0:挂号  1:就诊中  2:就诊结束
    private Integer ySLB;//NUMBER(1)Y
    private String gHLSH;//VARCHAR2(16)Y
    private Integer sLJCFY;//NUMBER(10;2)Y0视力检查费用
    private Integer gLYJXH;//NUMBER(18)Y关联医技序号
    private Integer jZPB;//NUMBER(1)Y
    private Integer yGJB;//NUMBER(5)Y
    private Integer pJBZ;//NUMBER(1)Y0配镜标志
    private Integer wLYY;//NUMBER(1)Y00表示HIS,1表示网络预约未到,2表示网络预约已到医院就诊
    private Integer ySFY;//NUMBER(10;2)Y药事费用
    private String ySZJDJ;//VARCHAR2(12)Y医师诊察费收费等级
    private Integer sLJZFS;//NUMBER(1)Y力矫正方式:1角塑、2框架、3训练
    private String aKA078;//VARCHAR2(10)Y医疗就诊方式
    private String bKE241;//VARCHAR2(10)Y数据来源
    @Id
    @Column(name = "SBXH")
    public Integer getSBXH() {
        return sBXH;
    }
    public void setSBXH(Integer sBXH) {
        this.sBXH = sBXH;
    }
    @Column(name = "BRID")
    public Integer getBRID() {
        return bRID;
    }
    public void setBRID(Integer bRID) {
        this.bRID = bRID;
    }
    @Column(name = "BRXZ")
    public Integer getBRXZ() {
        return bRXZ;
    }
    public void setBRXZ(Integer bRXZ) {
        this.bRXZ = bRXZ;
    }
    @Column(name = "GHSJ")
    public Date getGHSJ() {
        return gHSJ;
    }
    public void setGHSJ(Date gHSJ) {
        this.gHSJ = gHSJ;
    }
    @Column(name = "GHLB")
    public Integer getGHLB() {
        return gHLB;
    }
    public void setGHLB(Integer gHLB) {
        this.gHLB = gHLB;
    }
    @Column(name = "KSDM")
    public String getKSDM() {
        return kSDM;
    }
    public void setKSDM(String kSDM) {
        this.kSDM = kSDM;
    }
    @Column(name = "YSDM")
    public String getYSDM() {
        return ySDM;
    }
    public void setYSDM(String ySDM) {
        this.ySDM = ySDM;
    }
    @Column(name = "JZYS")
    public String getJZYS() {
        return jZYS;
    }
    public void setJZYS(String jZYS) {
        this.jZYS = jZYS;
    }
    @Column(name = "JZXH")
    public Integer getJZXH() {
        return jZXH;
    }
    public void setJZXH(Integer jZXH) {
        this.jZXH = jZXH;
    }
    @Column(name = "GHCS")
    public Integer getGHCS() {
        return gHCS;
    }
    public void setGHCS(Integer gHCS) {
        this.gHCS = gHCS;
    }
    @Column(name = "GHJE")
    public Integer getGHJE() {
        return gHJE;
    }
    public void setGHJE(Integer gHJE) {
        this.gHJE = gHJE;
    }
    @Column(name = "ZLJE")
    public Integer getZLJE() {
        return zLJE;
    }
    public void setZLJE(Integer zLJE) {
        this.zLJE = zLJE;
    }
    @Column(name = "ZJFY")
    public Integer getZJFY() {
        return zJFY;
    }
    public void setZJFY(Integer zJFY) {
        this.zJFY = zJFY;
    }
    @Column(name = "BLJE")
    public Integer getBLJE() {
        return bLJE;
    }
    public void setBLJE(Integer bLJE) {
        this.bLJE = bLJE;
    }
    @Column(name = "XJJE")
    public Integer getXJJE() {
        return xJJE;
    }
    public void setXJJE(Integer xJJE) {
        this.xJJE = xJJE;
    }
    @Column(name = "ZPJE")
    public Integer getZPJE() {
        return zPJE;
    }
    public void setZPJE(Integer zPJE) {
        this.zPJE = zPJE;
    }
    @Column(name = "ZHJE")
    public Integer getZHJE() {
        return zHJE;
    }
    public void setZHJE(Integer zHJE) {
        this.zHJE = zHJE;
    }
    @Column(name = "HBWC")
    public Integer getHBWC() {
        return hBWC;
    }
    public void setHBWC(Integer hBWC) {
        this.hBWC = hBWC;
    }
    @Column(name = "QTYS")
    public Integer getQTYS() {
        return qTYS;
    }
    public void setQTYS(Integer qTYS) {
        this.qTYS = qTYS;
    }
    @Column(name = "ZHLB")
    public Integer getZHLB() {
        return zHLB;
    }
    public void setZHLB(Integer zHLB) {
        this.zHLB = zHLB;
    }
    @Column(name = "JZJS")
    public Integer getJZJS() {
        return jZJS;
    }
    public void setJZJS(Integer jZJS) {
        this.jZJS = jZJS;
    }
    @Column(name = "ZDJG")
    public Integer getZDJG() {
        return zDJG;
    }
    public void setZDJG(Integer zDJG) {
        this.zDJG = zDJG;
    }
    @Column(name = "THBZ")
    public Integer getTHBZ() {
        return tHBZ;
    }
    public void setTHBZ(Integer tHBZ) {
        this.tHBZ = tHBZ;
    }
    @Column(name = "CZGH")
    public String getCZGH() {
        return cZGH;
    }
    public void setCZGH(String cZGH) {
        this.cZGH = cZGH;
    }
    @Column(name = "JZRQ")
    public Date getJZRQ() {
        return jZRQ;
    }
    public void setJZRQ(Date jZRQ) {
        this.jZRQ = jZRQ;
    }
    @Column(name = "HZRQ")
    public Date getHZRQ() {
        return hZRQ;
    }
    public void setHZRQ(Date hZRQ) {
        this.hZRQ = hZRQ;
    }
    @Column(name = "CZPB")
    public Integer getCZPB() {
        return cZPB;
    }
    public void setCZPB(Integer cZPB) {
        this.cZPB = cZPB;
    }
    @Column(name = "JZHM")
    public Integer getJZHM() {
        return jZHM;
    }
    public void setJZHM(Integer jZHM) {
        this.jZHM = jZHM;
    }
    @Column(name = "MZLB")
    public Integer getMZLB() {
        return mZLB;
    }
    public void setMZLB(Integer mZLB) {
        this.mZLB = mZLB;
    }
    @Column(name = "YYBZ")
    public Integer getYYBZ() {
        return yYBZ;
    }
    public void setYYBZ(Integer yYBZ) {
        this.yYBZ = yYBZ;
    }
    @Column(name = "YSPB")
    public Integer getYSPB() {
        return ySPB;
    }
    public void setYSPB(Integer ySPB) {
        this.ySPB = ySPB;
    }
    @Column(name = "DZSB")
    public Integer getDZSB() {
        return dZSB;
    }
    public void setDZSB(Integer dZSB) {
        this.dZSB = dZSB;
    }
    @Column(name = "SFFS")
    public Integer getSFFS() {
        return sFFS;
    }
    public void setSFFS(Integer sFFS) {
        this.sFFS = sFFS;
    }
    @Column(name = "JZZT")
    public Integer getJZZT() {
        return jZZT;
    }
    public void setJZZT(Integer jZZT) {
        this.jZZT = jZZT;
    }
    @Column(name = "YSLB")
    public Integer getYSLB() {
        return ySLB;
    }
    public void setYSLB(Integer ySLB) {
        this.ySLB = ySLB;
    }
    @Column(name = "GHLSH")
    public String getGHLSH() {
        return gHLSH;
    }
    public void setGHLSH(String gHLSH) {
        this.gHLSH = gHLSH;
    }
    @Column(name = "SLJCFY")
    public Integer getSLJCFY() {
        return sLJCFY;
    }
    public void setSLJCFY(Integer sLJCFY) {
        this.sLJCFY = sLJCFY;
    }
    @Column(name = "GLYJXH")
    public Integer getGLYJXH() {
        return gLYJXH;
    }
    public void setGLYJXH(Integer gLYJXH) {
        this.gLYJXH = gLYJXH;
    }
    @Column(name = "JZPB")
    public Integer getJZPB() {
        return jZPB;
    }
    public void setJZPB(Integer jZPB) {
        this.jZPB = jZPB;
    }
    @Column(name = "YGJB")
    public Integer getYGJB() {
        return yGJB;
    }
    public void setYGJB(Integer yGJB) {
        this.yGJB = yGJB;
    }
    @Column(name = "PJBZ")
    public Integer getPJBZ() {
        return pJBZ;
    }
    public void setPJBZ(Integer pJBZ) {
        this.pJBZ = pJBZ;
    }
    @Column(name = "WLYY")
    public Integer getWLYY() {
        return wLYY;
    }
    public void setWLYY(Integer wLYY) {
        this.wLYY = wLYY;
    }
    @Column(name = "YSFY")
    public Integer getYSFY() {
        return ySFY;
    }
    public void setYSFY(Integer ySFY) {
        this.ySFY = ySFY;
    }
    @Column(name = "YSZJDJ")
    public String getYSZJDJ() {
        return ySZJDJ;
    }
    public void setYSZJDJ(String ySZJDJ) {
        this.ySZJDJ = ySZJDJ;
    }
    @Column(name = "SLJZFS")
    public Integer getSLJZFS() {
        return sLJZFS;
    }
    public void setSLJZFS(Integer sLJZFS) {
        this.sLJZFS = sLJZFS;
    }
    @Column(name = "AKA078")
    public String getAKA078() {
        return aKA078;
    }
    public void setAKA078(String aKA078) {
        this.aKA078 = aKA078;
    }
    @Column(name = "BKE241")
    public String getBKE241() {
        return bKE241;
    }
    public void setBKE241(String bKE241) {
        this.bKE241 = bKE241;
    }
}

+ 317 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwYsMzJbzdDO.java

@ -0,0 +1,317 @@
package com.yihu.jw.entity.hospital.prescription;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
/**
 * 疾病诊断表
 *
 * */
@Entity
@Table(name = "v_hlwys_mz_jbzd")
public class HlwYsMzJbzdDO {
    private Integer jLBH;//N	NUMBER(18)	N			主键
    private Integer jZXH;//N	NUMBER(18)	N			就诊序号
    private Integer bRBH;//N	NUMBER(18)	Y			病人ID号
    private Integer jBBH;//N	NUMBER(18)	Y			V_HLW_ICD10.FLAG
    private Integer zDLB;//N	NUMBER(9)	Y			11 诊断类别
    private Integer jBZG;//N	NUMBER(9)	Y
    private String  ySDM;//N	VARCHAR2(10)	N			医生代码
    private Date    zDSJ;//N	DATE	Y			诊断时间
    private Integer zFPB;//N	NUMBER(1)	Y	0		作废判别
    private String  iCD;//N	VARCHAR2(20)	Y			icd编码
    private String  mSZD;//N	VARCHAR2(100)	Y			诊断名称
    private Integer zZBJ;//N	NUMBER(1)	Y
    private Integer qZBZ;//N	NUMBER(1)	Y			确诊标志
    private String bZXX;//N	VARCHAR2(100)	Y			备注信息
    private Date qZSJ;//N	DATE	Y			确诊时间
    private Integer zXLB;//N	NUMBER(1)	Y	1		诊断类别 1.西医 2.中医
    private Integer zNXH;//N	NUMBER(2)	Y			组内序号,同一个组内,疾病排列
    private String jBMC;//N	VARCHAR2(50)	Y			诊断名称
    private Integer fJBS;//N	NUMBER(18)	Y
    private Integer tJBZ;//N	NUMBER(1)	Y			提交标志
    private Integer bKZT;//N	NUMBER(1)	Y
    private Integer dYBZ;//N	NUMBER(1)	Y	0
    private Integer zDLX;//N	NUMBER(9)	Y			诊断类型 默认1
    private Integer zDXH;//N	NUMBER(18)	Y			诊断序号唯一就行目前
    private String jBZH;//N	VARCHAR2(2)	Y			1 疾病组号。 区分不同组
    private String fJMC;//N	VARCHAR2(60)	Y
    private String yWBS;//N	VARCHAR2(50)	Y
    private String zFYS;//N	VARCHAR2(10)	Y
    private Date zFSJ;//N	DATE	Y
    private Integer zJFLAG;//N	NUMBER(1)	Y	0		传输标记
    @Id
    @Column(name = "JLBH")
    public Integer getJLBH() {
        return jLBH;
    }
    public void setJLBH(Integer jLBH) {
        this.jLBH = jLBH;
    }
    @Column(name = "JZXH")
    public Integer getJZXH() {
        return jZXH;
    }
    public void setJZXH(Integer jZXH) {
        this.jZXH = jZXH;
    }
    @Column(name = "BRBH")
    public Integer getBRBH() {
        return bRBH;
    }
    public void setBRBH(Integer bRBH) {
        this.bRBH = bRBH;
    }
    @Column(name = "JBBH")
    public Integer getJBBH() {
        return jBBH;
    }
    public void setJBBH(Integer jBBH) {
        this.jBBH = jBBH;
    }
    @Column(name = "ZDLB")
    public Integer getZDLB() {
        return zDLB;
    }
    public void setZDLB(Integer zDLB) {
        this.zDLB = zDLB;
    }
    @Column(name = "JBZG")
    public Integer getJBZG() {
        return jBZG;
    }
    public void setJBZG(Integer jBZG) {
        this.jBZG = jBZG;
    }
    @Column(name = "YSDM")
    public String getYSDM() {
        return ySDM;
    }
    public void setYSDM(String ySDM) {
        this.ySDM = ySDM;
    }
    @Column(name = "ZDSJ")
    public Date getZDSJ() {
        return zDSJ;
    }
    public void setZDSJ(Date zDSJ) {
        this.zDSJ = zDSJ;
    }
    @Column(name = "ZFPB")
    public Integer getZFPB() {
        return zFPB;
    }
    public void setZFPB(Integer zFPB) {
        this.zFPB = zFPB;
    }
    @Column(name = "ICD")
    public String getICD() {
        return iCD;
    }
    public void setICD(String iCD) {
        this.iCD = iCD;
    }
    @Column(name = "MSZD")
    public String getMSZD() {
        return mSZD;
    }
    public void setMSZD(String mSZD) {
        this.mSZD = mSZD;
    }
    @Column(name = "ZZBJ")
    public Integer getZZBJ() {
        return zZBJ;
    }
    public void setZZBJ(Integer zZBJ) {
        this.zZBJ = zZBJ;
    }
    @Column(name = "QZBZ")
    public Integer getQZBZ() {
        return qZBZ;
    }
    public void setQZBZ(Integer qZBZ) {
        this.qZBZ = qZBZ;
    }
    @Column(name = "BZXX")
    public String getBZXX() {
        return bZXX;
    }
    public void setBZXX(String bZXX) {
        this.bZXX = bZXX;
    }
    @Column(name = "QZSJ")
    public Date getQZSJ() {
        return qZSJ;
    }
    public void setQZSJ(Date qZSJ) {
        this.qZSJ = qZSJ;
    }
    @Column(name = "ZXLB")
    public Integer getZXLB() {
        return zXLB;
    }
    public void setZXLB(Integer zXLB) {
        this.zXLB = zXLB;
    }
    @Column(name = "ZNXH")
    public Integer getZNXH() {
        return zNXH;
    }
    public void setZNXH(Integer zNXH) {
        this.zNXH = zNXH;
    }
    @Column(name = "JBMC")
    public String getJBMC() {
        return jBMC;
    }
    public void setJBMC(String jBMC) {
        this.jBMC = jBMC;
    }
    @Column(name = "FJBS")
    public Integer getFJBS() {
        return fJBS;
    }
    public void setFJBS(Integer fJBS) {
        this.fJBS = fJBS;
    }
    @Column(name = "TJBZ")
    public Integer getTJBZ() {
        return tJBZ;
    }
    public void setTJBZ(Integer tJBZ) {
        this.tJBZ = tJBZ;
    }
    @Column(name = "BKZT")
    public Integer getBKZT() {
        return bKZT;
    }
    public void setBKZT(Integer bKZT) {
        this.bKZT = bKZT;
    }
    @Column(name = "DYBZ")
    public Integer getDYBZ() {
        return dYBZ;
    }
    public void setDYBZ(Integer dYBZ) {
        this.dYBZ = dYBZ;
    }
    @Column(name = "ZDLX")
    public Integer getZDLX() {
        return zDLX;
    }
    public void setZDLX(Integer zDLX) {
        this.zDLX = zDLX;
    }
    @Column(name = "ZDXH")
    public Integer getZDXH() {
        return zDXH;
    }
    public void setZDXH(Integer zDXH) {
        this.zDXH = zDXH;
    }
    @Column(name = "JBZH")
    public String getJBZH() {
        return jBZH;
    }
    public void setJBZH(String jBZH) {
        this.jBZH = jBZH;
    }
    @Column(name = "FJMC")
    public String getFJMC() {
        return fJMC;
    }
    public void setFJMC(String fJMC) {
        this.fJMC = fJMC;
    }
    @Column(name = "YWBS")
    public String getYWBS() {
        return yWBS;
    }
    public void setYWBS(String yWBS) {
        this.yWBS = yWBS;
    }
    @Column(name = "ZFYS")
    public String getZFYS() {
        return zFYS;
    }
    public void setZFYS(String zFYS) {
        this.zFYS = zFYS;
    }
    @Column(name = "ZFSJ")
    public Date getZFSJ() {
        return zFSJ;
    }
    public void setZFSJ(Date zFSJ) {
        this.zFSJ = zFSJ;
    }
    @Column(name = "ZJFLAG")
    public Integer getZJFLAG() {
        return zJFLAG;
    }
    public void setZJFLAG(Integer zJFLAG) {
        this.zJFLAG = zJFLAG;
    }
}

+ 258 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwYsMzJzLsDO.java

@ -0,0 +1,258 @@
package com.yihu.jw.entity.hospital.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.util.Date;
/**
 * 就诊历史表
 *
 * */
@Entity
@Table(name = "v_hlwys_mz_jzls")
public class HlwYsMzJzLsDO {
    private Integer jZXH;//NUMBER(18)N
    private Integer gHXH;//NUMBER(18)N
    private Integer bRBH;//NUMBER(18)N病人ID号
    private Integer kSDM;//NUMBER(4)N科室代码
    private String  ySDM;//VARCHAR2(10)N医生代码
    private Integer zYZD;//NUMBER(18)YV_HLW_ICD10.FLAG
    private Date kSSJ;//DATEN就诊开始时间
    private Date jSSJ;//DATEY就诊结束时间
    private Integer jZZT;//NUMBER(1)N就诊状态 (9结束)
    private Integer yYXH;//NUMBER(18)Y
    private Date fZRQ;//DATEY
    private Integer gHFZ;//NUMBER(1)Y
    private Integer jZLX;//NUMBER(2)Y就诊类型 (3)
    private String pBZXM;//VARCHAR2(30)Y
    private Integer pBZGX;//NUMBER(4)Y
    private String pBZDH;//VARCHAR2(20)Y
    private String pBZDZ;//VARCHAR2(50)Y
    private String pBZDW;//VARCHAR2(50)Y
    private String zDMC;//VARCHAR2(100)Y诊断名称
    private Integer cZPB;//NUMBER(1)Y
    private String mQZD;//VARCHAR2(255)Y诊断名称
    private Integer yYID;//NUMBER(1)Y医院ID:0表示本院,1表示外院
    private Integer zJFLAG;//NUMBER(1)Y0传输标记
    private Integer wLYY;//NUMBER(1)Y00表示HIS,1表示网络预约未到,2表示网络预约已到医院就诊
    @Id
    @Column(name = "JZXH")
    public Integer getJZXH() {
        return jZXH;
    }
    public void setJZXH(Integer jZXH) {
        this.jZXH = jZXH;
    }
    @Column(name = "GHXH")
    public Integer getGHXH() {
        return gHXH;
    }
    public void setGHXH(Integer gHXH) {
        this.gHXH = gHXH;
    }
    @Column(name = "BRBH")
    public Integer getBRBH() {
        return bRBH;
    }
    public void setBRBH(Integer bRBH) {
        this.bRBH = bRBH;
    }
    @Column(name = "KSDM")
    public Integer getKSDM() {
        return kSDM;
    }
    public void setKSDM(Integer kSDM) {
        this.kSDM = kSDM;
    }
    @Column(name = "YSDM")
    public String getYSDM() {
        return ySDM;
    }
    public void setYSDM(String ySDM) {
        this.ySDM = ySDM;
    }
    @Column(name = "ZYZD")
    public Integer getZYZD() {
        return zYZD;
    }
    public void setZYZD(Integer zYZD) {
        this.zYZD = zYZD;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "KSSJ")
    public Date getKSSJ() {
        return kSSJ;
    }
    public void setKSSJ(Date kSSJ) {
        this.kSSJ = kSSJ;
    }
    @Column(name = "JSSJ")
    public Date getJSSJ() {
        return jSSJ;
    }
    public void setJSSJ(Date jSSJ) {
        this.jSSJ = jSSJ;
    }
    @Column(name = "JZZT")
    public Integer getJZZT() {
        return jZZT;
    }
    public void setJZZT(Integer jZZT) {
        this.jZZT = jZZT;
    }
    @Column(name = "YYXH")
    public Integer getYYXH() {
        return yYXH;
    }
    public void setYYXH(Integer yYXH) {
        this.yYXH = yYXH;
    }
    @Column(name = "FZRQ")
    public Date getFZRQ() {
        return fZRQ;
    }
    public void setFZRQ(Date fZRQ) {
        this.fZRQ = fZRQ;
    }
    @Column(name = "GHFZ")
    public Integer getGHFZ() {
        return gHFZ;
    }
    public void setGHFZ(Integer gHFZ) {
        this.gHFZ = gHFZ;
    }
    @Column(name = "JZLX")
    public Integer getJZLX() {
        return jZLX;
    }
    public void setJZLX(Integer jZLX) {
        this.jZLX = jZLX;
    }
    @Column(name = "PBZXM")
    public String getPBZXM() {
        return pBZXM;
    }
    public void setPBZXM(String pBZXM) {
        this.pBZXM = pBZXM;
    }
    @Column(name = "PBZGX")
    public Integer getPBZGX() {
        return pBZGX;
    }
    public void setPBZGX(Integer pBZGX) {
        this.pBZGX = pBZGX;
    }
    @Column(name = "PBZDH")
    public String getPBZDH() {
        return pBZDH;
    }
    public void setPBZDH(String pBZDH) {
        this.pBZDH = pBZDH;
    }
    @Column(name = "PBZDZ")
    public String getPBZDZ() {
        return pBZDZ;
    }
    public void setPBZDZ(String pBZDZ) {
        this.pBZDZ = pBZDZ;
    }
    @Column(name = "PBZDW")
    public String getPBZDW() {
        return pBZDW;
    }
    public void setPBZDW(String pBZDW) {
        this.pBZDW = pBZDW;
    }
    @Column(name = "ZDMC")
    public String getZDMC() {
        return zDMC;
    }
    public void setZDMC(String zDMC) {
        this.zDMC = zDMC;
    }
    @Column(name = "CZPB")
    public Integer getCZPB() {
        return cZPB;
    }
    public void setCZPB(Integer cZPB) {
        this.cZPB = cZPB;
    }
    @Column(name = "MQZD")
    public String getMQZD() {
        return mQZD;
    }
    public void setMQZD(String mQZD) {
        this.mQZD = mQZD;
    }
    @Column(name = "YYID")
    public Integer getYYID() {
        return yYID;
    }
    public void setYYID(Integer yYID) {
        this.yYID = yYID;
    }
    @Column(name = "ZJFLAG")
    public Integer getZJFLAG() {
        return zJFLAG;
    }
    public void setZJFLAG(Integer zJFLAG) {
        this.zJFLAG = zJFLAG;
    }
    @Column(name = "WLYY")
    public Integer getWLYY() {
        return wLYY;
    }
    public void setWLYY(Integer wLYY) {
        this.wLYY = wLYY;
    }
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceDO.java

@ -81,6 +81,8 @@ public class IotDeviceDO extends UuidIdentityEntityWithOperator implements Seria
    @Column(name = "del")
    private Integer del;//删除标志(1有效,0删除)
    @Column(name = "is_grant")
    private Integer isGrant;//是否发放(0否1是)
    @Column(name = "category_code")
    private String categoryCode;//设备类型标识
@ -346,4 +348,12 @@ public class IotDeviceDO extends UuidIdentityEntityWithOperator implements Seria
    public void setInventoryLogId(String inventoryLogId) {
        this.inventoryLogId = inventoryLogId;
    }
    public Integer getIsGrant() {
        return isGrant;
    }
    public void setIsGrant(Integer isGrant) {
        this.isGrant = isGrant;
    }
}

+ 70 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceOverhaulDO.java

@ -0,0 +1,70 @@
package com.yihu.jw.entity.iot.device;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 设备调拨记录表
 *
 * @author humingfen on 2020.5.6.
 */
@Entity
@Table(name = "iot_device_overhaul")
public class IotDeviceOverhaulDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name = "saas_id")
    private String saasId;
    @Column(name = "patient_device_id")
    private String patientDeviceId;//居民设备表id
    @Column(name = "time")
    private String time;//计划检修时间
    @Column(name = "status")
    private Integer status;//检修状态(-1删除 0未检修 1已检修正常 2已检修回收)
    @Column(name = "remark")
    private String remark;//检修备注
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getPatientDeviceId() {
        return patientDeviceId;
    }
    public void setPatientDeviceId(String patientDeviceId) {
        this.patientDeviceId = patientDeviceId;
    }
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 36 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceQualityInspectionPlanDO.java

@ -59,7 +59,17 @@ public class IotDeviceQualityInspectionPlanDO extends UuidIdentityEntityWithOper
    private String status;//质检状态(1未检,2已检)
    @Column(name = "del")
    private Integer del;//删除标志
    private Integer del;//删除标志 1:有效  0:无效
    //新增字段
    @Column(name = "img")
    private String img;//质检图像
    @Column(name = "summary")
    private String summary;//质检小结
    @Column(name = "remind_time")
    private Date remindTime;//质检提醒时间
    public enum QualityPlanStatus {
        create("未完成", "1"),
@ -153,6 +163,31 @@ public class IotDeviceQualityInspectionPlanDO extends UuidIdentityEntityWithOper
//        this.deviceType = deviceType;
//    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    public String getSummary() {
        return summary;
    }
    public void setSummary(String summary) {
        this.summary = summary;
    }
    public Date getRemindTime() {
        return remindTime;
    }
    public void setRemindTime(Date remindTime) {
        this.remindTime = remindTime;
    }
    public Long getPurchaseNum() {
        return purchaseNum;
    }

+ 161 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceSimDO.java

@ -0,0 +1,161 @@
package com.yihu.jw.entity.iot.device;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/7
 */
@Entity
@Table(name = "iot_device_sim")
public class IotDeviceSimDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name = "saas_id")
    private String saasId;//
    @Column(name = "sim")
    private String sim;//'sim卡卡号'
    @Column(name = "advance_payment")
    private float advancePayment;//预缴金额
    @Column(name = "payment")
    private float payment;//套餐资费
    @Column(name = "remaining_balance")
    private float remainingBalance;//余额
    @Column(name = "status")
    private Integer status;//sim状态(-1 已停用 0欠费 1正常)',
    @Column(name = "contacts_name")
    private String contactsName;//
    @Column(name = "contacts_mobile")
    private String contactsMobile;//联系人手机号码
    //新增字段
    @Column(name = "remind_balance")
    private String remindBalance;//提醒金额
    @Column(name = "remind_time")
    private String remindTime;//每月的固定提醒日
    @Column(name = "remind_arrears")
    private String remindArrears;//欠费提醒  1:提醒  0:不提醒
    @Column(name = "device_name")
    private String deviceName;//设备名称
    @Column(name = "device_sn")
    private String deviceSn;//设备sn码
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getSim() {
        return sim;
    }
    public void setSim(String sim) {
        this.sim = sim;
    }
    public float getAdvancePayment() {
        return advancePayment;
    }
    public void setAdvancePayment(float advancePayment) {
        this.advancePayment = advancePayment;
    }
    public float getPayment() {
        return payment;
    }
    public void setPayment(float payment) {
        this.payment = payment;
    }
    public float getRemainingBalance() {
        return remainingBalance;
    }
    public void setRemainingBalance(float remainingBalance) {
        this.remainingBalance = remainingBalance;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getContactsName() {
        return contactsName;
    }
    public void setContactsName(String contactsName) {
        this.contactsName = contactsName;
    }
    public String getContactsMobile() {
        return contactsMobile;
    }
    public void setContactsMobile(String contactsMobile) {
        this.contactsMobile = contactsMobile;
    }
    public String getRemindBalance() {
        return remindBalance;
    }
    public void setRemindBalance(String remindBalance) {
        this.remindBalance = remindBalance;
    }
    public String getRemindTime() {
        return remindTime;
    }
    public void setRemindTime(String remindTime) {
        this.remindTime = remindTime;
    }
    public String getRemindArrears() {
        return remindArrears;
    }
    public void setRemindArrears(String remindArrears) {
        this.remindArrears = remindArrears;
    }
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
}

+ 40 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotPatientDeviceDO.java

@ -52,7 +52,14 @@ public class IotPatientDeviceDO extends UuidIdentityEntityWithOperator implement
    private String hospitalName;//归属社区名称
    @Column(name = "imgs")
    private String imgs;//领用协议,多个用逗号隔开
    @Column(name = "status")
    private Integer status;//维修状态(1待维护 2已报修 3厂家接收 4厂家寄回 5待更换 6已更换)
    @Column(name = "damage_description")
    private String damageDescription;//损坏说明
    @Column(name = "damage_images")
    private String damageImages;//申请维修附件图片,多个用逗号隔开
    @Column(name = "repair_description")
    private String repairDescription;//维修说明
    public String getSaasId() {
        return saasId;
@ -197,4 +204,36 @@ public class IotPatientDeviceDO extends UuidIdentityEntityWithOperator implement
    public void setImgs(String imgs) {
        this.imgs = imgs;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getDamageDescription() {
        return damageDescription;
    }
    public void setDamageDescription(String damageDescription) {
        this.damageDescription = damageDescription;
    }
    public String getDamageImages() {
        return damageImages;
    }
    public void setDamageImages(String damageImages) {
        this.damageImages = damageImages;
    }
    public String getRepairDescription() {
        return repairDescription;
    }
    public void setRepairDescription(String repairDescription) {
        this.repairDescription = repairDescription;
    }
}

+ 32 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotQualityRecordDO.java

@ -37,6 +37,14 @@ public class IotQualityRecordDO extends UuidIdentityEntityWithOperator implement
    @Column(name = "del")
    private Integer del;//删除标志
    //新增字段
    @Column(name = "img")
    private String img;//质检图像
    @Column(name = "summary")
    private String summary;//质检小结
    @Column(name = "remind_time")
    private Date remindTime;//质检提醒时间
    public String getSaasId() {
        return saasId;
    }
@ -116,4 +124,28 @@ public class IotQualityRecordDO extends UuidIdentityEntityWithOperator implement
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    public String getSummary() {
        return summary;
    }
    public void setSummary(String summary) {
        this.summary = summary;
    }
    public Date getRemindTime() {
        return remindTime;
    }
    public void setRemindTime(Date remindTime) {
        this.remindTime = remindTime;
    }
}

+ 80 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/message/IotMessageDO.java

@ -0,0 +1,80 @@
package com.yihu.jw.entity.iot.message;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * @author suhaiwen  消息列表
 * @vsrsion 1.0
 * Created at 2020/5/7
 */
@Entity
@Table(name = "iot_message")
public class IotMessageDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name = "title")
    private String title;//消息标题
    @Column(name = "content")
    private String content;//消息内容
    @Column(name = "type")
    private String type;//消息类型 1:SIM卡续费通知 2:库存预警提醒 3:定期检修提醒 4:设备质检提醒',
    @Column(name = "read")
    private String read;//消息状态,1:已读  0:未读',
    @Column(name = "del")
    private String del;//删除标志  1:删除  0:不删除',
    @Column(name = "relation_code")
    private String relationCode;//业务关联id
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getRead() {
        return read;
    }
    public void setRead(String read) {
        this.read = read;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public String getRelationCode() {
        return relationCode;
    }
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
}

+ 103 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotCompanyAppInterfaceDO.java

@ -0,0 +1,103 @@
package com.yihu.jw.entity.iot.platform;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/4/30
 */
@Entity
@Table(name = "iot_company_app_interface")
public class IotCompanyAppInterfaceDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name="company_id")
    private String companyId;//公司ID
    @Column(name="company_name")
    private String companyName;//公司名称
    @Column(name="app_id")
    private String appId;//应用ID
    @Column(name="app_name")
    private String  appName;//应用名称
    @Column(name = "share_interface_id")
    private String shareInterfaceId;//共享接口字典ID
    @Column(name = "validity_start_date")
    private Date validityStartDate;//接口有效期开始时间
    @Column(name = "validity_end_date")
    private Date validityEndDate;//接口有效期结束时间
    @Column(name = "del")
    private String del;//取消申请 1:取消  0:不取消'
    public IotCompanyAppInterfaceDO() {
    }
    public String getCompanyId() {
        return companyId;
    }
    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }
    public String getCompanyName() {
        return companyName;
    }
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getAppName() {
        return appName;
    }
    public void setAppName(String appName) {
        this.appName = appName;
    }
    public String getShareInterfaceId() {
        return shareInterfaceId;
    }
    public void setShareInterfaceId(String shareInterfaceId) {
        this.shareInterfaceId = shareInterfaceId;
    }
    public Date getValidityStartDate() {
        return validityStartDate;
    }
    public void setValidityStartDate(Date validityStartDate) {
        this.validityStartDate = validityStartDate;
    }
    public Date getValidityEndDate() {
        return validityEndDate;
    }
    public void setValidityEndDate(Date validityEndDate) {
        this.validityEndDate = validityEndDate;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

+ 150 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotInterfaceAuditDO.java

@ -0,0 +1,150 @@
package com.yihu.jw.entity.iot.platform;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
@Entity
@Table(name = "iot_interface_audit")
public class IotInterfaceAuditDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name="company_id")
    private String companyId;//公司ID
    @Column(name="company_name")
    private String companyName;//公司名称
    @Column(name="app_id")
    private String appId;//应用ID
    @Column(name="app_name")
    private String  appName;//应用名称
    @Column(name="name")
    private String name;//审核人姓名
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name="time")
    private Date time;//申请时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name="audit_time")
    private Date auditTime;//审核时间
    @Column(name="status")
    private String status;//审核转态:  2:待审核  1:通过审核  0:拒绝审核
    @Column(name="remark")
    private String remark;//备注
    @Column(name="refuse_explain")
    private String refuseExplain;//拒绝说明
    @Transient
    private String contactsName;//联系人姓名
    @Transient
    private String contactsMobile;//联系人手机号码
    public String getCompanyId() {
        return companyId;
    }
    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }
    public String getCompanyName() {
        return companyName;
    }
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getAppName() {
        return appName;
    }
    public void setAppName(String appName) {
        this.appName = appName;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Date getTime() {
        return time;
    }
    public void setTime(Date time) {
        this.time = time;
    }
    public Date getAuditTime() {
        return auditTime;
    }
    public void setAuditTime(Date auditTime) {
        this.auditTime = auditTime;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getRefuseExplain() {
        return refuseExplain;
    }
    public void setRefuseExplain(String refuseExplain) {
        this.refuseExplain = refuseExplain;
    }
    @Transient
    public String getContactsName() {
        return contactsName;
    }
    public void setContactsName(String contactsName) {
        this.contactsName = contactsName;
    }
    @Transient
    public String getContactsMobile() {
        return contactsMobile;
    }
    public void setContactsMobile(String contactsMobile) {
        this.contactsMobile = contactsMobile;
    }
}

+ 85 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotInterfaceAuditDetailDO.java

@ -0,0 +1,85 @@
package com.yihu.jw.entity.iot.platform;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
@Entity
@Table(name = "iot_interface_audit_detail")
public class IotInterfaceAuditDetailDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name = "interface_id")
    private String interfaceId;//接口审核ID
    @Column(name = "share_interface_id")
    private String shareInterfaceId;//共享接口字典ID
    @Column(name = "method_name")
    private String methodName;//方法名
    @Column(name = "interface_name")
    private String interfaceName;//接口名称
    @Column(name = "type_name")
    private String typeName;//业务类型名称
    @Column(name = "explanation")
    private String explanation;//说明
    public String getInterfaceId() {
        return interfaceId;
    }
    public void setInterfaceId(String interfaceId) {
        this.interfaceId = interfaceId;
    }
    public String getShareInterfaceId() {
        return shareInterfaceId;
    }
    public void setShareInterfaceId(String shareInterfaceId) {
        this.shareInterfaceId = shareInterfaceId;
    }
    public String getMethodName() {
        return methodName;
    }
    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }
    public String getInterfaceName() {
        return interfaceName;
    }
    public void setInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
    }
    public String getTypeName() {
        return typeName;
    }
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
    public String getExplanation() {
        return explanation;
    }
    public void setExplanation(String explanation) {
        this.explanation = explanation;
    }
}

+ 20 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java

@ -43,6 +43,8 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    private Date updateTime;
    private String updateUser;
    private String updateUserName;
    private String ykOrderNo;
    private String ykOrderId;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
@ -256,4 +258,22 @@ public class BusinessOrderDO extends IntegerIdentityEntity {
    public void setRematk(String rematk) {
        this.rematk = rematk;
    }
    @Column(name = "yk_order_no")
    public String getYkOrderNo() {
        return ykOrderNo;
    }
    public void setYkOrderNo(String ykOrderNo) {
        this.ykOrderNo = ykOrderNo;
    }
    @Column(name = "yk_order_id")
    public String getYkOrderId() {
        return ykOrderId;
    }
    public void setYkOrderId(String ykOrderId) {
        this.ykOrderId = ykOrderId;
    }
}

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

@ -25,6 +25,8 @@ public class IotRequestMapping {
        public static final String platform = api_iot_common + "/platform";
        public static final String workType = api_iot_common + "/workType";
        public static final String hospital = api_iot_common + "/hospital";
        public static final String interfaceAudit = api_iot_common + "/interfaceAudit";
        public static final String sim = api_iot_common + "/sim";
        public static final String message_success_update = "update success";
@ -143,6 +145,18 @@ public class IotRequestMapping {
        public static final String updateLocation= "updateLocation";
        public static final String createPatientDevice = "createPatientDevice";
        //设备维修
        public static final String createRepairDevice = "createRepairDevice";
        public static final String getRepairDeviceList = "getRepairDeviceList";
        public static final String getDeviceInfoByDeviceSn = "getDeviceInfoByDeviceSn";
        public static final String deleteRepairDevice = "deleteRepairDevice";
        //设备检修
        public static final String getOverhaulDeviceList = "getOverhaulDeviceList";
        public static final String getOverhaulListByPatientDeviceId = "getOverhaulListByPatientDeviceId";
        public static final String delOverhaulByPatientDeviceId = "delOverhaulByPatientDeviceId";
        public static final String updateOverhaulStatusById = "updateOverhaulStatusById";
    }
@ -206,6 +220,21 @@ public class IotRequestMapping {
        public static final String message_success_updateInventory = "device inventory update success";
    }
    /**
     * SIM卡模块常量
     */
    public static class DeviceSim{
        public static final String addSIM = "addSIM";
        public static final String editSIM = "editSIM";
        public static final String conditionQueryPage = "conditionQueryPage";
        public static final String findAllSim = "findAllSim";
        public static final String remind = "remind";
        public static final String message_success_add = "sim add success";
        public static final String message_success_edit = "sim edit success";
        public static final String message_success_remind = "sim remind success";
        public static final String message_success_find= " sim find success";
    }
    /**
     * 设备订单模块常量
     */
@ -250,6 +279,7 @@ public class IotRequestMapping {
        public static final String completePlanByPurchaseId = "completePlanByPurchaseId";
        public static final String queryQualityPlanPage = "queryQualityPlanPage";
        public static final String findById = "findById";
        public static final String remindTimePlan = "remindTimePlan";
    }
@ -314,13 +344,39 @@ public class IotRequestMapping {
        public static final String conditionQueryPage ="conditionQueryPage";
        public static final String delete ="delete";
        public static final String dataConsumption ="dataConsumption";
        public static final String findCompanyById ="findCompanyById";
        public static final String editCompanyById ="editCompanyById";
        public static final String delCompanyById ="delCompanyById";
        public static final String allotInterface ="allotInterface";
        public static final String findAppInterface ="findAppInterface";
        public static final String message_success_add = "add success";
        public static final String message_success_edit = "edit success";
        public static final String message_success_find = "find success";
        public static final String message_success_delete = "delete success";
    }
    /**
     * 接口申请与审核信息模块
     */
    public static class  InterfaceAudit{
        public static final String addInterfaceApplyFor ="addInterfaceApplyFor";
        public static final String findInterfaceApplyFor ="findInterfaceApplyFor";
        public static final String findAllApplyFor ="findAllApplyFor";
        public static final String auditPass ="auditPass";
        public static final String auditNoPass ="auditNoPass";
        public static final String conditionQueryPage ="conditionQueryPage";
        public static final String message_success_apply_for = "apply for success";
        public static final String message_success_find = "find  success";
        public static final String message_success_audit = "audit  success";
    }
    /**
     * 业务类型信息模块常量
     */
@ -329,6 +385,7 @@ public class IotRequestMapping {
        public static final  String editType="editType";
        public static final  String deleteType="deleteType";
        public static final  String findType="findType";
        public static final  String findAll="findAll";
        public static final String message_success_add = "workType add success";
        public static final String message_success_edit = "workType edit success";

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

@ -19,6 +19,7 @@ import java.util.List;
@ApiModel(value = "设备表", description = "设备表")
public class IotDeviceVO extends BaseVO implements Serializable {
    @ApiModelProperty("产品id")
    private String productId;
    @ApiModelProperty("设备名称")
@ -74,7 +75,6 @@ public class IotDeviceVO extends BaseVO implements Serializable {
    private String categoryCode;//设备类型标识
    @ApiModelProperty("设备类型名称")
    private String categoryName;//设备类型名称
    public String getName() {
        return name;
    }

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

@ -21,6 +21,8 @@ public class IotPatientDeviceVO extends BaseVO implements Serializable {
    private String patientName;
    @ApiModelProperty("居民身份证")
    private String idcard;
    @ApiModelProperty("居民联系方式")
    private String mobile;
    @ApiModelProperty("设备id")
    private String deviceId;
    @ApiModelProperty("设备名称")
@ -35,12 +37,31 @@ public class IotPatientDeviceVO extends BaseVO implements Serializable {
    private String userType;
    @ApiModelProperty("设备类型标识(1血压计,2血糖仪)")
    private String categoryCode;
    @ApiModelProperty("设备类型名称")
    private String categoryName;
    @ApiModelProperty("地址")
    private String address;
    @ApiModelProperty("社区")
    private String hospitalName;
    @ApiModelProperty("病情:0绿标,1黄标,2红标")
    private Integer diseaseCondition;
    @ApiModelProperty("厂商code")
    private String manufacturerId;
    @ApiModelProperty("厂商名称")
    private String manufacturerName;
    @ApiModelProperty("联系人姓名")
    private String contactsName;
    @ApiModelProperty("联系人手机号码")
    private String contactsMobile;
    @ApiModelProperty("维修状态(1待维护 2已报修 3厂家接收 4厂家寄回 5待更换 6已更换)")
    private Integer status;//维修状态(1待维护 2已报修 3厂家接收 4厂家寄回 5待更换 6已更换)
    @ApiModelProperty("损坏说明")
    private String damageDescription;//损坏说明
    @ApiModelProperty("申请维修附件图片,多个用逗号隔开")
    private String damageImages;//申请维修附件图片,多个用逗号隔开
    @ApiModelProperty("维修说明")
    private String repairDescription;//维修说明
    public String getPatient() {
        return patient;
@ -145,4 +166,84 @@ public class IotPatientDeviceVO extends BaseVO implements Serializable {
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getCategoryName() {
        return categoryName;
    }
    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }
    public String getManufacturerId() {
        return manufacturerId;
    }
    public void setManufacturerId(String manufacturerId) {
        this.manufacturerId = manufacturerId;
    }
    public String getManufacturerName() {
        return manufacturerName;
    }
    public void setManufacturerName(String manufacturerName) {
        this.manufacturerName = manufacturerName;
    }
    public String getContactsName() {
        return contactsName;
    }
    public void setContactsName(String contactsName) {
        this.contactsName = contactsName;
    }
    public String getContactsMobile() {
        return contactsMobile;
    }
    public void setContactsMobile(String contactsMobile) {
        this.contactsMobile = contactsMobile;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getDamageDescription() {
        return damageDescription;
    }
    public void setDamageDescription(String damageDescription) {
        this.damageDescription = damageDescription;
    }
    public String getDamageImages() {
        return damageImages;
    }
    public void setDamageImages(String damageImages) {
        this.damageImages = damageImages;
    }
    public String getRepairDescription() {
        return repairDescription;
    }
    public void setRepairDescription(String repairDescription) {
        this.repairDescription = repairDescription;
    }
}

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

@ -0,0 +1,42 @@
package com.yihu.jw.restmodel.iot.platform;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam;
import java.io.Serializable;
/**
 * @author 应用接口集合信息
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "应用接口集合信息", description = "应用接口集合信息")
public class IotAppInterfacesVO  extends BaseVO implements Serializable {
    @ApiModelProperty("应用名称")
    private String appName;
    @ApiModelProperty("共享接口信息")
    private IotShareInterfaceDO iotShareInterfaceDO;
    public String getAppName() {
        return appName;
    }
    public void setAppName(String appName) {
        this.appName = appName;
    }
    public IotShareInterfaceDO getIotShareInterfaceDO() {
        return iotShareInterfaceDO;
    }
    public void setIotShareInterfaceDO(IotShareInterfaceDO iotShareInterfaceDO) {
        this.iotShareInterfaceDO = iotShareInterfaceDO;
    }
}

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

@ -0,0 +1,44 @@
package com.yihu.jw.restmodel.iot.platform;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDetailDO;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "应用接口申请信息", description = "应用接口申请信息")
public class IotInterfaceAuditVO extends BaseVO implements Serializable {
    @ApiModelProperty("接口审核信息")
    private IotInterfaceAuditDO iotInterfaceAuditDO;
    @ApiModelProperty("共享接口信息")
    private List<IotInterfaceAuditDetailDO> iotInterfaceAuditDetailDOList;
    public IotInterfaceAuditDO getIotInterfaceAuditDO() {
        return iotInterfaceAuditDO;
    }
    public void setIotInterfaceAuditDO(IotInterfaceAuditDO iotInterfaceAuditDO) {
        this.iotInterfaceAuditDO = iotInterfaceAuditDO;
    }
    public List<IotInterfaceAuditDetailDO> getIotInterfaceAuditDetailDOList() {
        return iotInterfaceAuditDetailDOList;
    }
    public void setIotInterfaceAuditDetailDOList(List<IotInterfaceAuditDetailDO> iotInterfaceAuditDetailDOList) {
        this.iotInterfaceAuditDetailDOList = iotInterfaceAuditDetailDOList;
    }
}

+ 7 - 0
common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java

@ -414,6 +414,13 @@ public class DateUtil {
        return dateToStrShort(c.getTime());
    }
    public static Date getNextDay1(Date d, int days) {
        Calendar c = Calendar.getInstance();
        c.setTime(d);
        c.add(Calendar.DATE, days);
        return c.getTime();
    }
    public static String getNextMonth(Date d, int months) {
        Calendar c = Calendar.getInstance();
        c.setTime(d);

+ 144 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -134,6 +134,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    private YkyySMSService ykyySMSService;
    @Autowired
    private RegisterService registerService;
    @Autowired
    private YkyyService ykyyService;
    @PostConstruct
    private void init() {
@ -1259,7 +1261,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        try {
            Map<String,Object> rs = registerService.registerPatient(name,mobile,idcard,ssc,pw,openid,wxId);
            Map<String,Object> rs = registerService.registerPatient(name,mobile,idcard,ssc,pw,openid,wxId,captcha);
            String code = rs.get("code").toString();
            if(!"1".equals(code)){
                ObjEnvelop objEnvelop = new ObjEnvelop();
@ -1360,4 +1362,145 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    }
    /**
     * 眼科通登陆
     *
     * @param parameters  不定入参:
     *                    client_id 应用标识
     *                    captcha 验证码
     *                    password 密码
     *                    username 用户名/手机/身份证号
     *                    key 图形验证码键值
     *                    text 用户输入的图形验证码
     *                    login_type 用户类型 1或默认为user,2:医生登录,3:患者登录,4:第三方同步账号登录,5.易联众居民健康卡授权登录
     * @param httpSession
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/oauth/ykLogin", method = RequestMethod.POST)
    public ResponseEntity<Oauth2Envelop<WlyyUserSimple>> ykLogin(@RequestParam Map<String, String> parameters, HttpSession httpSession) throws Exception {
        //图形验证码验证
        String key = parameters.get("key");
        String text = parameters.get("text");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
            if(!verifyCaptcha(key,text)){
                throw new ImgCaptchaException("img_captcha error");
            }
        }
        String username = parameters.get("username");
        if (StringUtils.isEmpty(username)) {
            throw new InvalidRequestException("username");
        }
        String client_id = parameters.get("client_id");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        String wechatId = parameters.get("wechatId");
        if (StringUtils.isEmpty(parameters.get("captcha"))) {
            parameters.put("grant_type", "ihealthCode");
            //解密密码
            if (parameters.get("password") != null) {
                KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
                String password = com.yihu.jw.security.utils.RSAUtils.decryptBase64(parameters.get("password"), keyPair);
                String response = ykyyService.yktLogin(parameters.get("username"),password);
                if (!StringUtils.isEmpty(response)){
                    JSONObject object = JSONObject.parseObject(response);
                    if (!object.getString("code").equalsIgnoreCase("200")){
                        throw new Exception(object.getString("msg"));
                    }
                }
                parameters.remove("password");
            } else {
                //第三方同步账号模式登录
                parameters.put("grant_type", "ihealthCode");
            }
        } else {
            parameters.put("grant_type", "captcha");
        }
        ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
        if (null == authenticatedClient) {
            throw new InvalidRequestException("client_id");
        }
        TokenRequest tokenRequest = oAuth2RequestFactory.createTokenRequest(parameters, authenticatedClient);
        oAuth2RequestValidator.validateScope(tokenRequest, authenticatedClient);
        OAuth2AccessToken token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
        if (token == null) {
            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
        }
        /*如果是移动端登陆则移除之前的token,
        在网关处通过HTTP状态码告知前端是过期(402)还是账号在别处登陆(403),
        实现同一账号只能在一处登陆*/
//        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
//        if (request.getHeader("login-device") != null && request.getHeader("login-device").equals("mobile")) {
//            tokenStore.removeAccessToken(token.getValue());
//            tokenStore.removeRefreshToken(token.getRefreshToken().getValue());
//            token = getTokenGranter().grant(tokenRequest.getGrantType(), tokenRequest);
//        }
//        if (token == null) {
//            throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
//        }
        WlyyUserSimple wlyyUserSimple = userDetailsService.authSuccess(parameters.get("username"));
        wlyyUserSimple.setAccessToken(token.getValue());
        wlyyUserSimple.setTokenType(token.getTokenType());
        wlyyUserSimple.setExpiresIn(token.getExpiresIn());
        wlyyUserSimple.setRefreshToken(token.getRefreshToken().getValue());
        wlyyUserSimple.setUser(parameters.get("username"));
        wlyyUserSimple.setState(parameters.get("state"));
        String loginType = parameters.get("login_type");
        String openid = parameters.get("openid");
        //更新患者openId
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
        if (!StringUtils.isEmpty(openid) && !"undefined".equalsIgnoreCase(openid) && "3".equals(loginType)) {
            baseLoginLogDO.setOpenid(openid);
            userDetailsService.updateOpenId(openid, wlyyUserSimple.getId());
            if (!StringUtils.isEmpty(wechatId)&& !"undefined".equalsIgnoreCase(wechatId)){
                userDetailsService.updateOpenIdAndWechatId(openid,wlyyUserSimple.getId(),wechatId);
            }
        }
        if (parameters.get("password") != null) {
            //使用密码登录成功后, 更新失败次数为 0
            userDetailsService.addFailureCount(username, 0);
        }
        userDetailsService.setRolePhth(loginType, token, wlyyUserSimple.getId(), redisTemplate);
        baseLoginLogDO.setUserId(wlyyUserSimple.getId());
        baseLoginLogDO.setCreateTime(new Date());
        String userAgent = JSONObject.toJSONString(wlyyUserSimple);
        baseLoginLogDO.setUserAgent(userAgent);
        baseLoginLogDO.setLoginType(loginType);
        baseLoginLogService.save(baseLoginLogDO);
        return getResponse(wlyyUserSimple);
    }
    @RequestMapping(value = "/oauth/findYktPatientPw", method = RequestMethod.POST)
    public Envelop findYktPatientPw(String mobile,String client_id,String login_type,String captcha,String pw)throws Exception {
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
            //验证码正确
        } else {
            return ObjEnvelop.getError("验证码错误!");
        }
        String response = ykyyService.forgetPassword(mobile,pw,captcha);
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(response)){
            JSONObject object = JSONObject.parseObject(response);
            if (object.getString("code").equalsIgnoreCase("10000")){
                return ObjEnvelop.getSuccess("修改成功!");
            }else {
                return ObjEnvelop.getSuccess("修改失败!");
            }
        }
        String rs = registerService.updatePatientPw(pw,mobile);
        if("ok".equals(rs)){
            return ObjEnvelop.getSuccess("修改成功!");
        }
        return ObjEnvelop.getError("手机号未注册!");
    }
}

+ 7 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/service/RegisterService.java

@ -41,7 +41,10 @@ public class RegisterService {
    @Autowired
    private StringRedisTemplate redisTemplate;
    public Map<String,Object> registerPatient(String name, String mobile, String idcard, String ssc, String pw,String openid,String wxId)throws Exception{
    @Autowired
    private YkyyService ykyyService;
    public Map<String,Object> registerPatient(String name, String mobile, String idcard, String ssc, String pw,String openid,String wxId,String captcha)throws Exception{
        Map<String,Object> rs = new HashedMap();
        try{
@ -94,6 +97,9 @@ public class RegisterService {
                wechatDo.setPatientId(temp.getId());
                basePatientWechatDao.save(wechatDo);
            }
            if (org.apache.commons.lang3.StringUtils.isNoneBlank(wxId)&&wxId.equalsIgnoreCase("xm_ykyy_wx")){
                ykyyService.registerYkt(temp.getId(),pw,captcha);
            }
            rs.put("code","1");
            rs.put("mes","ok");

+ 250 - 2
server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java

@ -1,9 +1,18 @@
package com.yihu.jw.security.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.utils.security.MD5;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -16,10 +25,17 @@ import org.springframework.stereotype.Service;
@Service
public class YkyyService {
    private Logger logger = LoggerFactory.getLogger(YkyyService.class);
    @Autowired
    private HttpClientUtil httpClientUtil;
    private static String yktUrl = "http://www.yanketong.com:90/";
    private static String yktUrl1 = "http://www.yanketong.com:90/";
    @Autowired
    private BasePatientDao patientDao;
    private static String yktUrl = "http://www.yanketong.com:133/api/";
    /**
     * 眼科医院单点登录接口
@ -27,7 +43,239 @@ public class YkyyService {
     */
    public String getDoctorInfoByVerifycode(String verifyCode){
        String url = "api/Doctor/GetDoctorInfoByverifycode";
        return httpClientUtil.get(yktUrl+url+"?verifyCode="+verifyCode,"GBK");
        return httpClientUtil.get(yktUrl1+url+"?verifyCode="+verifyCode,"GBK");
    }
    /**
     *获取家庭成员信息
     *
     * @param tel
     * @param userId
     * @return
     */
    public String getFamilyList(String tel,String userId){
        String response="";
        String url = yktUrl+"doc_jkzl/get_family_list?";
        if (StringUtils.isNoneBlank(tel)&&StringUtils.isNoneBlank(userId)){
            url+="tel="+tel;
            url+="&user_id="+userId;
        }else if (StringUtils.isNoneBlank(tel)&&!StringUtils.isNoneBlank(userId)){
            url+="tel="+tel;
        }else if (!StringUtils.isNoneBlank(tel)&&StringUtils.isNoneBlank(userId)){
            url+="user_id="+userId;
        }
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取家庭成员信息:"+response);
        return response;
    }
    /**
     * 眼科通登录接口
     * @param tel
     * @param password
     * @return
     */
    public String yktLogin(String tel,String password){
        String response="";
        String url = yktUrl+"user_center/patient_login?patient_account="+tel+"&patient_pwd="+password;
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取眼科通登录信息:"+response);
        return response;
    }
    /**
     * 眼科通验证码
     * @param type
     * @param phone
     * @return
     */
    public String getShortMessage(String type,String phone){
        String response="";
        String url = yktUrl+"verification_code/short_message?type="+type+"&telephone="+phone;
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通验证码:"+response);
        return response;
    }
    /**
     * 增加家庭成员
     * @param userId
     * @param idcard
     * @param name
     * @param sex
     * @param birth
     * @param age
     * @param tel
     * @return
     */
    public String addFamily(String userId,String idcard,String name,String sex,String birth,String age,String tel){
        String response="";
        String url = yktUrl+"doc_jkzl/add_family?ass_user_id="+userId+"&id_card="+idcard+"&name="+name+"&sex="+sex
                +"&birth="+birth+"&age="+age+"&tel="+tel+"&medical_card=&illness=本人&clinic_id=";
        response = httpClientUtil.get(url,"GBK");
        logger.info("增加家庭成员:"+response);
        return response;
    }
    /**获取眼科通忘记密码信息
     *
     * @param tel
     * @param password
     * @param vercode
     * @return
     */
    public String forgetPassword(String tel,String password,String vercode){
        String response="";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("loginid",tel);
        jsonObject.put("password",password);
        String url = "http://www.yanketong.com:90/api/Patient/ForgotPassword4Jkzl";
        response = httpClientUtil.sendPost(url,jsonObject.toJSONString());
        logger.info("获取眼科通忘记密码信息:"+response);
        return response;
    }
    /**
     * telephone=15578008051&patient_pwd=123456&code=513970&invite_code=a01522&equipment_type=ios&equipment_guid=12312321
     * 眼科通用户注册
     *
     * @param telephone
     * @param patientPwd
     * @param code
     * @return
     */
    public String getRegisterUser(String telephone,String patientPwd,String code,String inviteCode,String equipmentType,String equipmentGuid){
        String response="";
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&code="+code+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
                "&equipment_guid="+equipmentGuid;
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通用户注册:"+response);
        return response;
    }
    /**
     * 同步眼科通数据
     * @param patient
     * @return
     * @throws Exception
     */
    public void registerYkt(String patient,String pw,String code) throws Exception {
        BasePatientDO basePatientDO  = patientDao.findById(patient);
        if (basePatientDO!=null){
            String userId = basePatientDO.getUserId();
            if (StringUtils.isNoneBlank(userId)){
                String familyList =getFamilyList(null,userId);
                JSONObject object = JSONObject.parseObject(familyList);
                if (object.getString("code").equalsIgnoreCase("200")){
                    JSONObject object1 = object.getJSONObject("data");
                    JSONArray array = object1.getJSONArray("list");
                    if (array!=null&&array.size()!=0){
                        JSONObject jsonObject = array.getJSONObject(0);
                        if (jsonObject!=null){
                            String yktId = jsonObject.getString("ID");
                            basePatientDO.setYktId(yktId);
                            patientDao.save(basePatientDO);
                        }
                    }else {
                        String birdth = IdCardUtil.getBirthdayForIdcardStr(basePatientDO.getIdcard());
                        Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
                        Integer sex = basePatientDO.getSex()!=null?basePatientDO.getSex():0;
                        String family = addFamily(userId,basePatientDO.getIdcard(),basePatientDO.getName(),sex.toString(),birdth,age.toString(),basePatientDO.getMobile());
                        JSONObject object2 = JSONObject.parseObject(family);
                        if (object2.getString("code").equalsIgnoreCase("200")){
                            JSONObject object3 = object2.getJSONObject("data");
                            String yktId = object3.getString("ID");
                            basePatientDO.setYktId(yktId);
                            patientDao.save(basePatientDO);
                        }
                    }
                }else {
                    throw new Exception("查询家庭成员失败!");
                }
            }else {
                String r =getRegisterUser(basePatientDO.getMobile(),pw,code,"a01522","xmijk","xmijk");
                JSONObject object4 = JSONObject.parseObject(r);
                if (object4.getString("code").equalsIgnoreCase("200")){
                    JSONObject object5 = object4.getJSONObject("data");
                    if (object5!=null){
                        userId = object5.getString("ID");
                        basePatientDO.setUserId(userId);
                        patientDao.save(basePatientDO);
                        String familyList =getFamilyList(null,userId);
                        JSONObject object = JSONObject.parseObject(familyList);
                        if (object.getString("code").equalsIgnoreCase("200")){
                            JSONObject object1 = object.getJSONObject("data");
                            JSONArray array = object1.getJSONArray("list");
                            if (array!=null&&array.size()!=0){
                                JSONObject jsonObject1 = array.getJSONObject(0);
                                if (jsonObject1!=null){
                                    String yktId = jsonObject1.getString("ID");
                                    userId = jsonObject1.getString("ASSUSERID");
                                    basePatientDO.setYktId(yktId);
                                    basePatientDO.setUserId(userId);
                                    patientDao.save(basePatientDO);
                                }
                            }else {
                                String birdth = IdCardUtil.getBirthdayForIdcardStr(basePatientDO.getIdcard());
                                Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
                                Integer sex = basePatientDO.getSex()!=null?basePatientDO.getSex():0;
                                String family = addFamily(userId,basePatientDO.getIdcard(),basePatientDO.getName(),sex.toString(),birdth,age.toString(),basePatientDO.getMobile());
                                JSONObject object2 = JSONObject.parseObject(family);
                                if (object2.getString("code").equalsIgnoreCase("200")){
                                    JSONObject object3 = object2.getJSONObject("data");
                                    String yktId = object3.getString("ID");
                                    basePatientDO.setYktId(yktId);
                                    userId = object3.getString("ASSUSERID");
                                    basePatientDO.setUserId(userId);
                                    patientDao.save(basePatientDO);
                                }
                            }
                        }else {
                            throw new Exception("查询家庭成员失败!");
                        }
                    }
                }else {
                    String familyList =getFamilyList(basePatientDO.getMobile(),null);
                    JSONObject object = JSONObject.parseObject(familyList);
                    if (object.getString("code").equalsIgnoreCase("200")){
                        JSONObject object1 = object.getJSONObject("data");
                        JSONArray array = object1.getJSONArray("list");
                        if (array!=null&&array.size()!=0){
                            JSONObject jsonObject1 = array.getJSONObject(0);
                            if (jsonObject1!=null){
                                String yktId = jsonObject1.getString("ID");
                                userId = jsonObject1.getString("ASSUSERID");
                                basePatientDO.setYktId(yktId);
                                basePatientDO.setUserId(userId);
                                patientDao.save(basePatientDO);
                            }
                        }else {
                            userId=object1.getString("user_id");
                            String birdth = DateUtil.dateToStrShort(IdCardUtil.getBirthdayForIdcard(basePatientDO.getIdcard()));
                            Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
                            Integer sex = basePatientDO.getSex()!=null?basePatientDO.getSex():0;
                            String family = addFamily(userId,basePatientDO.getIdcard(),basePatientDO.getName(),sex.toString(),birdth,age.toString(),basePatientDO.getMobile());
                            JSONObject object2 = JSONObject.parseObject(family);
                            if (object2.getString("code").equalsIgnoreCase("200")){
                                JSONObject object3 = object2.getJSONObject("data");
                                String yktId = object3.getString("ID");
                                basePatientDO.setYktId(yktId);
                                userId = object3.getString("ASSUSERID");
                                basePatientDO.setUserId(userId);
                                patientDao.save(basePatientDO);
                            }
                        }
                    }else {
                        throw new Exception("查询家庭成员失败!");
                    }
                }
            }
        }
    }
}

+ 12 - 0
server/svr-authentication/src/main/resources/application.yml

@ -64,6 +64,8 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyy/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
@ -87,6 +89,8 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyy/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
@ -122,6 +126,8 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyy/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
@ -171,6 +177,8 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://192.0.33.26:22122
wlyy:
  url: http://www.xmtyw.cn/wlyy/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
@ -195,6 +203,8 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.16.100.240:22122
wlyy:
  url: http://www.xmtyw.cn/wlyy/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 2
@ -219,6 +229,8 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://192.168.103.159:22122
wlyy:
  url: http://www.xmtyw.cn/wlyy/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 1

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

@ -4,8 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.prescription.HlwCf01DO;
import com.yihu.jw.entity.hospital.prescription.HlwCf02DO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.im.service.ImService;
@ -152,6 +151,48 @@ public class YkyyController extends EnvelopRestEndpoint {
            envelop.setObj(object1);
            hlwCf02VO.setSBXH(sbxh.intValue());
            ykyyEntranceService.save(hlwCf02VO);
        }else if(table.equalsIgnoreCase("HlwYsMzJbzdDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwYsMzJbzdDO hlwYsMzJbzdDO =  JSONObject.toJavaObject(object,HlwYsMzJbzdDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'YS_MZ_JBZD'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long jlbh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                jlbh = Long.parseLong(sbxhList.get(0).get("total").toString());
            }
            JSONObject object1 = new JSONObject();
            object1.put("jlbh",jlbh);
            envelop.setObj(object1);
            hlwYsMzJbzdDO.setJLBH(jlbh.intValue());
            ykyyEntranceService.save(hlwYsMzJbzdDO);
        }else if(table.equalsIgnoreCase("HlwGhmxDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwGhmxDO hlwGhmxDO =  JSONObject.toJavaObject(object,HlwGhmxDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_GHMX'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long sbxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
            }
            JSONObject object1 = new JSONObject();
            object1.put("sbxh",sbxh);
            envelop.setObj(object1);
            hlwGhmxDO.setSBXH(sbxh.intValue());
            ykyyEntranceService.save(hlwGhmxDO);
        }else if(table.equalsIgnoreCase("HlwYsMzJzLsDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwYsMzJzLsDO hlwYsMzJzLsDO =  JSONObject.toJavaObject(object,HlwYsMzJzLsDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'YS_MZ_JZLS'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long jzxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                jzxh = Long.parseLong(sbxhList.get(0).get("total").toString());
            }
            JSONObject object1 = new JSONObject();
            object1.put("jzxh",jzxh);
            envelop.setObj(object1);
            hlwYsMzJzLsDO.setJZXH(jzxh.intValue());
            ykyyEntranceService.save(hlwYsMzJzLsDO);
        }
        return envelop;

+ 6 - 28
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java

@ -1,10 +1,12 @@
package com.yihu.jw.hospital.endpoint.Xzyy;
import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -31,9 +33,9 @@ public class XzyyController extends EnvelopRestEndpoint {
     */
    @GetMapping(value = "/findPatientCard")
    @ApiOperation(value = "查询患者就诊卡", notes = "查询患者就诊卡")
    public ListEnvelop findPatientCard(@ApiParam(name = "idCard", value = "身份证号", required = false)
                                      @RequestParam(value = "idCard",required = false)String idCard)throws Exception{
        return success(xzzxEntranceService.selectPateintCard(idCard));
    public ListEnvelop findPatientCard(@ApiParam(name = "patient", value = "居民code", required = false)
                                      @RequestParam(value = "patient",required = false)String patient)throws Exception{
        return success(xzzxEntranceService.selectPateintCard(patient));
    }
@ -53,28 +55,6 @@ public class XzyyController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 挂号
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/registerOutPatient")
    @ApiOperation(value = "挂号", notes = "挂号")
    public ObjEnvelop registerOutPatient(@ApiParam(name = "outPatientId", value = "门诊id", required = true)
                                  @RequestParam(value = "outPatientId",required = true)String outPatientId,
                                  @ApiParam(name = "doctor", value = "医生code", required = true)
                                  @RequestParam(value = "doctor",required = true)String doctor,
                                  @ApiParam(name = "chargeType", value = "号别", required = true)
                                   @RequestParam(value = "chargeType",required = true)String chargeType)throws Exception{
        try {
            return ObjEnvelop.getSuccess("ok",xzzxEntranceService.registerOutPatient(outPatientId,doctor,chargeType));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 获取单条门诊就诊记录
     * @return
@ -87,14 +67,12 @@ public class XzyyController extends EnvelopRestEndpoint {
                                         @ApiParam(name = "conNo", value = "就诊次数", required = false)
                                         @RequestParam(value = "conNo",required = false)String conNo)throws Exception{
        try {
            return ObjEnvelop.getSuccess("ok",xzzxEntranceService.findOutpatientInfo(patient,conNo));
            return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectOutpatientInfo(patient,conNo));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 获取门诊下所有处方信息
     * @return

+ 15 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -12,6 +12,7 @@ import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -85,6 +86,8 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	public BasePatientDao basePatientDao;
	@Autowired
	private WxTemplateService wxTemplateService;
	@Autowired
	private XzyyPrescriptionService xzyyPrescriptionService;
	
	@Value("${wechat.id}")
	private String wxId;
@ -181,13 +184,21 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
				if(!"xm_ykyy_wx".equals(wxId)){//中山医院-心脏中心需要挂号
					//1.调用挂号接口
					logger.info("调用挂号接口====START");
					net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
					
					String rsCode = (String)res.get("@RESULT");
					String rsCode = "";
					String mes = "";
					if("xm_xzzx_wx".equals(wxId)){ //心脏中心挂号
						JSONObject res = xzyyPrescriptionService.registerOutPatient(outpatientCode,doctorCode);
						rsCode = res.getString("@RESULT");
						mes = res.getString("@MSG");
					}else {
						net.sf.json.JSONObject res = prescriptionService.registerOutPatient(outpatientCode,doctorCode);
						rsCode = (String)res.get("@RESULT");
						mes = (String)res.get("@MSG");
					}
					if("0".equals(rsCode)||"-2".equals(rsCode)){
						//挂号成功,已经挂号
					}else{
						String mes = (String)res.get("@MSG");
						failed(mes);
					}
					logger.info("调用挂号接口====END");

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

@ -96,6 +96,65 @@ public class YkyyController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "/getShortMessage")
    @ApiOperation(value = "眼科通获取验证码")
    public ObjEnvelop getShortMessage(@ApiParam(name = "tel", value = "电话号码", required = true)
                               @RequestParam(value = "tel",required = true)String tel,
                               @ApiParam(name = "type", value = "1注册2登录", required = true)
                               @RequestParam(value = "type",required = false)String type){
        try {
            return ObjEnvelop.getSuccess("ok",ykyyService.getShortMessage(type,tel));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 眼科通忘记密码
     *
     * @param tel
     * @param password
     * @return
     */
    @GetMapping(value = "/forgetPassword")
    @ApiOperation(value = "眼科通忘记密码")
    public ObjEnvelop yktLogin(@ApiParam(name = "tel", value = "电话号码", required = true)
                               @RequestParam(value = "tel",required = true)String tel,
                               @ApiParam(name = "password", value = "", required = true)
                               @RequestParam(value = "password",required = false)String password,
                               @ApiParam(name = "vercode", value = "", required = true)
                               @RequestParam(value = "vercode",required = false)String vercode){
        try {
            return ObjEnvelop.getSuccess("ok",ykyyService.forgetPassword(tel,password,vercode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 更新药品订单信息到眼科通
     *
     * @param orderNo
     * @param drugorder
     * @param cfsb
     * @return
     */
    @GetMapping(value = "/updateDrugorderInfo")
    @ApiOperation(value = "更新药品订单信息到眼科通")
    public ObjEnvelop updateDrugorderInfo(@ApiParam(name = "orderNo", value = "咨询订单号", required = true)
                               @RequestParam(value = "orderNo",required = true)String orderNo,
                               @ApiParam(name = "drugorder", value = "药品订单号", required = true)
                               @RequestParam(value = "drugorder",required = false)String drugorder,
                               @ApiParam(name = "cfsb", value = "处方识别号", required = true)
                               @RequestParam(value = "cfsb",required = false)String cfsb){
        try {
            return ObjEnvelop.getSuccess("ok",ykyyService.updateDrugorderInfo(orderNo,drugorder,cfsb));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
@ -291,6 +350,24 @@ public class YkyyController extends EnvelopRestEndpoint {
        }
    }
    /**
     *
     * 根据电话获取医生信息接口
     * @param phone
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "getDoctorInfoByLoginId", method = RequestMethod.GET)
    @ApiOperation("根据电话获取医生信息接口")
    public ObjEnvelop getDoctorInfoByLoginId(
            @ApiParam(name = "phone", value = "phone", required = true)
            @RequestParam(required = true)String phone) throws Exception {
        try {
            return ObjEnvelop.getSuccess("获取成功",ykyyService.GetDoctorInfoByLoginId(phone));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     *

+ 31 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/job/wlw/DeviceQualityPlanJob.java

@ -0,0 +1,31 @@
package com.yihu.jw.job.wlw;
import com.yihu.jw.service.channel.DeviceQualityPlanService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/7
 */
public class DeviceQualityPlanJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(DeviceQualityPlanJob.class);
    @Autowired
    private DeviceQualityPlanService deviceQualityPlanService;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("START========PrescriptionStatusUpdateJob========");
        try {
            deviceQualityPlanService.autoPush();
            logger.info("END========PrescriptionStatusUpdateJob========");
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("END===ERROE===PrescriptionStatusUpdateJob,message:"+e.getMessage());
        }
    }
}

+ 51 - 0
svr/svr-iot-job/src/main/java/com/yihu/jw/service/channel/DeviceQualityPlanService.java

@ -0,0 +1,51 @@
package com.yihu.jw.service.channel;
import com.yihu.iot.dao.device.IotDeviceQualityInspectionPlanDao;
import com.yihu.iot.dao.message.IotMessageDao;
import com.yihu.jw.entity.iot.device.IotDeviceQualityInspectionPlanDO;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import com.yihu.jw.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.xml.ws.Action;
import java.util.Date;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/7
 */
@Component
@Transactional
public class DeviceQualityPlanService {
    @Autowired
    private IotMessageDao iotMessageDao;
    @Autowired
    private IotDeviceQualityInspectionPlanDao iotDeviceQualityInspectionPlanDao;
    public void autoPush() {
        List<IotDeviceQualityInspectionPlanDO> listAll = iotDeviceQualityInspectionPlanDao.findListAll();
        listAll.forEach(one->{
            Date remindTime = one.getRemindTime();
            String system = DateUtil.dateToStrShort(DateUtil.getNowDate());
            String remind = DateUtil.dateToStrShort(remindTime);
            if (system.equalsIgnoreCase(remind)){
                IotMessageDO iotMessageDO = new IotMessageDO();
                iotMessageDO.setTitle("设备质检提醒");
                iotMessageDO.setContent("订单:"+one.getPurchaseId()+".将于"+remind+",进行质检,请及时维护");
                iotMessageDO.setRead("0");
                iotMessageDO.setDel("0");
                iotMessageDO.setTitle("4");
                iotMessageDao.save(iotMessageDO);
            }
        });
    }
}

+ 9 - 1
svr/svr-iot/pom.xml

@ -13,7 +13,7 @@
    <groupId>com.yihu.iot</groupId>
    <artifactId>svr-iot</artifactId>
    <version>${parent.version}</version>
    <packaging>war</packaging>
    <packaging>jar</packaging>
    <dependencies>
        <!-- 支持Tomcat启动 -->
@ -32,6 +32,14 @@
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>

+ 3 - 6
svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -109,8 +109,7 @@ public class IotCompanyController extends EnvelopRestEndpoint {
        try {
            IotCompanyVO iotCompanyVO = toEntity(jsonData, IotCompanyVO.class);
            IotCompanyDO iotCompany = iotCompanyService.convertToModelDO(iotCompanyVO);
            iotCompanyService.create(iotCompany);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create);
            return iotCompanyService.create(iotCompany);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -218,8 +217,7 @@ public class IotCompanyController extends EnvelopRestEndpoint {
    public MixEnvelop<IotCompanyVO, IotCompanyVO> delCompany(@ApiParam(name = "id", value = "id")
                              @RequestParam(value = "id", required = true) String id) {
        try {
            iotCompanyService.delCompany(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
            return  iotCompanyService.delCompany(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -328,8 +326,7 @@ public class IotCompanyController extends EnvelopRestEndpoint {
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> delCompanyCert(@ApiParam(name = "id", value = "id", defaultValue = "")
                                                           @RequestParam(value = "id", required = true)String id) {
        try {
            iotCompanyCertificateService.delCompanyCert(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_delete);
            return iotCompanyCertificateService.delCompanyCert(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

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

@ -38,11 +38,7 @@ public class IotDeviceController extends EnvelopRestEndpoint {
    @Autowired
    private IotDeviceService iotDeviceService;
    /*@Autowired
    private FastDFSUtil fastDFSHelper;*/
    /*@Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;*/
    @Autowired
    private IotDeviceImportRecordDao iotDeviceImportRecordDao;
@ -102,8 +98,8 @@ public class IotDeviceController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = IotRequestMapping.Device.api_getById)
    @ApiOperation(value = "根据code查找设备", notes = "根据code查找设备")
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findByCode(@ApiParam(name = "id", value = "id")
    @ApiOperation(value = "根据ID查找设备", notes = "根据ID查找设备")
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findByCode(@ApiParam(name = "id", value = "设备ID")
                              @RequestParam(value = "id", required = true) String id
    ) {
        try {

+ 94 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceOverhaulController.java

@ -0,0 +1,94 @@
package com.yihu.iot.controller.device;
import com.yihu.iot.service.device.IotDeviceOverhaulService;
import com.yihu.iot.service.device.IotPatientDeviceService;
import com.yihu.jw.entity.iot.device.IotDeviceOverhaulDO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * @author humingfen on 2020/5/7
 */
@RestController
@RequestMapping(IotRequestMapping.Common.patientDevice)
@Api(tags = "居民设备检修管理相关操作", description = "居民设备检修管理相关操作")
public class IotDeviceOverhaulController extends EnvelopRestEndpoint {
    @Autowired
    private IotPatientDeviceService patientDeviceService;
    @Autowired
    private IotDeviceOverhaulService deviceOverhaulService;
    @GetMapping(value = IotRequestMapping.PatientDevice.getOverhaulDeviceList)
    @ApiOperation(value = "获取检修管理列表", notes = "获取检修管理列表")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> getOverhaulDeviceList(
            @ApiParam(name = "deviceSn", value = "sn码", defaultValue = "")
            @RequestParam(value = "deviceSn", required = false) String deviceSn,
            @ApiParam(name = "patientName", value = "领用人")
            @RequestParam(value = "patientName", required = false) String patientName,
            @ApiParam(name = "page", value = "第几页", defaultValue = "1")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "每页记录数")
            @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        try {
            return patientDeviceService.getOverhaulDeviceList(deviceSn, patientName, page, pageSize);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.PatientDevice.getOverhaulListByPatientDeviceId)
    @ApiOperation(value = "根据居民设备id获取检修详情列表", notes = "根据居民设备id获取检修详情列表")
    public MixEnvelop<IotDeviceOverhaulDO, IotDeviceOverhaulDO> getOverhaulListByPatientDeviceId(
            @ApiParam(name = "patientDeviceId", value = "居民设备id", defaultValue = "")
            @RequestParam(value = "patientDeviceId", required = true) String patientDeviceId) {
        try {
            List<IotDeviceOverhaulDO> list = deviceOverhaulService.getOverhaulListByPatientDeviceId(patientDeviceId);
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, list);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.PatientDevice.updateOverhaulStatusById)
    @ApiOperation(value = "删除或更新检修状态", notes = "删除或更新检修状态")
    public MixEnvelop<IotDeviceOverhaulDO, IotDeviceOverhaulDO> updateOverhaulStatusById(
            @ApiParam(name = "id", value = "检修记录id", defaultValue = "")
            @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "status", value = "检修状态(-1删除 0未检修 1已检修正常 2已检修回收)")
            @RequestParam(value = "status", required = true) Integer status,
            @ApiParam(name = "remark", value = "检修备注")
            @RequestParam(value = "remark", required = false) String  remark) {
        try {
            IotDeviceOverhaulDO deviceOverhaulDO = deviceOverhaulService.updateOverhaulStatusById(id, status, remark);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_update, deviceOverhaulDO);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.PatientDevice.delOverhaulByPatientDeviceId)
    @ApiOperation(value = "根据居民设备id删除检修记录", notes = "根据居民设备id删除检修记录")
    public MixEnvelop<IotDeviceOverhaulDO, IotDeviceOverhaulDO> delOverhaulByPatientDeviceId(
            @ApiParam(name = "patientDeviceId", value = "居民设备id", defaultValue = "")
            @RequestParam(value = "patientDeviceId", required = true) String patientDeviceId) {
        try {
            deviceOverhaulService.delOverhaulByPatientDeviceId(patientDeviceId);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

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

@ -14,6 +14,8 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * @author yeshijie on 2017/12/8.
 */
@ -139,9 +141,13 @@ public class IotDeviceQualityController extends EnvelopRestEndpoint {
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> updCompany(@ApiParam(name = "actualTime", value = "完成时间", defaultValue = "")
                                            @RequestParam(value = "actualTime", required = true) String actualTime,
                                                                   @ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
                                            @RequestParam(value = "id", required = true) String id,
                                                                   @ApiParam(name = "summary", value = "质检总结")
                                            @RequestParam(value = "summary", required = true) String summary,
                                                                   @ApiParam(name = "imgs", value = "质检图像")
                                            @RequestBody List<String> imgs ) {
        try {
            iotDeviceQualityInspectionPlanService.completePlan(id,actualTime);
            iotDeviceQualityInspectionPlanService.completePlan(id,actualTime,summary,imgs);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find);
        } catch (Exception e) {
            e.printStackTrace();
@ -154,9 +160,28 @@ public class IotDeviceQualityController extends EnvelopRestEndpoint {
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> completePlanByPurchaseId(@ApiParam(name = "actualTime", value = "完成时间", defaultValue = "")
                                                                @RequestParam(value = "actualTime", required = true) String actualTime,
                                                                                 @ApiParam(name = "purchaseId", value = "purchaseId")
                                                                @RequestParam(value = "purchaseId", required = true) String purchaseId) {
                                                                @RequestParam(value = "purchaseId", required = true) String purchaseId,
                                                                                 @ApiParam(name = "summary", value = "质检总结")
                                                                @RequestParam(value = "summary", required = true) String summary,
                                                                                 @ApiParam(name = "imgs", value = "质检图像")
                                                                @RequestBody List<String> imgs ) {
        try{
            iotDeviceQualityInspectionPlanService.completePlanByPurchaseId(purchaseId,actualTime,summary,imgs);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceQuality.remindTimePlan)
    @ApiOperation(value = "计划时间提醒", notes = "计划时间提醒")
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> remindTimePlan(@ApiParam(name = "time", value = "提醒时间")
                                                                                                     @RequestParam(value = "time", required = true) String time) {
        try {
            iotDeviceQualityInspectionPlanService.completePlanByPurchaseId(purchaseId,actualTime);
            iotDeviceQualityInspectionPlanService.remindTimePlan(time);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find);
        } catch (Exception e) {
            e.printStackTrace();
@ -164,4 +189,5 @@ public class IotDeviceQualityController extends EnvelopRestEndpoint {
        }
    }
}

+ 142 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceSimController.java

@ -0,0 +1,142 @@
package com.yihu.iot.controller.device;
import com.yihu.iot.service.device.IotDeviceSimService;
import com.yihu.jw.entity.iot.device.IotDeviceOrderDO;
import com.yihu.jw.entity.iot.device.IotDeviceSimDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/7
 */
@RestController
@RequestMapping(IotRequestMapping.Common.sim)
@Api(tags = "SIM卡管理相关操作", description = "SIM卡管理相关操作")
public class IotDeviceSimController extends EnvelopRestEndpoint {
    @Autowired
    private IotDeviceSimService iotDeviceSimService;
    @PostMapping(value = IotRequestMapping.DeviceSim.editSIM)
    @ApiOperation(value = "编辑SIM卡管理", notes = "编辑SIM卡管理")
    public MixEnvelop<IotOrderVO, IotOrderVO> editSIM(@ApiParam(name = "id", value = "ID", defaultValue = "")
                                                     @RequestParam(value = "id",required = true) String id,
                                                      @ApiParam(name = "advancePayment", value = "预缴金额", defaultValue = "")
                                                      @RequestParam(value = "advancePayment",required = true) String advancePayment,
                                                      @ApiParam(name = "payment", value = "套餐资费", defaultValue = "")
                                                          @RequestParam(value = "payment",required = true) String payment,
                                                      @ApiParam(name = "remainingBalance", value = "余额", defaultValue = "")
                                                          @RequestParam(value = "remainingBalance",required = true) String remainingBalance,
                                                      @ApiParam(name = "status", value = "状态", defaultValue = "1")
                                                          @RequestParam(value = "status",required = true) Integer status) {
        try {
           iotDeviceSimService.editSIM(id,advancePayment,payment,remainingBalance,status);
            return MixEnvelop.getSuccess(IotRequestMapping.DeviceSim.message_success_add);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.DeviceSim.addSIM)
    @ApiOperation(value = "添加SIM卡", notes = "添加SIM卡")
    public MixEnvelop<IotOrderVO, IotOrderVO> addSIM(@ApiParam(name = "json", value = "json", defaultValue = "")
                                                      @RequestParam(value = "json",required = true) String json) {
        try {
            return iotDeviceSimService.addSIM(json);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceSim.conditionQueryPage)
    @ApiOperation(value = "条件查找SIM卡", notes = "条件查找SIM卡")
    public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> conditionQueryPage(@ApiParam(name = "sim", value = "SIM卡", defaultValue = "")
                                                                     @RequestParam(value = "sim", required = false) String sim,
                                                                       @ApiParam(name = "sn", value = "SN码", defaultValue = "")
                                                                     @RequestParam(value = "sn", required = false) String sn,
                                                                       @ApiParam(name = "status", value = "状态", defaultValue = "")
                                                                     @RequestParam(value = "status", required = false) String status,
                                                                       @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                     @RequestParam(value = "page", required = false) Integer page,
                                                                       @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                     @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotDeviceSimService.conditionQueryPage(page,size,status,sim,sn);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceSim.findAllSim)
    @ApiOperation(value = "分页查询所有SIM卡信息",notes = "分页查询所有SIM卡信息")
    public MixEnvelop<IotDeviceSimDO,IotDeviceSimDO> findAllSim(@ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                               @RequestParam(value = "page", required = false) Integer page,
                                                                               @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                               @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotDeviceSimService.findAllSim(page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceSim.remind)
    @ApiOperation(value = "分页查询所有SIM卡信息",notes = "分页查询所有SIM卡信息")
    public MixEnvelop<IotDeviceSimDO,IotDeviceSimDO> remind(@ApiParam(name = "time", value = "提醒时间", defaultValue = "")
                                                                @RequestParam(value = "time", required = false) String time,
                                                                @ApiParam(name = "money", value = "提醒金额", defaultValue = "")
                                                                @RequestParam(value = "money", required = false) String money,
                                                            @ApiParam(name = "status", value = "是否欠费提醒", defaultValue = "0")
                                                                @RequestParam(value = "status", required = false) String status){
        try {
            iotDeviceSimService.remind(time,money,status);
            return MixEnvelop.getSuccess(IotRequestMapping.DeviceSim.message_success_remind);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 85 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java

@ -304,4 +304,89 @@ public class IotPatientDeviceController extends EnvelopRestEndpoint {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.PatientDevice.delPatientDevice)
    @ApiOperation(value = "设备回收", notes = "设备回收")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> delPatientDevice(@ApiParam(name = "id", value = "居民设备id", defaultValue = "")
                                                                                  @RequestParam String id,
                                                                               @ApiParam(name = "del", value = "删除标志(1正常 0回收纳入库存 -1回收核销)", defaultValue = "")
                                                                               @RequestParam Integer del) {
        try {
            //设备回收
            iotPatientDeviceService.delPatientDevice(id, del);
            return MixEnvelop.getSuccess(IotRequestMapping.Device.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.PatientDevice.createRepairDevice)
    @ApiOperation(value = "新增编辑设备维修记录", notes = "新增编辑设备维修记录")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> createRepairDevice(@ApiParam(name = "deviceSn", value = "设备sn码")
                                                                                     @RequestParam(value = "deviceSn", required = true) String deviceSn,
                                                                                 @ApiParam(name = "status", value = "维修状态(1待维护 2已报修 3厂家接收 4厂家寄回 5待更换 6已更换)")
                                                                                 @RequestParam(value = "status", required = false) Integer status,
                                                                                 @ApiParam(name = "damageDescription", value = "损坏说明")
                                                                                     @RequestParam(value = "damageDescription", required = false) String damageDescription,
                                                                                 @ApiParam(name = "damageImages", value = "申请维修附件图片,多个用逗号隔开")
                                                                                     @RequestParam(value = "damageImages", required = false) String damageImages,
                                                                                 @ApiParam(name = "repairDescription", value = "维修说明")
                                                                                     @RequestParam(value = "repairDescription", required = false) String repairDescription) {
        try {
            List<IotPatientDeviceVO> patientDeviceDOList = iotPatientDeviceService.createRepairDevice(deviceSn, status, damageDescription, damageImages, repairDescription);
            return MixEnvelop.getSuccessList(IotRequestMapping.Device.message_success_update, patientDeviceDOList);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.PatientDevice.deleteRepairDevice)
    @ApiOperation(value = "删除设备维修记录", notes = "删除设备维修记录")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> deleteRepairDevice(@ApiParam(name = "deviceSn", value = "设备sn码")
                                                                                 @RequestParam(value = "deviceSn", required = true) String deviceSn) {
        try {
            iotPatientDeviceService.deleteRepairDevice(deviceSn);
            return MixEnvelop.getSuccess(IotRequestMapping.Device.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.PatientDevice.getDeviceInfoByDeviceSn)
    @ApiOperation(value = "根据sn码获取厂商相关信息", notes = "根据sn码获取厂商相关信息")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> getDeviceInfoByDeviceSn(
            @ApiParam(name = "deviceSn", value = "sn码", defaultValue = "")
            @RequestParam(value = "deviceSn", required = true) String deviceSn) {
        try {
            List<IotPatientDeviceVO> list = iotPatientDeviceService.getDeviceInfoByDeviceSn(deviceSn);
            return MixEnvelop.getSuccessList(IotRequestMapping.Device.message_success_find, list);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.PatientDevice.getRepairDeviceList)
    @ApiOperation(value = "获取售后管理列表", notes = "获取售后管理列表")
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> getRepairDeviceList(
            @ApiParam(name = "deviceSn", value = "sn码", defaultValue = "")
            @RequestParam(value = "deviceSn", required = false) String deviceSn,
            @ApiParam(name = "status", value = "维修状态(1待维护 2已报修 3厂家接收 4厂家寄回 5待更换 6已更换)")
            @RequestParam(value = "status", required = false) Integer status,
            @ApiParam(name = "manufacturerId", value = "厂商id")
            @RequestParam(value = "manufacturerId", required = false) String manufacturerId,
            @ApiParam(name = "page", value = "第几页", defaultValue = "1")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "pageSize", value = "每页记录数")
            @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        try {
            return iotPatientDeviceService.getRepairDeviceList(deviceSn, status, manufacturerId, page, pageSize);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 147 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceAuditController.java

@ -0,0 +1,147 @@
package com.yihu.iot.controller.platform;
import com.yihu.iot.service.platform.IotInterfaceAuditService;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.platform.IotInterfaceAuditVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 * public class IotInterfaceController extends EnvelopRestEndpoint {
 */
@RestController
@RequestMapping(IotRequestMapping.Common.interfaceAudit)
@Api(tags = "平台应用接口", description = "审核与申请管理相关操作")
public class IotInterfaceAuditController extends EnvelopRestEndpoint {
    @Autowired
    private IotInterfaceAuditService iotInterfaceAuditService;
    @PostMapping(value = IotRequestMapping.InterfaceAudit.addInterfaceApplyFor)
    @ApiOperation(value = "新增应用接口权限申请",notes = "新增应用接口权限申请")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> addInterfaceApplyFor(@ApiParam(name = "JSON",value = "接口JSON串") @RequestParam(value = "JSON",required = true)String json,
                                                                                 @ApiParam(name = "ids",value = "共享接口IDS") @RequestBody List<String> ids){
        try {
            iotInterfaceAuditService.addInterfaceApplyFor(json,ids);
            return MixEnvelop.getSuccess(IotRequestMapping.InterfaceAudit.message_success_apply_for);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.InterfaceAudit.findInterfaceApplyFor)
    @ApiOperation(value = "查看应用接口申请信息",notes = "查看应用接口申请信息")
    public MixEnvelop<IotInterfaceAuditVO,IotInterfaceAuditVO> findInterfaceApplyFor(@ApiParam(name = "id",value = "ID") @RequestParam(value = "id",required = true)String id){
        try {
            IotInterfaceAuditVO iotInterfaceAuditVO  = iotInterfaceAuditService.findInterfaceApplyFor(id);
            return MixEnvelop.getSuccess(IotRequestMapping.InterfaceAudit.message_success_find,iotInterfaceAuditVO);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.InterfaceAudit.findAllApplyFor)
    @ApiOperation(value = "分页查询所有应用接口申请信息",notes = "分页查询所有应用接口申请信息")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> findAllApplyFor(@ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                                   @RequestParam(value = "page", required = false) Integer page,
                                                                               @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                               @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotInterfaceAuditService.findAllApplyFor(page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.InterfaceAudit.conditionQueryPage)
    @ApiOperation(value = "条件分页查询应用接口申请信息",notes = "条件分页查询应用接口申请信息")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> conditionQueryPage(@ApiParam(name = "name", value = "厂商名称或联系人名称", defaultValue = "")
                                                                                      @RequestParam(value = "name", required = false) String companyName,
                                                                                  @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                                      @RequestParam(value = "page", required = false) Integer page,
                                                                                  @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                                      @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotInterfaceAuditService.conditionQueryPage(companyName,page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.InterfaceAudit.auditPass)
    @ApiOperation(value = "应用接口审核通过",notes = "应用接口审核通过")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> auditPass(@ApiParam(name = "id",value = "ID") @RequestParam(value = "id",required = true)String id){
        try {
            return iotInterfaceAuditService.auditPass(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.InterfaceAudit.auditNoPass)
    @ApiOperation(value = "应用接口审核不通过",notes = "应用接口审核不通过")
    public MixEnvelop<IotInterfaceAuditDO,IotInterfaceAuditDO> auditNoPass(@ApiParam(name = "id",value = "ID") @RequestParam(value = "id",required = true)String id,
                                                                           @ApiParam(name = "msg",value = "拒绝说明") @RequestParam(value = "msg",required = true)String msg){
        try {
            return iotInterfaceAuditService.auditNoPass(id,msg);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

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

@ -1,8 +1,15 @@
package com.yihu.iot.controller.platform;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.service.company.IotCompanyService;
import com.yihu.iot.service.platform.IotCompanyAppInterfaceService;
import com.yihu.iot.service.platform.IotInterfaceLogService;
import com.yihu.iot.service.platform.IotShareInterfaceService;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.restmodel.iot.platform.IotAppInterfacesVO;
import com.yihu.jw.restmodel.iot.platform.IotInterfaceLogVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -13,6 +20,9 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
@ -30,6 +40,12 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    private IotInterfaceLogService iotInterfaceLogService;
    @Autowired
    private IotCompanyAppInterfaceService iotCompanyAppInterfaceService;
    @Autowired
    private IotCompanyService iotCompanyService;
    @PostMapping(value = IotRequestMapping.Platform.addInterface)
    @ApiOperation(value = "新增共享接口",notes = "新增共享接口")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> addInterface(@ApiParam(name = "JSON",value = "接口JSON串") @RequestParam(value = "JSON",required = true)String json){
@ -187,6 +203,82 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = IotRequestMapping.Platform.findCompanyById)
    @ApiOperation(value = "查看平台信息",notes = "查看平台信息")
    public MixEnvelop<IotCompanyVO,IotCompanyVO> findCompanyById(@ApiParam(name = "id", value = "公司ID", defaultValue = "")
                                                          @RequestParam(value = "id", required = false) String id){
        try {
            IotCompanyDO iotCompanyDO = iotCompanyService.findById(id);
            IotCompanyVO vo = iotCompanyService.convertToModelVO(iotCompanyDO);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find, vo);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.editCompanyById)
    @ApiOperation(value = "编辑平台信息", notes = "编辑平台信息")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> updCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                                             @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            IotCompanyVO iotCompanyVO = toEntity(jsonData, IotCompanyVO.class);
            IotCompanyDO iotCompany = iotCompanyService.convertToModelDO(iotCompanyVO);
            iotCompanyService.updCompany(iotCompany,"0");
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_edit);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Platform.delCompanyById)
    @ApiOperation(value = "删除平台信息", notes = "删除平台信息")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> delCompanyById(@ApiParam(name = "id", value = "公司ID", defaultValue = "")
                                                                     @RequestParam(value = "id", required = false) String id) {
        try {
            iotCompanyService.delCompany(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.allotInterface)
    @ApiOperation(value = "分配接口", notes = "分配接口")
    public MixEnvelop<IotCompanyAppInterfaceDO, IotCompanyAppInterfaceDO> allotInterface(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                                             @RequestParam(value = "jsonData", required = true)String jsonData,
                                                                             @ApiParam(name = "ids", value = "IDS", defaultValue = "")
                                                             @RequestBody List<String> ids) {
        try {
            iotCompanyAppInterfaceService.allotInterface(jsonData,ids);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_add);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.findAppInterface)
    @ApiOperation(value = "查看应用接口", notes = "查看应用接口")
    public MixEnvelop<IotAppInterfacesVO, IotAppInterfacesVO> findAppInterface(@ApiParam(name = "appId", value = "应用id", defaultValue = "")
                                                                                         @RequestParam(value = "appId") String appId) {
        try {
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find, iotCompanyAppInterfaceService.findAppInterface(appId));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

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

@ -1,7 +1,9 @@
package com.yihu.iot.controller.workType;
import com.yihu.iot.service.workType.IotWorkTypeService;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
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.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -61,8 +63,8 @@ public class IotWorkTypeController extends EnvelopRestEndpoint {
                                                              @RequestParam(value = "id",required = true)String id){
        try {
            iotWorkTypeService.deleteType(id);
            return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_delete);
            return  iotWorkTypeService.deleteType(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -77,7 +79,56 @@ public class IotWorkTypeController extends EnvelopRestEndpoint {
                                                            @RequestParam(value = "id",required = true)String id){
        try {
            return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_find, iotWorkTypeService.findType(id));
            return  iotWorkTypeService.findType(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.WorkType.findAll)
    @ApiOperation(value = "分页查询所有",notes = "分页查询所有")
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> findAllLog(@ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                      @RequestParam(value = "page", required = false) Integer page,
                                                                      @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                      @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotWorkTypeService.findAll(page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.conditionQueryPage)
    @ApiOperation(value = "条件查询分页",notes = "条件查询分页")
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> conditionQueryPage(@ApiParam(name = "type", value = "业务类型", defaultValue = "")
                                                                                  @RequestParam(value = "type", required = false) String type,
                                                                                  @ApiParam(name = "explanation", value = "说明", defaultValue = "")
                                                                                  @RequestParam(value = "explanation", required = false) String explanation,
                                                                                  @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                                  @RequestParam(value = "page", required = false) Integer page,
                                                                                  @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                                  @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotWorkTypeService.conditionQueryPage(page,size,type,explanation);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -85,4 +136,6 @@ public class IotWorkTypeController extends EnvelopRestEndpoint {
    }
}

+ 10 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceDao.java

@ -43,4 +43,14 @@ public interface IotDeviceDao extends PagingAndSortingRepository<IotDeviceDO, St
    List<IotDeviceDO> findListByOrderId(String orderId);
    List<IotDeviceDO> findListByInventoryLogId(String id);
    @Modifying
    @Query("update IotDeviceDO w set w.isGrant = ?2 where w.id = ?1 ")
    void updateIsGrantById(String deviceId, Integer isGrant);
    @Modifying
    @Query("update IotDeviceDO w set w.del = ?2 where w.id = ?1 ")
    void updateDelById(String id, int del);
}

+ 19 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceOverhaulDao.java

@ -0,0 +1,19 @@
package com.yihu.iot.dao.device;
import com.yihu.jw.entity.iot.device.IotDeviceOverhaulDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface IotDeviceOverhaulDao extends PagingAndSortingRepository<IotDeviceOverhaulDO, String>, JpaSpecificationExecutor<IotDeviceOverhaulDO> {
    @Query("select o from  IotDeviceOverhaulDO o where o.patientDeviceId = ?1 and o.status <> -1 order by o.time ")
    List<IotDeviceOverhaulDO> findAllByPatientDeviceId(String patientDeviceId);
    @Modifying
    @Query("update IotDeviceOverhaulDO o set o.status = -1 where o.patientDeviceId = ?1 ")
    void delOverhaulByPatientDeviceId(String patientDeviceId);
}

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

@ -30,4 +30,7 @@ public interface IotDeviceQualityInspectionPlanDao extends PagingAndSortingRepos
    @Query(value = "SELECT a.* from iot_device_quality_inspection_plan a WHERE a.purchase_id = ?1 and a.status=?2 and a.del=1 ORDER BY a.plan_time asc limit 1",nativeQuery = true)
    IotDeviceQualityInspectionPlanDO findFirstByPurchaseId(String purchaseId,String status);
    @Query("from IotDeviceQualityInspectionPlanDO w where  w.status=1 and w.del=1 ORDER BY w.planTime desc")
    List<IotDeviceQualityInspectionPlanDO> findListAll();
}

+ 15 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceSimDao.java

@ -0,0 +1,15 @@
package com.yihu.iot.dao.device;
import com.yihu.jw.entity.iot.device.IotDeviceSimDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/7
 */
public interface IotDeviceSimDao extends PagingAndSortingRepository<IotDeviceSimDO,String>, JpaSpecificationExecutor<IotDeviceSimDO> {
    IotDeviceSimDO  findBySim(String sim);
}

+ 7 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotPatientDeviceDao.java

@ -44,4 +44,11 @@ public interface IotPatientDeviceDao extends PagingAndSortingRepository<IotPatie
    @Modifying
    @Query("update IotPatientDeviceDO t set t.deviceSn = ?3 , t.userType = ?4,t.sim=?5 where t.patient = ?1 and t.deviceSn = ?2 and t.del=1 ")
    int updatePatientDevice(String patient, String deviceSN, String newDeviceSN,String userType,String sim);
    @Query("from IotPatientDeviceDO a where a.sim = ?1 and  a.del=1 ")
    IotPatientDeviceDO findBySim(String sim);
    @Modifying
    @Query("update IotPatientDeviceDO t set t.del = ?2 where t.id = ?1")
    void updateDelById(String id, int del);
}

+ 17 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/message/IotMessageDao.java

@ -0,0 +1,17 @@
package com.yihu.iot.dao.message;
import com.yihu.jw.entity.iot.device.IotDeviceQualityInspectionPlanDO;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author suhaiwen
 * @vsrsion 1.0
 * Created at 2020/5/7
 */
public interface IotMessageDao extends PagingAndSortingRepository<IotMessageDO,String>,
        JpaSpecificationExecutor<IotMessageDO> {
}

+ 23 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotCompanyAppInterfaceDao.java

@ -0,0 +1,23 @@
package com.yihu.iot.dao.platform;
import com.yihu.jw.entity.iot.company.IotCompanyAppDO;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
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/30
 */
public interface IotCompanyAppInterfaceDao extends PagingAndSortingRepository<IotCompanyAppInterfaceDO,String>, JpaSpecificationExecutor<IotCompanyAppInterfaceDO> {
    @Query("from IotCompanyAppInterfaceDO w where w.appId=?1 and w.del=0")
    List<IotCompanyAppInterfaceDO> findByAppId(String appId);
}

+ 21 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotInterfaceAuditDao.java

@ -0,0 +1,21 @@
package com.yihu.iot.dao.platform;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDO;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
public interface IotInterfaceAuditDao extends PagingAndSortingRepository<IotInterfaceAuditDO,String>, JpaSpecificationExecutor<IotInterfaceAuditDO> {
   List<IotInterfaceAuditDO>   findByAppId(String  appId);
}

+ 17 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotInterfaceAuditDetailDao.java

@ -0,0 +1,17 @@
package com.yihu.iot.dao.platform;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDetailDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
public interface IotInterfaceAuditDetailDao extends PagingAndSortingRepository<IotInterfaceAuditDetailDO,String>, JpaSpecificationExecutor<IotInterfaceAuditDetailDO> {
    List<IotInterfaceAuditDetailDO> findByInterfaceId(String interfaceId);
}

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

@ -7,6 +7,8 @@ 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
@ -16,4 +18,7 @@ public interface IotWorkTypeDao extends PagingAndSortingRepository<IotWorkTypeDO
    @Query("from IotWorkTypeDO w where w.id=?1 and w.del=0")
    IotWorkTypeDO findById(String id);
    @Query("from IotWorkTypeDO w where w.name=?1 and w.del=0")
    List<IotWorkTypeDO> findByName(String name);
}

+ 3 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyCertificateService.java

@ -110,13 +110,14 @@ public class IotCompanyCertificateService extends BaseJpaService<IotCompanyCerti
     * 删除
     * @param id
     */
    public void delCompanyCert(String id){
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> delCompanyCert(String id){
        IotCompanyCertificateDO companyCert = iotCompanyCertificateDao.findById(id);
        if(companyCert==null){
            throw new RuntimeException("证书已删除,请勿重复操作");
            return MixEnvelop.getError("证书已删除,请勿重复操作");
        }
        companyCert.setDel(0);
        iotCompanyCertificateDao.save(companyCert);
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
    }
    public List<IotCompanyCertificateVO> convertToModels(List<IotCompanyCertificateDO> iotCompanyCertificateDOList,List<IotCompanyCertificateVO> voList){

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

@ -276,7 +276,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * @param iotCompany
     * @return
     */
    public IotCompanyDO create(IotCompanyDO iotCompany) {
    public MixEnvelop<IotCompanyVO, IotCompanyVO> create(IotCompanyDO iotCompany) {
        List<IotCompanyTypeDO> list = iotCompany.getTypeList();
        if("1".equalsIgnoreCase(iotCompany.getAccountType())){
            //产商注册
@ -285,7 +285,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                //判断营业执照号是否被注册
                if(iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense())&&iotCompanyDO.getStatus().equalsIgnoreCase("1")){
                    throw new RuntimeException("该营业执照号已经注册,请使用其他执照");
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
                if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())){
                    //该公司重新申请注册,则删除原先注册信息
@ -294,7 +294,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                        iotCompanyAppDao.delete(apps);
                        iotCompanyDao.delete(iotCompanyDO);
                    }else {
                        throw new RuntimeException("该企业已经注册,请使用注册账号登录");
                        return MixEnvelop.getError("该企业已经注册,请使用注册账号登录");
                    }
                }
            }
@ -323,7 +323,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                //判断营业执照号是否被注册
                if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) && iotCompanyDO.getStatus().equalsIgnoreCase("1")) {
                    throw new RuntimeException("该营业执照号已经注册,请使用其他执照");
                    return MixEnvelop.getError("该营业执照号已经注册,请使用其他执照");
                }
            }
@ -352,7 +352,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
                            appDO.setCompanyId(companyTemp.getId());
                        }
                    }
                    throw new RuntimeException("该应用已经注册,请使用注册账号登录");
                    return MixEnvelop.getError("该应用已经注册,请使用注册账号登录");
                }
            }
            //平台接入
@ -373,7 +373,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        }
        return iotCompany;
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create,iotCompany);
    }
    /**
@ -457,13 +457,14 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * 删除
     * @param id
     */
    public void delCompany(String id){
    public MixEnvelop<IotCompanyVO, IotCompanyVO> delCompany(String id){
        IotCompanyDO company = iotCompanyDao.findById(id);
        if (company==null){
           throw new RuntimeException("该企业已删除,请勿重复操作");
        return   MixEnvelop.getError("该企业已删除,请勿重复操作");
        }
        company.setDel(0);
        iotCompanyDao.save(company);
        return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
    }
    /**

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

@ -52,7 +52,7 @@ public class IotDeviceInventoryService extends BaseJpaService<IotDeviceInventory
     * @return
     */
    public MixEnvelop<IotDeviceVO, IotDeviceVO> getDeviceInventoryList(String name, String categoryCode, String hospitalName, Integer page, Integer pageSize) {
        String sql = "select d.id,d.product_id,d.`name`,d.category_code,d.category_name,d.manufacturer_id,d.manufacturer_name,d.hospital,d.hospital_name,count(id) inventoryCount FROM `iot_device` d where del=1  ";
        String sql = "select d.id,d.product_id,d.`name`,d.category_code,d.category_name,d.manufacturer_id,d.manufacturer_name,d.hospital,d.hospital_name,count(id) inventoryCount FROM `iot_device` d where del=1 and is_grant=0 ";
        if (StringUtils.isNotBlank(name)) {
            sql += "and name like '%" + name + "%' ";
        }

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

@ -0,0 +1,40 @@
package com.yihu.iot.service.device;
import com.yihu.iot.dao.device.IotDeviceOverhaulDao;
import com.yihu.jw.entity.iot.device.IotDeviceOverhaulDO;
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 java.util.Date;
import java.util.List;
/**
 * 设备检修相关管理接口
 * create by hmf on 2020.5.7
 */
@Service
public class IotDeviceOverhaulService extends BaseJpaService<IotDeviceOverhaulDO, IotDeviceOverhaulDao> {
    @Autowired
    private IotDeviceOverhaulDao deviceOverhaulDao;
    public List<IotDeviceOverhaulDO> getOverhaulListByPatientDeviceId(String patientDeviceId) {
        return deviceOverhaulDao.findAllByPatientDeviceId(patientDeviceId);
    }
    public IotDeviceOverhaulDO updateOverhaulStatusById(String id, Integer status, String remark) {
        IotDeviceOverhaulDO deviceOverhaulDO = deviceOverhaulDao.findOne(id);
        deviceOverhaulDO.setStatus(status);
        if(StringUtils.isNotBlank(remark)){
            deviceOverhaulDO.setRemark(remark);
        }
        deviceOverhaulDO.setUpdateTime(new Date());
        deviceOverhaulDao.save(deviceOverhaulDO);
        return deviceOverhaulDO;
    }
    public void delOverhaulByPatientDeviceId(String patientDeviceId) {
        deviceOverhaulDao.delOverhaulByPatientDeviceId(patientDeviceId);
    }
}

+ 47 - 20
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java

@ -1,12 +1,15 @@
package com.yihu.iot.service.device;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.device.IotDeviceDao;
import com.yihu.iot.dao.device.IotDeviceOrderDao;
import com.yihu.iot.dao.device.IotDeviceQualityInspectionPlanDao;
import com.yihu.iot.dao.device.IotOrderPurchaseDao;
import com.yihu.iot.dao.message.IotMessageDao;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.jw.entity.iot.device.IotDeviceQualityInspectionPlanDO;
import com.yihu.jw.entity.iot.device.IotOrderPurchaseDO;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceQualityInspectionPlanVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -19,9 +22,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * @author yeshijie on 2017/12/8.
@ -103,12 +104,14 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
     * 完成质检计划
     * @param purchaseId
     */
    public void completePlanByPurchaseId(String purchaseId,String time){
    public void completePlanByPurchaseId(String purchaseId,String time,String summary,List<String> imgs){
        IotDeviceQualityInspectionPlanDO planDO = iotDeviceQualityInspectionPlanDao.findFirstByPurchaseId(purchaseId,IotDeviceQualityInspectionPlanDO.QualityPlanStatus.create.getValue());
        if(planDO!=null){
            planDO.setStatus(IotDeviceQualityInspectionPlanDO.QualityPlanStatus.complete.getValue());
            planDO.setActualTime(DateUtil.strToDate(time));
            //设置质检小结与质检图像
            String imgJson = JSONObject.toJSONString(imgs);
            planDO.setImg(imgJson);
            iotDeviceQualityInspectionPlanDao.save(planDO);
            updatePurchase(purchaseId);
@ -116,6 +119,26 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
    }
    /**
     * 完成质检计划
     * @param id 质检id
     */
    public void completePlan(String id,String time,String summary,List<String> imgs){
        IotDeviceQualityInspectionPlanDO planDO = iotDeviceQualityInspectionPlanDao.findById(id);
        if(planDO!=null){
            planDO.setStatus(IotDeviceQualityInspectionPlanDO.QualityPlanStatus.complete.getValue());
            planDO.setActualTime(DateUtil.strToDate(time));
            planDO.setSummary(summary);
            //设置质检小结与质检图像
            String imgJson = JSONObject.toJSONString(imgs);
            planDO.setImg(imgJson);
            iotDeviceQualityInspectionPlanDao.save(planDO);
            updatePurchase(planDO.getPurchaseId());
        }
    }
    /**
     * 更新采购清单的质检信息
     * @param purchaseId
@ -148,21 +171,6 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
        }
    }
    /**
     * 完成质检计划
     * @param id 质检id
     */
    public void completePlan(String id,String time){
        IotDeviceQualityInspectionPlanDO planDO = iotDeviceQualityInspectionPlanDao.findById(id);
        if(planDO!=null){
            planDO.setStatus(IotDeviceQualityInspectionPlanDO.QualityPlanStatus.complete.getValue());
            planDO.setActualTime(DateUtil.strToDate(time));
            iotDeviceQualityInspectionPlanDao.save(planDO);
            updatePurchase(planDO.getPurchaseId());
        }
    }
    /**
     * 字典翻译
@ -256,4 +264,23 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,qualityInspectionPlanVOList, page, size,count);
    }
    /**
     * 质检计划时间提醒
     * @param time
     */
    public void remindTimePlan(String time) {
        int remindTime = Integer.valueOf(time);
        List<IotDeviceQualityInspectionPlanDO> list = iotDeviceQualityInspectionPlanDao.findListAll();
        list.forEach(one->{
            Date remind = DateUtil.getPreDays(one.getPlanTime(), -remindTime);
            one.setRemindTime(remind);
            iotDeviceQualityInspectionPlanDao.save(one);
        });
    }
}

+ 172 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java

@ -0,0 +1,172 @@
package com.yihu.iot.service.device;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.device.IotDeviceDao;
import com.yihu.iot.dao.device.IotDeviceSimDao;
import com.yihu.iot.dao.device.IotPatientDeviceDao;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.device.IotDeviceDO;
import com.yihu.jw.entity.iot.device.IotDeviceSimDO;
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/7
 */
@Service
@Transactional
public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDeviceSimDao> {
    @Autowired
    private IotPatientDeviceDao iotPatientDeviceDao;
    @Autowired
    private IotDeviceSimDao iotDeviceSimDao;
    @Autowired
    private  IotDeviceDao iotDeviceDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 增加SIM卡管理
     * @param advancePayment
     * @param payment
     * @param remainingBalance
     * @param status
     */
    public void editSIM(String id,String advancePayment,String payment,String remainingBalance,Integer status ) {
        IotDeviceSimDO simDO = iotDeviceSimDao.findOne(id);
        simDO.setAdvancePayment(Float.parseFloat(advancePayment));
        simDO.setPayment(Float.parseFloat(payment));
        simDO.setRemainingBalance(Float.parseFloat(remainingBalance));
        simDO.setStatus(status);
        iotDeviceSimDao.save(simDO);
    }
    /**
     *
     * @param json
     */
    public MixEnvelop<IotOrderVO, IotOrderVO> addSIM(String json) {
        IotDeviceSimDO sim = JSONObject.parseObject(json, IotDeviceSimDO.class);
        IotDeviceSimDO deviceSimDaoBySim = iotDeviceSimDao.findBySim(sim.getSim());
        if(deviceSimDaoBySim!=null){
            return MixEnvelop.getError("SIM已存在");
        }
        IotPatientDeviceDO patientSim = iotPatientDeviceDao.findBySim(sim.getSim());
        if (patientSim!=null){
            sim.setDeviceName(patientSim.getDeviceName());
            sim.setDeviceSn(patientSim.getDeviceSn());
            sim.setContactsName(patientSim.getPatientName());
            sim.setContactsMobile(patientSim.getMobile());
        } else {
            IotDeviceDO deviceSim = iotDeviceDao.findBySimNo(sim.getSim());
            if (deviceSim!=null){
                sim.setDeviceName(deviceSim.getName());
                sim.setDeviceSn(deviceSim.getDeviceSn());
            }
        }
        sim.setRemainingBalance(sim.getAdvancePayment()-sim.getPayment());
        sim.setStatus(1);
        iotDeviceSimDao.save(sim);
        return MixEnvelop.getSuccess(IotRequestMapping.DeviceSim.message_success_add);
    }
    /**
     * 条件分页查找
     * @param page
     * @param size
     * @param status
     * @param sim
     * @param sn
     * @return
     */
    public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> conditionQueryPage(Integer page, Integer size, String status, String sim, String sn){
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_device_sim c WHERE 1=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_device_sim c  WHERE 1=1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(status)){
            sql.append(" and c.status=? ");
            sqlCount.append("and c.status='").append(status).append("' ");
            args.add(status);
        }
        if(StringUtils.isNotBlank(sim)){
            sql.append(" and (c.sim like '%").append(sim).append("%')");
            sqlCount.append(" and (c.sim like '%").append(sim).append("%')");
        }
        if(StringUtils.isNotBlank(sn)){
            sql.append(" and (c.device_sn like '%").append(sn).append("%')");
            sqlCount.append(" and (c.device_sn like '%").append(sn).append("%')");
        }
        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<Map<String,Object>> countList = jdbcTemplate.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.DeviceSim.message_success_find,list, page, size,count);
    }
    /**
     * 分页查找所有应用申请信息
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotDeviceSimDO, IotDeviceSimDO> findAllSim(Integer page, Integer size) {
        String sql="SELECT DISTINCT * FROM iot_device_sim ;";
        List<IotDeviceSimDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotDeviceSimDO.class));
        //获取总数
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.DeviceSim.message_success_find,list,page, size,count);
    }
    /**
     *
     * @param time
     * @param money
     * @param status
     */
    public void remind(String time, String money, String status) {
        Iterable<IotDeviceSimDO> list = iotDeviceSimDao.findAll();
        list.forEach(one->{
            one.setRemindTime(time);
            one.setRemindArrears(status);
            one.setRemindBalance(money);
            iotDeviceSimDao.save(one);
        });
    }
}

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

@ -2,24 +2,35 @@ package com.yihu.iot.service.device;
import com.alibaba.fastjson.JSONObject;
import com.yihu.elasticsearch.ElasticSearchHelper;
import com.yihu.iot.dao.device.IotDeviceDao;
import com.yihu.iot.dao.device.IotDeviceOverhaulDao;
import com.yihu.iot.dao.device.IotPatientDeviceDao;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.service.common.ElasticSearchQueryGenerator;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.jw.device.LocationDataDO;
import com.yihu.jw.entity.iot.device.IotDeviceOverhaulDO;
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import io.searchbox.client.JestResult;
import iot.device.LocationDataVO;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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.util.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.*;
@ -37,17 +48,48 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
    private ElasticSearchHelper elasticSearchHelper;
    @Autowired
    private ElasticSearchQueryGenerator elasticSearchQueryGenerator;
    @Autowired
    private IotDeviceDao iotDeviceDao;
    @Autowired
    private JdbcTemplate jdbcTempalte;
    @Autowired
    private IotSystemDictService iotSystemDictService;
    @Autowired
    private IotDeviceOverhaulDao deviceOverhaulDao;
    /**
     * 新增
     * @param patientDevice
     * @return
     */
    @Transactional
    public IotPatientDeviceDO create(IotPatientDeviceDO patientDevice) {
        patientDevice.setSaasId(getCode());
        patientDevice.setDel(1);
        return iotPatientDeviceDao.save(patientDevice);
        IotPatientDeviceDO patientDeviceDO = iotPatientDeviceDao.save(patientDevice);
        //更新设备绑定状态,减库存
        iotDeviceDao.updateIsGrantById(patientDevice.getDeviceId(), 1);
        //生成一年检修记录
        List<IotSystemDictDO> systemDictDOS = iotSystemDictService.getListByDictName("OVERHAUL_FREQUENCY");//获取设备检修时间
        if(systemDictDOS.size() == 1){
            List<IotDeviceOverhaulDO> deviceOverhaulDOS = new ArrayList<>();
            int day = Integer.parseInt(systemDictDOS.get(0).getValue());//检修间隔天数
            int count = 365/day;
            for(int i = 0 ; i< count; i++){
                IotDeviceOverhaulDO deviceOverhaulDO = new IotDeviceOverhaulDO();
                deviceOverhaulDO.setSaasId(getCode());
                deviceOverhaulDO.setPatientDeviceId(patientDeviceDO.getId());
                deviceOverhaulDO.setStatus(0);
                deviceOverhaulDO.setTime(DateUtil.dateToStr(DateUtil.getNextDay1(new Date(), day*(i+1)), "yyyy年MM月dd日"));
                deviceOverhaulDO.setCreateTime(new Date());
                deviceOverhaulDO.setUpdateTime(new Date());
                deviceOverhaulDOS.add(deviceOverhaulDO);
            }
            deviceOverhaulDao.save(deviceOverhaulDOS);
        }
        return patientDeviceDO;
    }
    /**
@ -274,4 +316,125 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        count = result.getTotal();
        return count;
    }
    /**
     * 新增编辑维修记录
     * @param deviceSn
     * @param status
     * @param damageDescription
     * @param damageImages
     * @param repairDescription
     * @return
     */
    public List<IotPatientDeviceVO> createRepairDevice(String deviceSn, Integer status, String damageDescription, String damageImages, String repairDescription) {
        List<IotPatientDeviceDO> patientDeviceDOList = iotPatientDeviceDao.findByDeviceSn(deviceSn);
        for(IotPatientDeviceDO patientDeviceDO : patientDeviceDOList){
            patientDeviceDO.setStatus(status);
            if(StringUtils.isNotBlank(damageDescription)) {
                patientDeviceDO.setDamageDescription(damageDescription);
            }
            if(StringUtils.isNotBlank(damageImages)) {
                patientDeviceDO.setDamageImages(damageImages);
            }
            if(StringUtils.isNotBlank(repairDescription)) {
                patientDeviceDO.setRepairDescription(repairDescription);
            }
            patientDeviceDO.setUpdateTime(new Date());
        }
        iotPatientDeviceDao.save(patientDeviceDOList);
        List<IotPatientDeviceVO> patientDeviceVOS = new ArrayList<>();
        return convertToModels(patientDeviceDOList, patientDeviceVOS, IotPatientDeviceVO.class);
    }
    /**
     * 根据设备码获取相关厂商信息
     * @param deviceSn
     * @return
     */
    public List<IotPatientDeviceVO> getDeviceInfoByDeviceSn(String deviceSn) {
        String sql = "SELECT p.id,p.device_sn,p.device_id,p.device_name, GROUP_CONCAT(p.patient_name) as patientName,p.idcard,p.mobile,d.manufacturer_id, c.`name` manufacturerName,c.contacts_name, c.contacts_mobile " +
                "FROM `iot_patient_device` p, iot_device d LEFT JOIN iot_company c on d.manufacturer_id = c.id and c.status = 1 " +
                "where p.device_sn = '" + deviceSn + "' and p.del =  1 and p.device_id= d.id GROUP BY p.device_sn ";
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        return list;
    }
    /**
     * 获取设备维修记录
     * @param deviceSn
     * @param status
     * @param manufacturerId
     * @param page
     * @param pageSize
     * @return
     */
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> getRepairDeviceList(String deviceSn, Integer status, String manufacturerId, Integer page, Integer pageSize) {
        String sql ="SELECT p.device_sn,p.device_id,p.device_name,GROUP_CONCAT(p.patient_name) as patientName,p.idcard,p.mobile,p.`status`,p.damage_description,p.damage_images,p.repair_description,d.manufacturer_id, c.`name` manufacturerName,c.contacts_name, c.contacts_mobile " +
                "FROM `iot_patient_device` p, iot_device d LEFT JOIN iot_company c on d.manufacturer_id = c.id and c.status = 1 " +
                "where  p.del =  1 and p.`status` is not null and p.`status` > 0 and p.device_id= d.id ";
        if(StringUtils.isNotBlank(deviceSn)){
            sql += " and p.device_sn like '%" + deviceSn + "%' ";
        }
        if(StringUtils.isNotBlank(manufacturerId)){
            sql +=" and d.manufacturer_id = '" +manufacturerId + "' ";
        }
        if(status != null){
            sql += " and p.status = " +status;
        }else if(StringUtils.isNotBlank(manufacturerId)){
            sql +=" and p.status in (2,3,4) ";//厂商只展示三种维修状态
        }
        sql +=" GROUP BY p.device_sn ORDER BY p.update_time desc ";
        if (page != null && pageSize != null) {
            String sqlCount = "SELECT count(DISTINCT p.device_sn) " + sql.substring(sql.indexOf("FROM"), sql.length());
            Long count = jdbcTemplate.queryForObject(sqlCount, Long.class);
            sql += "limit " +(page-1)* pageSize + "," +pageSize;
            List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Device.message_success_find, list,page, pageSize,count);
        }
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        return MixEnvelop.getSuccessList(IotRequestMapping.Device.message_success_find, list);
    }
    public void deleteRepairDevice(String deviceSn) {
        List<IotPatientDeviceDO> patientDeviceDOList = iotPatientDeviceDao.findByDeviceSn(deviceSn);
        for(IotPatientDeviceDO patientDeviceDO : patientDeviceDOList){
            patientDeviceDO.setStatus(0);
            patientDeviceDO.setUpdateTime(new Date());
        }
        iotPatientDeviceDao.save(patientDeviceDOList);
    }
    @Transactional
    public void delPatientDevice(String id, Integer del) {
        IotPatientDeviceDO patientDeviceDO = iotPatientDeviceDao.findOne(id);
        patientDeviceDO.setDel(del);
        iotPatientDeviceDao.save(patientDeviceDO);
        //更新设备绑定状态,加库存
        iotDeviceDao.updateIsGrantById(patientDeviceDO.getDeviceId(), 0);
        if(del == -1){
            //核销设备
            iotDeviceDao.updateDelById(patientDeviceDO.getDeviceId(), 0);
        }
    }
    public MixEnvelop<IotPatientDeviceVO,IotPatientDeviceVO> getOverhaulDeviceList(String deviceSn, String patientName, Integer page, Integer pageSize) {
        String sql = "SELECT DISTINCT d.* FROM `iot_patient_device` d , iot_device_overhaul o where d.del= 1 and  d.id = o.patient_device_id ";
        if(StringUtils.isNotBlank(deviceSn)){
            sql += "and d.device_sn like '%" + deviceSn + "'% ";
        }
        if(StringUtils.isNotBlank(patientName)){
            sql += "and d.patientName like '%" + patientName + "'% ";
        }
        //判断是否需要分页
        if (page != null && pageSize != null) {
            Long count = Long.valueOf(jdbcTempalte.queryForList(sql).size());
            sql += "limit " + (page - 1) * pageSize + "," + pageSize;
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, deviceVOList, page, pageSize, count);
        } else {
            List<IotPatientDeviceVO> deviceVOList = jdbcTempalte.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            return MixEnvelop.getSuccessList(IotRequestMapping.Common.message_success_find, deviceVOList);
        }
    }
}

+ 10 - 10
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java

@ -51,18 +51,18 @@ public class IotSystemDictService extends BaseJpaService<IotSystemDictDO,IotSyst
                dictDO.setValue(value);
                dictDO.setParentCode(parentCode);
                dictDO.setUpdateTime(new Date());
            }
        }else {
            //获取最近一条添加记录的code
            List<IotSystemDictDO> dictDOList = iotSystemDictDao.getAllByDictNameAndOrderByCodeDesc(dictDO.getDictName());
            if (dictDOList.size() > 0) {
                dictDO.setCode((Long.parseLong(dictDOList.get(0).getCode()) + 1) + "");
            } else {
                //获取最近一条添加记录的code
                List<IotSystemDictDO> dictDOList = iotSystemDictDao.getAllByDictNameAndOrderByCodeDesc(dictDO.getDictName());
                if (dictDOList.size() > 0) {
                    dictDO.setCode((Long.parseLong(dictDOList.get(0).getCode()) + 1) + "");
                } else {
                    dictDO.setCode("1");
                }
                dictDO.setSaasId(getCode());
                dictDO.setDel(1);
                dictDO.setCreateTime(new Date());
                dictDO.setCode("1");
            }
            dictDO.setSaasId(getCode());
            dictDO.setDel(1);
            dictDO.setCreateTime(new Date());
        }
        iotSystemDictDao.save(dictDO);
        return dictDO;

+ 75 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotCompanyAppInterfaceService.java

@ -0,0 +1,75 @@
package com.yihu.iot.service.platform;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.platform.IotCompanyAppInterfaceDao;
import com.yihu.iot.dao.platform.IotShareInterfaceDao;
import com.yihu.jw.entity.iot.platform.IotCompanyAppInterfaceDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.platform.IotAppInterfacesVO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/4/30
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class IotCompanyAppInterfaceService extends BaseJpaService<IotCompanyAppInterfaceDO, IotCompanyAppInterfaceDao> {
    @Autowired
    private IotCompanyAppInterfaceDao iotCompanyAppInterfaceDao;
    @Autowired
    private IotShareInterfaceDao iotShareInterfaceDao;
    /**
     * 分配接口
     * @param jsonData
     */
    public void allotInterface(String jsonData, List<String> ids) {
        ids.forEach(one->{
            IotCompanyAppInterfaceDO iotCompanyAppInterfaceDO = JSONObject.parseObject(jsonData, IotCompanyAppInterfaceDO.class);
            iotCompanyAppInterfaceDO.setShareInterfaceId(one);
            iotCompanyAppInterfaceDO.setDel("0");
            iotCompanyAppInterfaceDao.save(iotCompanyAppInterfaceDO);
        });
    }
    /**
     * 查看应用接口
     * @param appId
     * @return
     */
    public List<IotAppInterfacesVO> findAppInterface(String appId) {
        List<IotCompanyAppInterfaceDO> appInterfaceDOS = iotCompanyAppInterfaceDao.findByAppId(appId);
        List<IotAppInterfacesVO> list = new ArrayList<>();
        appInterfaceDOS.forEach(one->{
            IotAppInterfacesVO appInterfacesVO = new IotAppInterfacesVO();
            String shareInterfaceId = one.getShareInterfaceId();
            IotShareInterfaceDO shareInterfaceDO = iotShareInterfaceDao.findOne(shareInterfaceId);
            appInterfacesVO.setAppName(one.getAppName());
            appInterfacesVO.setIotShareInterfaceDO(shareInterfaceDO);
            list.add(appInterfacesVO);
        });
        return list;
    }
}

+ 215 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceAuditService.java

@ -0,0 +1,215 @@
package com.yihu.iot.service.platform;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.company.IotCompanyDao;
import com.yihu.iot.dao.platform.*;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.platform.*;
import com.yihu.jw.restmodel.iot.platform.IotInterfaceAuditVO;
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 io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/5/6
 */
@Service
@Transactional
public class IotInterfaceAuditService  extends BaseJpaService<IotInterfaceAuditDO, IotInterfaceAuditDao>  {
    @Autowired
    private IotInterfaceAuditDao  iotInterfaceAuditDao;
    @Autowired
    private IotInterfaceAuditDetailDao  iotInterfaceAuditDetailDao;
    @Autowired
    private IotShareInterfaceDao iotShareInterfaceDao;
    @Autowired
    private IotCompanyDao iotCompanyDao;
    @Autowired
    private IotCompanyAppInterfaceDao iotCompanyAppInterfaceDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 应用接口申请
     * @param json
     */
    public void addInterfaceApplyFor(String json, List<String> ids) {
        IotInterfaceAuditDO iotInterfaceAuditDO = JSONObject.parseObject(json, IotInterfaceAuditDO.class);
        iotInterfaceAuditDO.setTime(DateUtil.getNowDate());
        iotInterfaceAuditDao.save(iotInterfaceAuditDO);
        ids.forEach(one->{
            IotInterfaceAuditDetailDO iotInterfaceAuditDetailDO = new IotInterfaceAuditDetailDO();
            iotInterfaceAuditDetailDO.setInterfaceId(iotInterfaceAuditDO.getId());
            iotInterfaceAuditDetailDO.setShareInterfaceId(one);
            //获取共享接口信息,并存储到审核临时表中
            IotShareInterfaceDO shareInterfaceDO = iotShareInterfaceDao.findById(one);
            iotInterfaceAuditDetailDO.setInterfaceName(shareInterfaceDO.getInterfaceName());
            iotInterfaceAuditDetailDO.setMethodName(shareInterfaceDO.getMethodName());
            iotInterfaceAuditDetailDO.setExplanation(shareInterfaceDO.getExplanation());
            iotInterfaceAuditDetailDO.setTypeName(shareInterfaceDO.getTypeName());
            iotInterfaceAuditDetailDao.save(iotInterfaceAuditDetailDO);
        });
    }
    /**
     * 查看应用申请接口信息
     * @param id
     * @return
     */
    public IotInterfaceAuditVO findInterfaceApplyFor(String id) {
        IotInterfaceAuditVO iotInterfaceAuditVO = new IotInterfaceAuditVO();
        IotInterfaceAuditDO auditDO = iotInterfaceAuditDao.findOne(id);
        //获取联系人姓名与电话
        IotCompanyDO company = iotCompanyDao.findOne(auditDO.getCompanyId());
        auditDO.setContactsName(company.getContactsName());
        auditDO.setContactsMobile(company.getContactsMobile());
        List<IotInterfaceAuditDetailDO> list = iotInterfaceAuditDetailDao.findByInterfaceId(id);
        iotInterfaceAuditVO.setIotInterfaceAuditDO(auditDO);
        iotInterfaceAuditVO.setIotInterfaceAuditDetailDOList(list);
        return iotInterfaceAuditVO;
    }
    /**
     * 分页查找所有应用申请信息
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> findAllApplyFor(Integer page, Integer size) {
        String sql="SELECT DISTINCT * FROM iot_interface_audit ORDER BY time DESC;";
        List<IotInterfaceAuditDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotInterfaceAuditDO.class));
        list.forEach(one->{
            IotCompanyDO company = iotCompanyDao.findOne(one.getCompanyId());
            one.setContactsName(company.getContactsName());
            one.setContactsMobile(company.getContactsMobile());
        });
        //获取总数
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,list,page, size,count);
    }
    /**
     * 接口审核通过
     * @param id
     * @return
     */
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> auditPass(String id) {
        IotInterfaceAuditDO auditDO = iotInterfaceAuditDao.findOne(id);
        if (auditDO==null)
        {
            return MixEnvelop.getError("审核操作失败,无该应用");
        }
        //删除之前的所有应用接口 已审核通过的为最新接口
        List<IotCompanyAppInterfaceDO> appInterfaceDOList = iotCompanyAppInterfaceDao.findByAppId(auditDO.getAppId());
        appInterfaceDOList.forEach(one->{
            iotCompanyAppInterfaceDao.delete(one.getId());
        });
        //获取共享接口数组并分配接口给应用
        List<IotInterfaceAuditDetailDO> ids = iotInterfaceAuditDetailDao.findByInterfaceId(auditDO.getId());
        ids.forEach(one->{
            IotCompanyAppInterfaceDO appInterfaceDO = new IotCompanyAppInterfaceDO();
            appInterfaceDO.setShareInterfaceId(one.getShareInterfaceId());
            appInterfaceDO.setAppId(auditDO.getAppId());
            appInterfaceDO.setAppName(auditDO.getAppName());
            appInterfaceDO.setCompanyId(auditDO.getCompanyId());
            appInterfaceDO.setCompanyName(auditDO.getCompanyName());
            appInterfaceDO.setDel("0");
            iotCompanyAppInterfaceDao.save(appInterfaceDO);
        });
        auditDO.setStatus("1");
        auditDO.setAuditTime(DateUtil.getNowDate());
        iotInterfaceAuditDao.save(auditDO);
        return MixEnvelop.getSuccess(IotRequestMapping.InterfaceAudit.message_success_audit);
    }
    /**
     * 接口审核不通过
     * @param id
     * @return
     */
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> auditNoPass(String id,String msg) {
        IotInterfaceAuditDO auditDO = iotInterfaceAuditDao.findOne(id);
        if (auditDO==null)
        {
            return MixEnvelop.getError("审核操作失败,无该应用");
        }
        auditDO.setStatus("0");
        auditDO.setRefuseExplain(msg);
        auditDO.setAuditTime(DateUtil.getNowDate());
        iotInterfaceAuditDao.save(auditDO);
        return MixEnvelop.getSuccess(IotRequestMapping.InterfaceAudit.message_success_audit);
    }
    /**
     * 分页查询接口申请信息
     * @param companyName
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotInterfaceAuditDO, IotInterfaceAuditDO> conditionQueryPage(String companyName, Integer page, Integer size) throws ParseException {
        StringBuffer sql = new StringBuffer("SELECT DISTINCT * from iot_interface_audit ");
        if (StringUtils.isNotBlank(companyName)){
            sql.append("WHERE company_name like'%").append(companyName).append("%'");
        }
        sql.append("order by time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotInterfaceAuditDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotInterfaceAuditDO.class));
        list.forEach(one->{
            IotCompanyDO company = iotCompanyDao.findOne(one.getCompanyId());
            one.setContactsName(company.getContactsName());
            one.setContactsMobile(company.getContactsMobile());
        });
        //获取总数
        long count = list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,list,page, size,count);
    }
}

+ 72 - 5
svr/svr-iot/src/main/java/com/yihu/iot/service/workType/IotWorkTypeService.java

@ -2,12 +2,26 @@ package com.yihu.iot.service.workType;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.workType.IotWorkTypeDao;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceLogDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
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.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @author HZY
 * @vsrsion 1.0
@ -50,24 +64,77 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
     * 根据ID删除业务类型
     * @param id
     */
    public void deleteType(String id) {
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> deleteType(String id) {
        IotWorkTypeDO type = iotWorkTypeDao.findOne(id);
        if(type.getDel().equalsIgnoreCase("1")){
            throw new RuntimeException("改类型已删除,请勿重复操作");
            return MixEnvelop.getError("该企业已删除,请勿重复删除");
        }
        type.setDel("1");
        iotWorkTypeDao.save(type);
        return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_delete);
    }
    /**
     * 根据ID查找业务类型
     * @param id
     */
    public IotWorkTypeDO findType(String id) {
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> findType(String id) {
        IotWorkTypeDO type = iotWorkTypeDao.findById(id);
        if(type==null){
            throw  new RuntimeException("无该类型");
           return MixEnvelop.getError("无该企业");
        }
        return type;
        return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_find,type);
    }
    /**
     * 分页查询日志信息
     * @param page
     * @param size
     * @return
     * @throws ParseException
     */
    public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> findAll(Integer page, Integer size) throws ParseException {
        String sql = "select * from iot_work_type w where w.del=0;";
        List<IotWorkTypeDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotWorkTypeDO.class));
        long count =list.size();
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.WorkType.message_success_find,list,page, size,count);
    }
    /**
     * 条件分页查询所有
     * @param page
     * @param size
     * @param type
     * @param explanation
     * @return
     */
    public MixEnvelop<IotWorkTypeDO, IotWorkTypeDO> conditionQueryPage(Integer page, Integer size, String type, String explanation){
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_work_type c  WHERE c.del=0 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_work_type c  WHERE c.del=0 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(type)){
            sql.append(" and c.name like ? ");
            sqlCount.append(" and c.name like '%").append(type).append("%' ");
            args.add("%" + type + "%");
        }
        if(StringUtils.isNotBlank(explanation)){
            sql.append(" and c.explanation like '%").append(explanation).append("%'");
            sqlCount.append(" and c.explanation like '%").append(explanation).append("%'");
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotWorkTypeDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotWorkTypeDO.class));
        List<Map<String,Object>> countList = jdbcTemplate.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,list, page, size,count);
    }
}

+ 19 - 0
svr/svr-iot/src/main/resources/application.yml

@ -115,6 +115,25 @@ fast-dfs:
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
---
spring:
  profiles: iottest
  datasource:
    url: jdbc:mysql://172.26.0.104/xmiot?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg@jkzl2019
  elasticsearch:
    cluster-name: jkzl #默认即为elasticsearch  集群名
    cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    jest:
      uris: http://172.19.103.45:9200,http://172.19.103.68:9200
  wlyy:
    url: http://ehr.yihu.com/wlyy/
fast-dfs:
  tracker-server: 172.19.103.54:22122 #服务器地址
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
---
spring:
  profiles: jwprod

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

@ -1,3 +1,92 @@
spring:
  application:
    name: svr-iot-shw #注册到发现服务的id 如果id一样 eurika会自动做负载
    name:  svr-iot
  cloud:
    config:
      failFast: true
      username: jw
      password: jkzl
---
spring:
  profiles: jwdev
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: jwtest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: iottest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.109:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: qytest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: jwprod
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.0.33.26:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: local
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.131.174:1221}
      label: ${wlyy.spring.config.label:local}
---
spring:
  profiles: jwprod70
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.16.1.70:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: jwOracleTest
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: jwOracleProd
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://192.168.33.199:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: xzprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://172.16.100.63:1221}
      label: ${wlyy.spring.config.label:master}
---
spring:
  profiles: xmjwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://192.168.120.210:1221}
      label: ${wlyy.spring.config.label:master}