Просмотр исходного кода

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

humingfen 5 лет назад
Родитель
Сommit
be95ead436
27 измененных файлов с 502 добавлено и 154 удалено
  1. 3 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 208 52
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  3. 3 2
      business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java
  4. 73 8
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  5. 7 7
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  6. 2 2
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  7. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwGhmxDO.java
  8. 14 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java
  9. 20 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotSystemDictDO.java
  10. 6 6
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/message/IotMessageDO.java
  11. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  12. 24 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceQualityInspectionPlanVO.java
  13. 15 0
      common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java
  14. 6 2
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  15. 1 1
      svr/svr-internet-hospital-job/src/main/resources/application.yml
  16. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  17. 31 31
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/expressage/DoctorExpressageEndpoint.java
  18. 12 3
      svr/svr-iot-job/src/main/java/com/yihu/jw/service/channel/DeviceQualityPlanService.java
  19. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java
  20. 12 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceOrderController.java
  21. 6 6
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceQualityController.java
  22. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceSimController.java
  23. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceQualityInspectionPlanDao.java
  24. 4 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotOrderPurchaseDao.java
  25. 16 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java
  26. 22 20
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceQualityInspectionPlanService.java
  27. 11 8
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceSimService.java

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

@ -1929,15 +1929,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            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());
                ykyyEntranceService.findByRealOrder(prescription.getId());
                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findById(prescription.getId());
                businessOrderService.savePrescriptionOrder(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;

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

@ -965,7 +965,7 @@ public class YkyyEntranceService {
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tsfzh.sfzh = '"+idcard+"' ";
                "\tx.sfzh = '"+idcard+"' ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
@ -1049,7 +1049,7 @@ public class YkyyEntranceService {
                wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
            }
            //诊断
            synPrescriptionDiagnosis(prescriptionVO);
            synPrescriptionDiagnosis(prescriptionVO,code);
            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            synPrecriptionHis(prescriptionVO,code);
@ -1059,12 +1059,83 @@ public class YkyyEntranceService {
    }
    /**
     * 根据身份证查找his医生
     * @param idcard
     * @return
     * @throws Exception
     */
    public JSONArray findHisDoctor(String idcard) throws Exception{
        String sql ="select y.code AS \"code\",y.ygbh,y.name AS \"name\",y.expertise AS \"expertise\",y.introduce AS \"introduce\",y.mobile AS \"mobile\",y.idCard AS \"idcard\",y.jobtitlecode AS \"jobTitleCode\",y.jobTitleName AS \"jobTitleName\",y.dept AS \"dept\",y.deptName AS \"deptName\" from v_Hlw_Ysxx y where y.idcard ='"+idcard+"'";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    /**
     * 根据his Icd10
     * @param code
     * @return
     * @throws Exception
     */
    public JSONArray findHisIcd10(String code) throws Exception{
        String sql ="select v.code,v.name,v.flag from V_HLW_ICD10 v WHERE v.code = '"+code.trim()+"'";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("sql:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    /**
     * 查找挂号明细
     * @param patient
     * @param doctor
     * @return
     * @throws Exception
     */
    public JSONArray fingHlwGhmx(String patient,String doctor) throws Exception{
        String sql = "select v.SBXH,to_char(v.ghsj,'yyyy-mm-dd hh24:mi:ss') as GHSJ from v_hlw_ghmx v where v.brid = '"+patient+"' and v.ysdm =" +
                " '"+doctor+"' and v.ghsj > to_date('"+DateUtil.dateToStrLong(DateUtil.getToday())+"','yyyy-MM-dd HH24:mi:ss')";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("sql:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    /**
     * 诊断
     * @param wlyyPrescriptionVO
     */
    public void synPrescriptionDiagnosis(WlyyPrescriptionVO wlyyPrescriptionVO) throws Exception{
    public void synPrescriptionDiagnosis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception{
        String doctor = wlyyPrescriptionVO.getDoctor();
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        String patient = wlyyPrescriptionVO.getPatientCode();
@ -1074,7 +1145,6 @@ public class YkyyEntranceService {
        //挂号明细表HLW_GHMX
        HlwGhmxDO hlwGhmxDO = new HlwGhmxDO();
        hlwGhmxDO.setSBXH(0);
        hlwGhmxDO.setJZXH(1);
        hlwGhmxDO.setGHCS(1);
        hlwGhmxDO.setGHJE(0);
        hlwGhmxDO.setZLJE(0);
@ -1091,64 +1161,148 @@ public class YkyyEntranceService {
        hlwGhmxDO.setYSPB(0);
        hlwGhmxDO.setSFFS(0);
        hlwGhmxDO.setJZZT(2);
        if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
            hlwGhmxDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
        }
        hlwGhmxDO.setJZXH(0);
        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同步成功!");
        hlwGhmxDO.setGHSJ(new Date());//挂号时间
        hlwGhmxDO.setGHLB(1);//挂号类别
        hlwGhmxDO.setYSDM(doctorMappingDO.getMappingCode());//医生代码
        hlwGhmxDO.setJZYS(doctorMappingDO.getMappingCode());//接诊医生
        //病人性质
        JSONArray jsonArray = findHisPatient(patientMappingDO.getIdcard());
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
            hlwGhmxDO.setBRXZ(json.getInteger("brxz"));
        }
        //就诊历史表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()));
        //操作工号
        JSONArray jsonArray1 = findHisDoctor(doctorMappingDO.getIdcard());
        if(jsonArray1!=null&&jsonArray1.size()>0){
            //获取医生信息
            JSONObject json = jsonArray1.getJSONObject(0);
            hlwGhmxDO.setCZGH(json.getString("YGBH"));
        }
        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同步成功!");
        // 同一个医生同一个病人,一天一条挂号记录。
        JSONArray ja = fingHlwGhmx(patientMappingDO.getMappingCode(),doctorMappingDO.getMappingCode());
        if(ja!=null&&ja.size()>0){
            //更新
            JSONObject json = ja.getJSONObject(0);
            hlwGhmxDO.setSBXH(json.getInteger("SBXH"));
            hlwGhmxDO.setGHSJ(DateUtil.strToDate(json.getString("GHSJ")));
            GHXH = json.getInteger("SBXH");
            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(updateEntityUrl,params);
            if (response.getStatus()==200){
                logger.info("content"+response.getContent());
                logger.info("表hlwGhmxDo更新成功!");
            }else {
                logger.info("表hlwGhmxDo更新失败!"+response.getErrorMsg());
            }
        }else{
            //新增
            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新增成功!");
            }
        }
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(wlyyPrescriptionVO.getId());
        for (WlyyPrescriptionDiagnosisDO diagnosisDO : diagnosisDOs){
        Integer icd10Flag = 0;
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(code);
        if(diagnosisDOs!=null&&diagnosisDOs.size()>0){
            WlyyPrescriptionDiagnosisDO diagnosisDO = diagnosisDOs.get(0);
            //就诊历史表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.setJSSJ(DateUtil.getNight23());
            hlwYsMzJzLsDO.setJZZT(9);
            hlwYsMzJzLsDO.setJZLX(3);//就诊类型
            hlwYsMzJzLsDO.setZDMC(diagnosisDO.getName());
            hlwYsMzJzLsDO.setMQZD(diagnosisDO.getName());
            if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
            }
            //V_HLW_ICD10.FLAG
            JSONArray jsonArray2 = findHisIcd10(diagnosisDO.getCode());
            if(jsonArray2!=null&&jsonArray2.size()>0){
                //获取居民信息
                JSONObject json = jsonArray2.getJSONObject(0);
                icd10Flag = json.getInteger("FLAG");
            }
            hlwYsMzJzLsDO.setZYZD(icd10Flag);
            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){
                String content = response2.getContent();
                logger.info("content"+content);
                //获取就诊序号,更新处方表数据
                JSONObject jsonObject = JSONObject.parseObject(content);
                JSONObject object = jsonObject.getJSONObject("obj");
                if (object!=null){
                    Integer jzxh = object.getInteger("jzxh");
                    wlyyPrescriptionVO.setAdmNo(jzxh+"");
                    logger.info("JZXH=========="+jzxh);
                    List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
                    if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                        WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                        wlyyPrescriptionDO.setAdmNo(jzxh+"");
                        prescriptionDao.save(wlyyPrescriptionDO);
                    }
                }
                logger.info("表hlwYsMzJzLsDO同步成功!");
            }
            //疾病诊断表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());
            hlwYsMzJbzdDO.setJBBH(icd10Flag);
            hlwYsMzJbzdDO.setBRBH(Integer.valueOf(patientMappingDO.getMappingCode()));
            hlwYsMzJbzdDO.setZDLB(11);//诊断类别
            hlwYsMzJbzdDO.setZDSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//诊断时间
            hlwYsMzJbzdDO.setZFPB(0);//作废标志
            hlwYsMzJbzdDO.setQZBZ(0);//确诊标志
            hlwYsMzJbzdDO.setQZSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//确诊时间
            hlwYsMzJbzdDO.setJBMC(diagnosisDO.getName());//诊断名称
            hlwYsMzJbzdDO.setZDLX(1);//诊断类型
            hlwYsMzJbzdDO.setTJBZ(1);//提交标志
            if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                hlwYsMzJbzdDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
            }
            String jsonString1 = JSONObject.toJSONString(hlwYsMzJbzdDO);
            Map<String,Object> params1 = new HashedMap();
            params1.put("json",jsonString1);
@ -1156,11 +1310,12 @@ public class YkyyEntranceService {
            logger.info("HlwYsMzJbzdDO:"+jsonString1);
            HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
            if (response1.getStatus()==200){
                logger.info("content"+response1.getContent());
                String content = response1.getContent();
                logger.info("content"+content);
                logger.info("表hlwYsMzJbzdDO同步成功!");
            }
        }
    }
    public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception {
@ -1240,6 +1395,7 @@ public class YkyyEntranceService {
                            if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                                WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                                wlyyPrescriptionDO.setRealOrder(cfsb);
                                wlyyPrescriptionDO.setOrderId(hlwCf01DO.getGUID());
                                wlyyPrescriptionDO.setOriginRealOrder(cfhm);
                                prescriptionDao.save(wlyyPrescriptionDO);
                            }

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

@ -331,11 +331,12 @@ public class YkyyService {
     * @return
     */
    public String addOrder4Jkzl(String drugType,String orderId,String userId,JSONArray array ){
    public String addOrder4Jkzl(String drugType,String orderId,String orderNo,String userId,JSONArray array ){
        String response="";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("drugType",drugType);//药品类型【1,到院 2、到商城】
        jsonObject.put("orderId","");//订单Id
        jsonObject.put("orderId",orderId);//订单Id
        jsonObject.put("orderNo",orderNo);//订单号
        jsonObject.put("userId",userId);//用户Id
        jsonObject.put("Shopping",array);//药品列表
        String url = "http://www.yanketong.com:90/api/Doctor/AddOrder4Jkzl";

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

@ -139,6 +139,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
        getBaseSurperviseDict();
        WsapiProxy proxy = new WsapiProxy();
        proxy.setEndpoint(url);
        logger.info("入参:"+JSONUtils.toString(params));
        Wsapi wsapi = proxy.getWsapi();
//        logger.info("postToInter:"+JSONUtils.toString(new String[] {token, params.toString()}));
@ -188,11 +189,12 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
    // 2  医院基本信息	micc.upNsOrganBas     --- 完成
    public String upNsOrganBas() throws Exception {
        logger.info("开始进入==============");
        getBaseSurperviseDict();
        BaseSuperviseDataDict superviseDataDict = superviseDataDictDao.selectByDictName();
        String url = getUrl();
        String api = "micc.upNsOrganBase";
        logger.info("开始进入++++++++"+superviseDataDict.getDictName());
        JSONObject jb = new JSONObject();
        jb.put("organ_code", orgCode);
        jb.put("organ_name",orgName);
@ -289,8 +291,6 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
        JSONArray jsonArray = new JSONArray();
        jsonArray.add(jb);
        logger.info("入参:"+jsonArray.toJSONString()+"入参:"+jb.toJSONString());
        String token = upNsUserToken(url);
        String res = postToInter(token, api, jsonArray,url);
@ -795,10 +795,10 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                    "\tM.content AS \"content\",\n" +
                    "\tM.content_type AS \"content_type\",\n" +
                    "\tT.id AS \"id\",\n" +
                    "\tM.sender_id AS \"session_id\"\n" +
                    "\tM.session_id AS \"session_id\"\n" +
                    "FROM\n" +
                    "\t"+base+".topics T\n" +
                    "JOIN "+base+".muc_messages M ON M.sender_id = T.session_id\n" +
                    "JOIN "+base+".muc_messages M ON M.session_id = T.session_id\n" +
                    "AND M.timestamp >= T.create_time\n" +
                    "AND M.timestamp <= T.end_time\n" +
                    "AND T.id='"+info.get("consult").toString()+"' "+
@ -828,9 +828,21 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                        object.put("receiver",patientDO.getName());
                    }
                }
                String msg = "";
                String msgType = "";
                if (map.get("content_type").toString().equalsIgnoreCase("2")){
                    msg = consultUpNsOnlineImg(map.get("content").toString(),map.get("id").toString());
                    msgType = "1";
                }else if (map.get("content_type").toString().equalsIgnoreCase("1")){
                    msg = map.get("content").toString();
                    msgType = "0";
                }else {
                    msg = map.get("content").toString();
                    msgType = map.get("content_type").toString();
                }
                object.put("sender",map.get("sender_name"));
                object.put("msg",map.get("content"));
                object.put("msg_type",map.get("content_type"));
                object.put("msg",msg);
                object.put("msg_type",msgType);
                object.put("send_time",DateUtil.dateToStr(DateUtil.strToDate(map.get("timestamp").toString(),"yyyy-MM-dd HH:mm:ss"),"yyyy-MM-dd HH:mm:ss"));
                array.add(object);
            }
@ -1285,7 +1297,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                jb.put("drug_use", info.get("supply_code") == null? "0": info.get("supply_code"));
                jb.put("standard_desc", info.get("specification") == null? "0": info.get("specification"));
                jb.put("single_price",info.get("pack_retprice") == null? 0: info.get("pack_retprice"));
                BigDecimal pack_retprice = (BigDecimal)info.get("pack_retprice");
                Double pack_retprice = Double.parseDouble(info.get("pack_retprice").toString());
                Long quantity = Long.parseLong((String)info.get("quantity"));
                Double price = pack_retprice.doubleValue()*quantity;
@ -1825,4 +1837,57 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
    public String testImg(String path){
        return ImgUtils.getImageStr(path);
    }
    public String consultUpNsOnlineImg(String imgPath,String consult) throws Exception {
        String msgCode = "";
        getBaseSurperviseDict();
        String url = getUrl();
        String api = "micc.upNsOnlineImg";
        String upid = getCode();
        String token = upNsUserToken(url);
        String res = "";
        int total = 0;
        int success = 0;
        int error = 0;
        int dataError = 0;
        JSONObject jb = new JSONObject();
        Boolean errorFlag = false;
        String code  = getCode();
        try {
            jb.put("id_online_img",code);
            jb.put("id_onlne_base", orgCode+"_"+consult);
            jb.put("online_type","1");
            String base64 =getImg(imgPath);
            jb.put("img_path",base64);
            jb.put("img_sort", 1);
            jb.put("upload_time", DateUtil.dateToStr(new Date(),"yyyy-MM-dd hh:mm:ss"));
        }catch (Exception e){
            errorFlag = true;
            saveErrorLog(upid,"12",consult,res,1);
            dataError++;
            logger.error(e.toString());
        }
        if(!errorFlag){
            JSONArray jsonArray = new JSONArray();
            jsonArray.add(jb);
            res = postToInter(token,api, jsonArray,url);
            JSONObject resJson = (JSONObject) JSONObject.parse(res);
            if("200".equals(resJson.get("msg").toString())){
                msgCode = code;
                success++;
            }else{
                saveErrorLog(upid,"12",imgPath,res,2);
                error++;
            }
        }
        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。";
        saveUpLog(upid,"12",new Date(),new Date(),success,error,dataError,resInfo);
        return msgCode;
    }
}

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

@ -115,7 +115,7 @@ public class BusinessOrderService {
                businessOrderDO.setCreateTime(new Date());
                businessOrderDO.setUpdateTime(new Date());
                businessOrderDO.setStatus(0);
                businessOrderDO.setOrderNo("VAS4"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
                businessOrderDO.setOrderNo("HLWLYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
                businessOrderDO.setUploadStatus(0);
                businessOrderDO.setPayType(1);
                businessOrderDO.setRelationCode(code);
@ -161,7 +161,7 @@ public class BusinessOrderService {
                if (patientDO!=null){
                    userId = patientDO.getUserId();
                }
                String response = ykyyService.addOrder4Jkzl("1","",userId,array);
                String response = ykyyService.addOrder4Jkzl("1",wlyyPrescriptionDO.getOrderId(),businessOrderDO.getOrderNo(),userId,array);
                if (StringUtils.isNoneBlank(response)){
                    JSONObject jsonObject = JSONObject.parseObject(response);
                    if (jsonObject.getString("code").equalsIgnoreCase("10000")){
@ -188,15 +188,15 @@ public class BusinessOrderService {
        businessOrderDO.setCreateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(0);
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        businessOrderDO.setOrderNo("HLWLYY"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        businessOrderDO.setUploadStatus(0);
        businessOrderDO.setPayType(1);
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/onlineChat/zjzx");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/doctor/consult");
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/yk/consult/record?consultCode="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/yk/consult/record?consultCode="+businessOrderDO.getRelationCode()+"&verifyCode=");
        }else {
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/onlineChat/twzs");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/doctor/review");
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/yk/consult/record?outpatientId="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/yk/consult/record?outpatientId="+businessOrderDO.getRelationCode()+"&verifyCode=");
        }
        List<WlyyHospitalSysDictDO> hospitalSysDictDOS = hospitalSysDictDao.findByDictName("WX_MONEY");
        String totalFee = null;

+ 2 - 2
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -1862,7 +1862,7 @@ public class ImService {
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(sql);
		Long count = 0L;
		if (rstotal != null && rstotal.size() > 0) {
			count = (Long) rstotal.get(0).get("total");
			count = Long.parseLong(rstotal.get(0).get("total").toString());
		}
		
		return count;
@ -2226,7 +2226,7 @@ public class ImService {
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
		Long count = 0L;
		if (rstotal != null && rstotal.size() > 0) {
			count = (Long) rstotal.get(0).get("total");
			count = Long.parseLong(rstotal.get(0).get("total").toString());
		}
		
		return count;

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

@ -91,6 +91,7 @@ public class HlwGhmxDO {
        this.bRXZ = bRXZ;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "GHSJ")
    public Date getGHSJ() {
        return gHSJ;

+ 14 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java

@ -233,6 +233,11 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
     */
    private String orderNo;
    /**
     * 订单id
     */
    private String orderId;
    @Column(name = "outpatient_id")
    public String getOutpatientId() {
        return outpatientId;
@ -568,4 +573,13 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
    @Column(name = "order_id")
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
}

+ 20 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotSystemDictDO.java

@ -32,6 +32,10 @@ public class IotSystemDictDO extends UuidIdentityEntityWithOperator implements S
    private Integer del;//删除标志
    @Column(name = "parent_code")
    private String parentCode;
    @Column(name = "status")
    private Integer status;
    @Column(name = "time")
    private String time;
    @Transient
    private String parentName;//父类字典名称
@ -99,6 +103,22 @@ public class IotSystemDictDO extends UuidIdentityEntityWithOperator implements S
        this.parentCode = parentCode;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getTime() {
        return time;
    }
    public void setTime(String time) {
        this.time = time;
    }
    @Transient
    public String getParentName() {
        return parentName;

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

@ -22,8 +22,8 @@ public class IotMessageDO extends UuidIdentityEntityWithOperator implements Seri
    private String content;//消息内容
    @Column(name = "type")
    private String type;//消息类型 1:SIM卡续费通知 2:库存预警提醒 3:定期检修提醒 4:设备质检提醒',
    @Column(name = "read")
    private String read;//消息状态,1:已读  0:未读',
    @Column(name = "read_msg")
    private String readMsg;//消息状态,1:已读  0:未读',
    @Column(name = "del")
    private String del;//删除标志  1:删除  0:不删除',
    @Column(name = "relation_code")
@ -54,12 +54,12 @@ public class IotMessageDO extends UuidIdentityEntityWithOperator implements Seri
        this.type = type;
    }
    public String getRead() {
        return read;
    public String getReadMsg() {
        return readMsg;
    }
    public void setRead(String read) {
        this.read = read;
    public void setReadMsg(String readMsg) {
        this.readMsg = readMsg;
    }
    public String getDel() {

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

@ -248,6 +248,7 @@ public class IotRequestMapping {
        public static final String delPurchase = "delPurchase";
        public static final String updOrder = "updOrder";
        public static final String createOrder = "createOrder";
        public static final String findAllOrderNo = "findAllOrderNo";
        public static final String findPurcharsePage = "findPurcharsePage";
        public static final String findPurcharseById = "findPurcharseById";

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

@ -6,6 +6,7 @@ import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
import java.io.Serializable;
/**
@ -43,6 +44,13 @@ public class IotDeviceQualityInspectionPlanVO extends BaseVO implements Serializ
    @ApiModelProperty("质检状态(1未检,2已检)")
    private String statusName;
    //新增字段
    @ApiModelProperty("质检图像")
    private String img;//质检图像
    @ApiModelProperty("质检小结")
    private String summary;//质检小结
    public String getPurchaseId() {
        return purchaseId;
    }
@ -138,4 +146,20 @@ public class IotDeviceQualityInspectionPlanVO extends BaseVO implements Serializ
    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }
    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;
    }
}

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

@ -46,6 +46,21 @@ public class DateUtil {
        return formatter.format(date);
    }
    public static Date getNight23(){
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.HOUR_OF_DAY,22);
        return cal.getTime();
    }
    public static Date getToday(){
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.HOUR_OF_DAY,0);
        cal.set(Calendar.MINUTE,0);
        cal.set(Calendar.SECOND,0);
        return cal.getTime();
    }
    /**
     * 字符串转时间格式
     */

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

@ -90,6 +90,10 @@ public class YkyyController extends EnvelopRestEndpoint {
            HlwCf02DO hlwCf02VO =  JSONObject.toJavaObject(object,HlwCf02DO.class);
            ykyyEntranceService.update(hlwCf02VO);
            envelop.setObj(hlwCf02VO);
        }else if(table.equalsIgnoreCase("HlwGhmxDO")){
            HlwGhmxDO hlwGhmxDO =  JSONObject.toJavaObject(object,HlwGhmxDO.class);
            ykyyEntranceService.update(hlwGhmxDO);
            envelop.setObj(hlwGhmxDO);
        }
        return success(envelop);
    }
@ -154,7 +158,7 @@ public class YkyyController extends EnvelopRestEndpoint {
        }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'";
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ys@xec_link where bmc = 'YS_MZ_JBZD'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long jlbh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
@ -182,7 +186,7 @@ public class YkyyController extends EnvelopRestEndpoint {
        }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'";
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ys@xec_link where bmc = 'YS_MZ_JZLS'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long jzxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){

+ 1 - 1
svr/svr-internet-hospital-job/src/main/resources/application.yml

@ -265,7 +265,7 @@ spring:
    password: jkzl@2020
hlwyyEntrance:
  url: http://172.16.100.63:10023
  url: http://192.168.103.150:10023
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false

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

@ -388,7 +388,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		if (data != null) {
			for(Map<String,Object> consult :data){
				//如果是协同门诊,多返回全科医生的详细信息
				if(13 == Integer.parseInt((String)consult.get("type")) && StringUtils.isNoneBlank((String)consult.get("generalDoctor"))){
				if(13 == Integer.parseInt(consult.get("type").toString()) && StringUtils.isNoneBlank((String)consult.get("generalDoctor"))){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById((String)consult.get("generalDoctor"));
					consult.put("generalDoctorName", baseDoctorDO.getName());
				}

Разница между файлами не показана из-за своего большого размера
+ 31 - 31
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/expressage/DoctorExpressageEndpoint.java


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

@ -1,8 +1,10 @@
package com.yihu.jw.service.channel;
import com.yihu.iot.dao.device.IotDeviceQualityInspectionPlanDao;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.dao.message.IotMessageDao;
import com.yihu.jw.entity.iot.device.IotDeviceQualityInspectionPlanDO;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import com.yihu.jw.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -28,18 +30,25 @@ public class DeviceQualityPlanService {
    @Autowired
    private IotDeviceQualityInspectionPlanDao iotDeviceQualityInspectionPlanDao;
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    public void autoPush() {
        IotSystemDictDO qualityRemind = iotSystemDictDao.findByDictName("DEVICE_QUALITY_REMIND").get(0);
        int time = Integer.parseInt(qualityRemind.getTime());
        List<IotDeviceQualityInspectionPlanDO> listAll = iotDeviceQualityInspectionPlanDao.findListAll();
        listAll.forEach(one->{
            Date remindTime = one.getRemindTime();
            Date planTime = one.getPlanTime();
            Date remindTime = DateUtil.getPreDays(planTime, -time);
            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.setContent("订单:"+one.getOrderNo()+"将于:"+remind+"进行质检,请及时维护");
                iotMessageDO.setReadMsg("0");
                iotMessageDO.setDel("0");
                iotMessageDO.setTitle("4");
                iotMessageDao.save(iotMessageDO);

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

@ -74,7 +74,7 @@ public class IotDeviceController extends EnvelopRestEndpoint {
        try {
            Integer re = iotDeviceService.delDevice(id);
            if(re==1){
                return MixEnvelop.getSuccess(IotRequestMapping.Device.message_success_find);
                return MixEnvelop.getSuccess(IotRequestMapping.Device.message_success_delete);
            }else {
                return MixEnvelop.getError(IotRequestMapping.Device.del_message_fail);
            }

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

@ -219,4 +219,16 @@ public class IotDeviceOrderController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceOrder.findAllOrderNo)
    @ApiOperation(value = "查找所有订单编码", notes = "查找所有订单编码")
    public MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> findAllOrderNo() {
        try {
            List<String> list = iotDeviceOrderService.findAllOrderNo();
            return MixEnvelop.getSuccess(IotRequestMapping.DeviceOrder.message_success_find,list);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

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

@ -47,8 +47,8 @@ public class IotDeviceQualityController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = IotRequestMapping.DeviceQuality.findById)
    @ApiOperation(value = "根据code查找设备质检", notes = "根据code查找设备质检")
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> findByCode(@ApiParam(name = "id", value = "id")
    @ApiOperation(value = "根据ID查找设备质检", notes = "根据ID查找设备质检")
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> findByCode(@ApiParam(name = "id", value = "质检ID")
                              @RequestParam(value = "id", required = true) String id
    ) {
        try {
@ -65,8 +65,8 @@ public class IotDeviceQualityController extends EnvelopRestEndpoint {
    @GetMapping(value = IotRequestMapping.DeviceQuality.queryQualityPlanPage)
    @ApiOperation(value = "分页获取设备质检计划", notes = "分页获取设备质检计划")
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> findProductPageByCompanyId(
            @ApiParam(name = "purcharseId", value = "采购id", defaultValue = "")
            @RequestParam(value = "purcharseId", required = false) String purcharseId,
            @ApiParam(name = "status", value = "质检状态", defaultValue = "")
            @RequestParam(value = "status", required = false) String status,
            @ApiParam(name = "orderNo", value = "订单编号", defaultValue = "")
            @RequestParam(value = "orderNo", required = false) String orderNo,
            @ApiParam(name = "startTime", value = "开始时间", defaultValue = "")
@ -116,7 +116,7 @@ public class IotDeviceQualityController extends EnvelopRestEndpoint {
//
//            return Envelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,voList, page, size,count);
            return iotDeviceQualityInspectionPlanService.queryPage(purcharseId, orderNo, startTime, endTime, page, size);
            return iotDeviceQualityInspectionPlanService.queryPage(status, orderNo, startTime, endTime, page, size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -129,7 +129,7 @@ public class IotDeviceQualityController extends EnvelopRestEndpoint {
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            iotDeviceQualityInspectionPlanService.delPlan(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

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

@ -117,7 +117,7 @@ public class IotDeviceSimController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = IotRequestMapping.DeviceSim.remind)
    @ApiOperation(value = "分页查询所有SIM卡信息",notes = "分页查询所有SIM卡信息")
    @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 = "")

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

@ -31,6 +31,6 @@ 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")
    @Query("from IotDeviceQualityInspectionPlanDO w where   w.del=1 ORDER BY w.planTime desc")
    List<IotDeviceQualityInspectionPlanDO> findListAll();
}

+ 4 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotOrderPurchaseDao.java

@ -5,6 +5,9 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
/**
 * @author yeshijie on 2017/12/1.
 */
@ -19,4 +22,5 @@ public interface IotOrderPurchaseDao extends PagingAndSortingRepository<IotOrder
    @Query(value = "SELECT IFNULL(SUM(purchase_num),0)  from iot_order_purchase WHERE order_id =?1 and del = 1 ",nativeQuery = true)
    int sumByOrderId(String orderId);
    IotOrderPurchaseDO findByOrderNo(String orderNo);
}

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

@ -427,4 +427,20 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,iotOrderPurchaseVOList, page, size,count);
    }
    /**
     * 、获取所有订单编码
     * @return
     */
    public List<String> findAllOrderNo() {
        String sql="select a.order_no from iot_order_purchase a where  a.del = 1 GROUP BY a.order_no";
        List<Map<String, Object>> mapList = jdbcTempalte.queryForList(sql);
        ArrayList<String> list = new ArrayList<>();
        mapList.forEach(one->{
            String orderNo = (String) one.get("order_no");
            list.add(orderNo);
        });
        return list;
    }
}

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

@ -5,10 +5,12 @@ 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.dict.IotSystemDictDao;
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.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.message.IotMessageDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceQualityInspectionPlanVO;
@ -48,6 +50,9 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
    @Autowired
    private IotDeviceDao iotDeviceDao;
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    /**
     * 新增
     * @param iotDeviceQualityInspectionPlan
@ -56,7 +61,10 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
    @Transactional
    public IotDeviceQualityInspectionPlanDO create(IotDeviceQualityInspectionPlanDO iotDeviceQualityInspectionPlan) {
        IotOrderPurchaseDO purchaseDO = iotOrderPurchaseDao.findById(iotDeviceQualityInspectionPlan.getPurchaseId());
        IotOrderPurchaseDO purchaseDO = iotOrderPurchaseDao.findByOrderNo(iotDeviceQualityInspectionPlan.getOrderNo());
        iotDeviceQualityInspectionPlan.setPurchaseId(purchaseDO.getId());
        iotDeviceQualityInspectionPlan.setDeviceId(purchaseDO.getProductId());
        iotDeviceQualityInspectionPlan.setOrderNo(purchaseDO.getOrderNo());
        iotDeviceQualityInspectionPlan.setDeviceId(purchaseDO.getProductId());
@ -225,23 +233,23 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
     * 分页查找
     * @param page
     * @param size
     * @param purcharseId
     * @param status
     * @return
     */
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> queryPage(String purcharseId, String orderNo, String startTime, String endTime, Integer page, Integer size){
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> queryPage(String status, String orderNo, String startTime, String endTime, Integer page, Integer size){
        StringBuffer sql = new StringBuffer("SELECT c.* from iot_device_quality_inspection_plan c  WHERE c.del=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(c.id) count from iot_device_quality_inspection_plan c WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(purcharseId)){
            sql.append(" and c.purchase_id=? ");
            sqlCount.append(" and c.purchase_id='").append(purcharseId).append("' ");
            args.add(purcharseId);
        if(StringUtils.isNotBlank(status)){
            sql.append(" and c.status=? ");
            sqlCount.append(" and c.status='").append(status).append("' ");
            args.add(status);
        }
        if(StringUtils.isNotBlank(orderNo)){
            sql.append(" and c.order_no=? ");
            sqlCount.append(" and c.order_no='").append(orderNo).append("' ");
            args.add(orderNo);
            sql.append("and c.order_no like'%").append(orderNo).append("%' ");
            sqlCount.append(" and c.order_no like'%").append(orderNo).append("%' ");
        }
        if(StringUtils.isNotBlank(startTime)){
            sql.append(" and c.plan_time>=? ");
@ -271,16 +279,10 @@ public class IotDeviceQualityInspectionPlanService extends BaseJpaService<IotDev
     */
    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);
        });
        IotSystemDictDO qualityRemind= iotSystemDictDao.findByDictName("DEVICE_QUALITY_REMIND").get(0);
        qualityRemind.setTime(time);
        qualityRemind.setDel(1);
        iotSystemDictDao.save(qualityRemind);
    }
}

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

@ -4,10 +4,12 @@ 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.iot.dao.dict.IotSystemDictDao;
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.dict.IotSystemDictDO;
import com.yihu.jw.entity.iot.platform.IotInterfaceAuditDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
@ -47,6 +49,9 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    /**
     * 增加SIM卡管理
     * @param advancePayment
@ -154,19 +159,17 @@ public class IotDeviceSimService  extends BaseJpaService<IotDeviceSimDO, IotDevi
    /**
     *
     *SIM余额提醒
     * @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);
        });
        IotSystemDictDO sim = iotSystemDictDao.findByDictName("SIM_BALANCE_REMIND").get(0);
        sim.setCode(money);
        sim.setStatus(Integer.parseInt(status));
        sim.setTime(time);
        iotSystemDictDao.save(sim);
    }
}