Browse Source

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

humingfen 4 years ago
parent
commit
4223c4078d
15 changed files with 321 additions and 86 deletions
  1. 4 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/BaseNatAppointmentDao.java
  2. 20 8
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java
  3. 140 38
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 8 8
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  5. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java
  6. 27 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNatAppointmentDO.java
  7. 9 3
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  8. 13 3
      server/svr-authentication/src/main/java/com/yihu/jw/security/model/WlyyUserDetails.java
  9. 4 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthYlzConfigService.java
  10. 43 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  11. 21 6
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  12. 13 9
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java
  13. 3 3
      svr/svr-iot/src/main/java/com/yihu/iot/service/equipment/IotEqtDetailService.java
  14. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/gateway/GcClientDetailsService.java
  15. 5 6
      svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/BaseNatAppointmentDao.java

@ -1,6 +1,7 @@
package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.BaseNatAppointmentDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -12,4 +13,7 @@ public interface BaseNatAppointmentDao extends PagingAndSortingRepository<BaseNa
    @Query("from BaseNatAppointmentDO t where t.payStatus = 0 ")
    List<BaseNatAppointmentDO> findByPayStatus();
    @Query("select a from BaseNatAppointmentDO a where  a.realOrder =?1 ")
    List<BaseNatAppointmentDO> findByRealOrderList(String realOrder);
}

+ 20 - 8
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java

@ -1,27 +1,22 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import jxl.WorkbookSettings;
import jxl.write.*;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Service
public class PayInfoNoticeService {
@ -58,6 +53,23 @@ public class PayInfoNoticeService {
        return null;
    }
    public String pushPrescriptionPayAndHsjc(String patient,String doctorName,String orderNo,String id,String total,String title,String url){
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO!=null){
            String userName = patientDO.getName();
            String idcard = patientDO.getIdcard();
            String phone = patientDO.getMobile();
            if (!StringUtils.isNotBlank(url)){
                url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id="+id;
            }
            String remark = "结算方式:微信结算" +
                    "点击查看核酸预约开单信息";
            return paySuccessNotice(userName,idcard,phone,title,url,doctorName,total,"0",total,orderNo,remark);
        }
        return null;
    }
    /**
     * 支付成功提醒
     * @param userName 用户名 (不能为空)

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

@ -1,6 +1,7 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONPObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictDeptDescDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
@ -9328,6 +9329,38 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, object);
    }
    public MixEnvelop selectByUrlHsjc(Integer id,String wxId,String channel) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wxId);
        if (wxWechatDO == null) {
            throw new Exception("微信配置不存在!");
        }
        BaseNatAppointmentDO natAppointmentDO = baseNatAppointmentDao.findOne(id);
        BasePatientDO patientDO = basePatientDao.findById(natAppointmentDO.getPatientId());
        List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wxId, natAppointmentDO.getPatientId());
        if (patientWechatDos == null || patientWechatDos.size() == 0) {
            throw new Exception("openid不存在!");
        }
        BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
        String idcard = null;
        if (natAppointmentDO != null) {
            idcard = natAppointmentDO.getMedicare();
        }
        if (!StringUtils.isNoneBlank(idcard)) {
            throw new Exception("就诊卡不存在!");
        }
        String url = null;
        if (StringUtils.isNoneBlank(channel)&&channel.equalsIgnoreCase("ALI")){
            url = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(), patientDO.getAlipayId(), idcard, "ALI");
        }else {
            url = ylzPayService.createSicardPayUrl(wxWechatDO.getAppOriginId(), patientWechatDo.getOpenid(), idcard, "WX");
        }
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(url);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, object);
    }
    /**
     * 获取居民openId
     *
@ -10426,6 +10459,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public Map saveNatAppointment(String mediaCard,String patientId,String name,String cardNo,String cardType,String mobile,
                                   String firstJobCode,String firstJobName,String secondJobCode,String secondJobName,String natTime,String address,String provinceName,String cityName,String townName,String streetName) throws Exception {
        BaseNatAppointmentDO baseNatAppointmentDO= new BaseNatAppointmentDO();
        baseNatAppointmentDO.setMedicare(mediaCard);
        baseNatAppointmentDO.setName(name);
        baseNatAppointmentDO.setCardNo(cardNo);
        baseNatAppointmentDO.setCardType(cardType);
        baseNatAppointmentDO.setAddress(address);
        baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDate(natTime,"yyyy-MM-dd hh:mm:ss"));
        baseNatAppointmentDO.setCityName(cityName);
        baseNatAppointmentDO.setFirstJobCode(firstJobCode);
        baseNatAppointmentDO.setFirstJobName(firstJobName);
        baseNatAppointmentDO.setSecondJobCode(secondJobCode);
        baseNatAppointmentDO.setSecondJobName(secondJobName);
        baseNatAppointmentDO.setProvinceName(provinceName);
        baseNatAppointmentDO.setTownName(townName);
        baseNatAppointmentDO.setStreetName(streetName);
        baseNatAppointmentDO.setPatientId(patientId);
        baseNatAppointmentDO.setIsSuccess("0");
        baseNatAppointmentDO.setPayStatus("0");
        baseNatAppointmentDO.setCreateTime(new Date());
        baseNatAppointmentDO.setMobile(mobile);
        baseNatAppointmentDO.setInspectionCode("鼻/咽拭子");
        baseNatAppointmentDO.setInspectionName("鼻/咽拭子");
        baseNatAppointmentDO.setIcdCode("Z00.000");
        baseNatAppointmentDO.setChargeCode("361322");
        baseNatAppointmentDO.setWinNo("6");
        baseNatAppointmentDO.setDept("3150000");
        baseNatAppointmentDO.setDeptName("感染疾病科");
        baseNatAppointmentDO= baseNatAppointmentDao.save(baseNatAppointmentDO);
        Map returnMap = new HashMap();
        net.sf.json.JSONObject jsondate = new JSONObject();
        jsondate.put("checkPart","鼻/咽拭子");
@ -10441,12 +10501,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        jsondate.put("address4",streetName);
        jsondate.put("address5",2);
        jsondate.put("area",address);
        jsondate.put("winNo",6);
        jsondate.put("target",2);
        jsondate.put("quantity",1);
        Map<String,Object> map = findRandomDoctor();
        net.sf.json.JSONObject rs = new JSONObject();
        if (map!=null){
            //先进行核算检测预约
            String result = entranceService.BS10144(map.get("deptCode").toString(),map.get("doctorMappingCode").toString(),natTime,mediaCard,name,patientId,mobile,demoFlag);
            String result = entranceService.BS10144("3150000","0001",natTime,mediaCard,name,cardNo,mobile,demoFlag);
            com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
            logger.info("核酸检测预约结束"+result);
            Boolean flag = false;
@ -10474,14 +10536,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            jsondate.put("serialNo",registerDO.getRegisterNo());
                            jsondate.put("dept",map.get("deptCode").toString());
                            jsondate.put("doctor",map.get("doctorMappingCode").toString());
                            baseNatAppointmentDO.setRegisterNo(registerDO.getRegisterNo());
                            baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
                            baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
                        }else {
                            returnMap.put("msg","已经挂号的数据有误");
                            returnMap.put("status","-1");
                            return map;
                            returnMap.put("id",baseNatAppointmentDO.getId());
                            return returnMap;
                        }
                    }else {
                        rs = entranceService.BS10111(cardNo, map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
                        rs = entranceService.BS10111(mediaCard, map.get("doctorMappingCode").toString(), map.get("deptCode").toString(), "31", "6", demoFlag);
                        net.sf.json.JSONObject res = rs.getJSONObject("resquest");
                        logger.info("挂号结果 res: " + res.toString());
                        String rsCode = res.getString("@RESULT");
@ -10496,6 +10561,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            jsondate.put("serialNo",serialNo);
                            jsondate.put("dept",map.get("deptCode").toString());
                            jsondate.put("doctor",map.get("doctorMappingCode").toString());
                            baseNatAppointmentDO.setRegisterNo(serialNo);
                            //存储就诊记录
                            WlyyPatientRegisterDO registerDO = new WlyyPatientRegisterDO();
                            // 存储挂号医生与挂号科室
@ -10563,9 +10629,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        }else {
                            returnMap.put("msg","请求挂号失败");
                            returnMap.put("status","-1");
                            return map;
                            returnMap.put("id",baseNatAppointmentDO.getId());
                            return returnMap;
                        }
                        baseNatAppointmentDO.setDoctorId(map.get("doctorMappingCode").toString());
                        baseNatAppointmentDO.setDoctorName(map.get("doctorName").toString());
                    }
                } catch (Exception e) {
@ -10573,8 +10641,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
                logger.info("开单开始");
                logger.info("saveNatAppointment params:"+jsondate.toString());
                com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
                array.add(jsondate);
                try {
                    JSONObject jsonObject  = entranceService.BS10112(jsondate.toString(),flag);
                    JSONObject jsonObject  = entranceService.BS10112(array.toString(),demoFlag);
                    //判断返回结果
                    String prers = jsonObject.getString("@RESULT");
                    //保存日志
@ -10589,11 +10659,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    wlyyHttpLogDao.save(log);
                    if ("0".equals(prers)) {
                        String realOrder = jsonObject.getString("@real_order");
                        String voucherNo = jsonObject.getString("@xtgzh0");
                        baseNatAppointmentDO.setRealOrder(realOrder);
                        baseNatAppointmentDO.setIsSuccess("1");
                        baseNatAppointmentDO.setVoucherNo(voucherNo);
                        baseNatAppointmentDao.save(baseNatAppointmentDO);
                        String recipeTime = DateUtil.dateToStr(new Date(), "yyyyMMddHHmmss");
                        String applyDepaName = map.get("deptCode").toString();
                        String applyDepaName = map.get("deptName").toString();
                        String voucherNo = jsonObject.getString("@xtgzh0") ;
                        String applyDoctorName = map.get("doctorName").toString();
                        BasePatientDO patientDO = basePatientDao.findById(patientId);
                        String userName = null;
@ -10617,45 +10691,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        if ("0".equals(rsCode)) {
                            free = res.getString("@total_charge");
                        }
                        ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
                        ylzPayService.msgPush("01", mediaCard, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
                        /*//成功后发送模板消息
                        sendNatWxTemplat(name,cardNo,mobile,natTime,realOrder,"natAppointmentRemind");*/
                    }else{
                        returnMap.put("msg","核酸检测开方失败");
                        returnMap.put("status","-1");
                        return map;
                        returnMap.put("id",baseNatAppointmentDO.getId());
                        return returnMap;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            baseNatAppointmentDO.setMedicare(mediaCard);
            baseNatAppointmentDO.setName(name);
            baseNatAppointmentDO.setCardNo(cardNo);
            baseNatAppointmentDO.setCardType(cardType);
            baseNatAppointmentDO.setAddress(address);
            baseNatAppointmentDO.setAppointmentTime(DateUtil.strToDate(natTime,"yyyy-MM-dd hh:mm:ss"));
            baseNatAppointmentDO.setCityName(cityName);
            baseNatAppointmentDO.setFirstJobCode(firstJobCode);
            baseNatAppointmentDO.setFirstJobName(firstJobName);
            baseNatAppointmentDO.setSecondJobCode(secondJobCode);
            baseNatAppointmentDO.setSecondJobName(secondJobName);
            baseNatAppointmentDO.setProvinceName(provinceName);
            baseNatAppointmentDO.setTownName(townName);
            baseNatAppointmentDO.setStreetName(streetName);
            baseNatAppointmentDO.setPatientId(patientId);
            baseNatAppointmentDO.setIsSuccess("1");
            baseNatAppointmentDO.setPayStatus("0");
            baseNatAppointmentDO.setCreateTime(new Date());
            baseNatAppointmentDO.setMobile(mobile);
            baseNatAppointmentDao.save(baseNatAppointmentDO);
            returnMap.put("msg","预约成功");
            returnMap.put("status","200");
            }
            returnMap.put("id",baseNatAppointmentDO.getId());
        }
        return map;
        return returnMap;
    }
    public MixEnvelop getNatRecords(String patientId,Integer page ,Integer pageSize){
    public MixEnvelop getNatRecords(String patientId,String id,Integer page ,Integer pageSize){
        String sql = "select t.name as \"name\"," +
                "t.card_no as \"cardNo\"," +
                "t.card_type as \"cardType\"," +
@ -10665,12 +10723,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "t.is_success as \"isSuccess\"," +
                "t.create_time as \"createTime\"," +
                "t.pay_status as \"payStatus\"," +
                "t.medicare as \"medicare\","+
                "t.voucher_no as \"voucherNo\","+
                "t.id as \"id\"," +
                "t.appointment_time as \"appointmentTime\" " +
                " from base_nat_appointment t where 1=1 ";
        if (StringUtils.isNoneBlank(patientId)){
            sql+=" and t.patient_id ='"+patientId+"'";
        }
        if (StringUtils.isNoneBlank(id)){
            sql+=" and t.id ='"+id+"'";
        }
        List<Map<String ,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        List<Map<String ,Object>> listCount = hibenateUtils.createSQLQuery(sql);
        MixEnvelop mixnvelop = new MixEnvelop();
@ -10710,12 +10773,51 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                patientCode = patientMappingService.findHisPatNoByIdCard(patientDO.getIdcard());
                BaseNatAppointmentDO baseNatAppointmentDO = baseNatAppointmentDao.findOne(id);
                if (null!=baseNatAppointmentDO){
                    res = entranceService.BS10145(baseNatAppointmentDO.getDept(),baseNatAppointmentDO.getDoctorId(),DateUtil.dateToStr(baseNatAppointmentDO.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),patientCode,baseNatAppointmentDO.getMobile(),demoFlag);
                    baseNatAppointmentDO.setIsSuccess("-1");
                    baseNatAppointmentDO.setCancelReson("患者本人取消");
                    baseNatAppointmentDO.setCancelTime(new Date());
                    baseNatAppointmentDO.setCancelBy(patientId);
                    baseNatAppointmentDao.save(baseNatAppointmentDO);
                    res = entranceService.BS10145("3150000","0001",DateUtil.dateToStr(baseNatAppointmentDO.getAppointmentTime(),"yyyy-MM-dd hh:mm:ss"),baseNatAppointmentDO.getMedicare(),baseNatAppointmentDO.getName(),baseNatAppointmentDO.getCardNo(),baseNatAppointmentDO.getMobile(),demoFlag);
                    logger.info("核酸检测预约取消"+res);
                    com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(res);
                    Boolean flag = false;
                    if (jsonObject!=null){
                        com.alibaba.fastjson.JSONObject object = jsonObject.getJSONObject("MsgInfo");
                        String Msg = object.getString("Msg");
                        if (Msg.contains("Error")){
                            throw new Exception(Msg);
                        }else {
                            baseNatAppointmentDO.setIsSuccess("-1");
                            baseNatAppointmentDO.setCancelReson("患者本人取消");
                            baseNatAppointmentDO.setCancelTime(new Date());
                            baseNatAppointmentDO.setCancelBy(patientId);
                            baseNatAppointmentDao.save(baseNatAppointmentDO);
                            //删除处方
                            logger.info("删除处方开始");
                            net.sf.json.JSONObject jsondate = new JSONObject();
                            jsondate.put("checkPart","鼻/咽拭子");
                            jsondate.put("cardNo",baseNatAppointmentDO.getMedicare());
                            jsondate.put("chargeFlag","2");
                            jsondate.put("chargeCode","361322");
                            jsondate.put("icdCode","Z00.000");
                            jsondate.put("socialNo",baseNatAppointmentDO.getCardNo());
                            jsondate.put("tellPhone",baseNatAppointmentDO.getMobile());
                            jsondate.put("address1",baseNatAppointmentDO.getProvinceName());
                            jsondate.put("address2",baseNatAppointmentDO.getCityName());
                            jsondate.put("address3",baseNatAppointmentDO.getTownName());
                            jsondate.put("address4",baseNatAppointmentDO.getStreetName());
                            jsondate.put("address5",2);
                            jsondate.put("area",baseNatAppointmentDO.getAddress());
                            jsondate.put("winNo",6);
                            jsondate.put("target",2);
                            jsondate.put("quantity",1);
                            jsondate.put("serialNo",baseNatAppointmentDO.getRegisterNo());
                            jsondate.put("dept",baseNatAppointmentDO.getDept());
                            jsondate.put("doctor",baseNatAppointmentDO.getDoctorId());
                            jsondate.put("realOrder",baseNatAppointmentDO.getRealOrder());
                            JSONArray array = new JSONArray();
                            array.add(jsondate);
                            JSONObject object1  = entranceService.BS10112(array.toString(),demoFlag);
                            logger.info("删除处方结束");
                        }
                    }
                }
            } catch (Exception e) {

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

@ -14,20 +14,14 @@ import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
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.WlyyPrescriptionExpressageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
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.PrescriptionExpressageDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
@ -131,6 +125,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private WlyyChargeDictDao chargeDictDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
@ -1116,6 +1112,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        return businessOrderDO;
    }
    public BaseNatAppointmentDO selectById(Integer relationCode){
        return  baseNatAppointmentDao.findOne(relationCode);
    }
    public List<BusinessOrderDO> selectListStatus(String relationCode){
        List<BusinessOrderDO> businessOrderDOList = businessOrderDao.selectListByRelationCode(relationCode);

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/BasePatientDO.java

@ -245,6 +245,7 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    private String openid;
    private Date openidTime;
    private String cardType;
    private String alipayId;//支付宝id
    public String getCardType() {
        return cardType;
@ -688,4 +689,13 @@ public class BasePatientDO extends UuidIdentityEntityWithOperator {
    public void setOnline(String online) {
        this.online = online;
    }
    @Column(name = "alipay_id")
    public String getAlipayId() {
        return alipayId;
    }
    public void setAlipayId(String alipayId) {
        this.alipayId = alipayId;
    }
}

+ 27 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/BaseNatAppointmentDO.java

@ -51,6 +51,9 @@ public class BaseNatAppointmentDO extends IntegerIdentityEntity {
    private String winNo;
    private String chargeCode;
    private String icdCode;
    private String doctorName;
    private String voucherNo;
    private String registerNo;
    public String getMedicare() {
        return medicare;
@ -372,4 +375,28 @@ public class BaseNatAppointmentDO extends IntegerIdentityEntity {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getVoucherNo() {
        return voucherNo;
    }
    public void setVoucherNo(String voucherNo) {
        this.voucherNo = voucherNo;
    }
    public String getRegisterNo() {
        return registerNo;
    }
    public void setRegisterNo(String registerNo) {
        this.registerNo = registerNo;
    }
}

+ 9 - 3
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -57,8 +57,8 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    private static final String DEFAULT_PATIENT_INSERT_STATEMENT =
            "INSERT into base_patient (id,photo,idcard,password,salt,name,birthday,sex,mobile," +
                    "province_code,province_name,city_code,city_name,town_code,town_name,street_code,street_name,address," +
                    "del,locked,enabled,login_failure_count,login_date) " +
                    " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
                    "del,locked,enabled,login_failure_count,login_date,card_type) " +
                    " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
    private static final String PATIENT_INSERT_WEHCAT = "insert into base_patient_wechat (id,wechat_id,patient_id,openid,create_time) values(?,?,?,?,?)";
@ -298,10 +298,12 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                    }
                    JSONObject object1 = JSONObject.parseObject(res);
                    logger.info("object1"+object1.toJSONString());
                    if (null != object1&&null!=object1.get("status") && "200".equals(object1.get("status").toString())) {
                        JSONObject patient = object1.getJSONObject("userinfo");
                        String salt = randomString(5);
                        idcard = patient.getString("idcard");
                        String idtype = patient.getString("idtype");
                        String mobile = patient.getString("mobile");
                        String pw = mobile.substring(mobile.length()-6);
                        try {
@ -328,7 +330,8 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                                            0,
                                            1,
                                            0,
                                            new Date()
                                            new Date(),
                                            idtype
                                    }
                            );
                        }catch (Exception e){
@ -350,6 +353,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                        user.setEnabled(true);
                        user.setLocked(false);
                        user.setLockedDate(null);
                        user.setCardType(idcard);
                        users.add(user);
                    }else{
@ -672,6 +676,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                JSONObject patient = object1.getJSONObject("userinfo");
                logger.info("开始同步患者数据");
                String idcard = patient.getString("idcard");
                String idtype = patient.getString("idtype");
                BasePatientDO patientDO2 = patientDao.findByIdcardAndDel(idcard,"1");
                BasePatientDO patient1 = new BasePatientDO();
                String salt = UUID.randomUUID().toString().substring(0,5);
@ -689,6 +694,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                    patient1.setSalt(salt);
                }
                patient1.setIdcard(idcard);
                patient1.setCardType(idtype);
                patient1.setName(patient.getString("name"));
                patient1.setSex(StringUtils.isNotBlank(idcard)?Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)):null);
                patient1.setMobile(mobile);

+ 13 - 3
server/svr-authentication/src/main/java/com/yihu/jw/security/model/WlyyUserDetails.java

@ -1,8 +1,5 @@
package com.yihu.jw.security.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;
@ -114,6 +111,11 @@ public class WlyyUserDetails implements Serializable {
     */
    private String address;
    /**
     *
     */
    private String cardType;
    public Date getBirthday() {
@ -371,4 +373,12 @@ public class WlyyUserDetails implements Serializable {
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    public String getCardType() {
        return cardType;
    }
    public void setCardType(String cardType) {
        this.cardType = cardType;
    }
}

+ 4 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthYlzConfigService.java

@ -211,6 +211,7 @@ public class OauthYlzConfigService {
                String  auth_status = biz.getString("auth_status");
                if("succ".equals(auth_status)){
                    String idcard = biz.getString("id_no");
                    String cardType = biz.getString("id_type");
                    BasePatientDO patientDO =  basePatientDao.findByIdcardAndDel(idcard,"1");
                    if(StringUtils.isNotBlank(idcard)&&patientDO == null){
                        BasePatientDO patient = new BasePatientDO();
@ -236,6 +237,7 @@ public class OauthYlzConfigService {
                        patient.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)));
                        patient.setCreateTime(new Date());
                        patient.setUpdateTime(new Date());
                        patient.setCardType(cardType);
                        patient.setBirthday(DateUtil.strToDate(biz.getString("birthday"),"yyyyMMdd"));
                        patientDO = basePatientDao.save(patient);
                        WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(patientDO.getId(),"7");
@ -258,6 +260,8 @@ public class OauthYlzConfigService {
                        rsMap.put("patient",patient);
                        return rsMap;
                    }else{
                        patientDO.setCardType(cardType);
                        basePatientDao.save(patientDO);
                        WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(patientDO.getId(),"7");
                        if (basePatientFamilyMemberDO==null){
                            basePatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();

+ 43 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -180,6 +180,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseBannerDoctorService baseBannerDoctorService;
    @Autowired
    private BaseNatAppointmentDao baseNatAppointmentDao;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
@ -890,6 +892,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                            if (listWPD!=null&&listWPD.size()!=0){
                                WaitPayDetailVO waitPayDetailVO = listWPD.get(0);
                                String voucherNo = waitPayDetailVO.getVoucherNo();
                                //判断处方
                                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                for (WlyyPrescriptionDO prescriptionDO:prescriptionDOList){
                                    if (prescriptionDO.getStatus()!=30){
@ -939,6 +942,43 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                        logger.info("处方结算成功"+pushPayLog+"====="+waitPayDetailVO.getRecipeNo());
                                    }
                                }
                                //判断检查订单
                                List<BaseNatAppointmentDO> baseNatAppointmentDOS = baseNatAppointmentDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                for (BaseNatAppointmentDO natAppointmentDO:baseNatAppointmentDOS){
                                    natAppointmentDO.setPayStatus("1");
                                    baseNatAppointmentDao.save(natAppointmentDO);
                                    //发送支付成功通知
                                    String pushPayLog = null;
                                    String fee = waitPayDetailVO.getFee();
                                    if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                                        String title="您在厦门大学附属中山医院有一笔交易已支付完成!";
                                        pushPayLog = payInfoNoticeService.pushPrescriptionPayAndHsjc(natAppointmentDO.getPatientId(),natAppointmentDO.getDoctorName(),voucherNo,natAppointmentDO.getId()+"",fee,title,null);
                                    }
                                    //发送预约成功通知
                                    String name= natAppointmentDO.getName();
                                    String idcard = natAppointmentDO.getCardNo();
                                    String mobile = natAppointmentDO.getMobile();
                                    String url = "https://hlwyy.xmzsh.com/hlwyy/ims-wx/#/nucleicTest/detail?id="+natAppointmentDO.getId();
                                    String date = DateUtil.dateToStrLong(natAppointmentDO.getAppointmentTime());
                                    String first = "尊敬的用户"+name+",您已完成线上自助核酸检测开单预约";
                                    String contentMsg = "申请人:"+name+";预约时间:"+date+";发票流水号:"+waitPayDetailVO.getRecipeNo();
                                    String remark="备注:1、请您持核酸开单预约信息和发票流水号、医保卡/就诊卡/电子健康卡,提前15分钟至我院五号楼北侧(急诊部后侧)核酸检测点?号取管窗口绑定检测。" +
                                            "2、核酸检测标本采集24小时后出具报告。请关注厦门大学附属中山医院微信公众号查询;如需打印,请至厦门大学附属中山医院核酸检测点自助机打印。";
                                    String responseMsg="";
                                    if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
                                        responseMsg = entranceService.ehospitalNotice(
                                                name,
                                                idcard,
                                                mobile,
                                                first,
                                                url,
                                                contentMsg,
                                                remark);
                                        logger.info("中山发送模板消息返回结果="+responseMsg);
                                        System.out.println("结束发送模板消息");
                                    }
                                }
                            }
                            for (WaitPayDetailVO waitPayDetailVO:listWPD){
                                if (waitPayDetailVO.getItemName().equalsIgnoreCase("互联网医院复诊诊查费")){
@ -1429,13 +1469,15 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "查询预约记录", notes = "查询预约记录")
    public MixEnvelop getNatRecords(@ApiParam(name = "patientId", value = "居民id")
                                        @RequestParam(value = "patientId", required = false)String patientId,
                                    @ApiParam(name = "id", value = "预约id")
                                    @RequestParam(value = "id", required = false)String id,
                                    @ApiParam(name = "page", value = "页数")
                                    @RequestParam(value = "page", required = false)Integer page,
                                    @ApiParam(name = "pageSize", value = "每页大小")
                                        @RequestParam(value = "pageSize", required = false)Integer pageSize) {
        return  prescriptionService.getNatRecords(patientId,page,pageSize);
        return  prescriptionService.getNatRecords(patientId,id,page,pageSize);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findBaseAddress)
    @ApiOperation(value = "查询地址", notes = "查询地址")

+ 21 - 6
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -1577,8 +1577,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation("查询支付状态")
    public ObjEnvelop selectOrderStatus(
            @ApiParam(name = "relationCode", value = "relationCode", required = true)
            @RequestParam(required = true)String relationCode) throws Exception {
            @RequestParam(required = true)String relationCode,
            @ApiParam(name = "flag", value = "flag", required = false)
            @RequestParam(required = false)String flag) throws Exception {
        try {
            if (StringUtils.isNoneBlank(flag)){
                Integer id = Integer.parseInt(relationCode);
                return ObjEnvelop.getSuccess("ok",businessOrderService.selectById(id));
            }
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectStatus(relationCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
@ -2160,12 +2166,21 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value= BaseHospitalRequestMapping.Prescription.selectByUrl)
    @ApiOperation("获取诊间支付url")
    public ObjEnvelop selectByUrl(
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = true)
            @RequestParam(required = true)String prescriptionId,
            @ApiParam(name = "oupatientId", value = "oupatientId", required = true)
            @RequestParam(required = true)String oupatientId) throws Exception {
            @ApiParam(name = "prescriptionId", value = "prescriptionId", required = false)
            @RequestParam(required = false)String prescriptionId,
            @ApiParam(name = "oupatientId", value = "oupatientId", required = false)
            @RequestParam(required = false)String oupatientId,
            @ApiParam(name = "flag", value = "flag", required = false)
            @RequestParam(required = false)String flag,
            @ApiParam(name = "channel", value = "WX、ALI", required = false)
            @RequestParam(required = false)String channel) throws Exception {
        try {
            return ObjEnvelop.getSuccess("ok",prescriptionService.selectByUrl(oupatientId,prescriptionId,wxId));
            if (StringUtils.isNoneBlank(flag)){
                Integer id = Integer.parseInt(oupatientId);
                return ObjEnvelop.getSuccess("ok",prescriptionService.selectByUrlHsjc(id,wxId,channel));
            }else {
                return ObjEnvelop.getSuccess("ok",prescriptionService.selectByUrl(oupatientId,prescriptionId,wxId));
            }
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }

+ 13 - 9
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -299,15 +299,16 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        String sql = "select t.code as \"code\",t.name as \"name\" from wlyy.wlyy_patient t where 1=1 ";
        String sqlEqt="select t.device_name as\"device_name\" from device.wlyy_devices t where 1=1";
        if (StringUtils.isNotEmpty(idCard)){
            sql = sql +" and t.idcard = '"+AesEncryptUtils.encrypt(idCard)+"'";
            sql = sql +" and t.idcard = '"+idCard+"'";
//            sql = sql +" and t.idcard = '"+AesEncryptUtils.encrypt(idCard)+"'";//待i健康加密
        }if (StringUtils.isNotEmpty(snCode)){
            sqlEqt = sqlEqt +" and t.device_code = '"+snCode+"'";
        }
        System.out.println("查询患者name和code开始");
        List<Map<String,Object>> nameList = hibenateUtils.createSQLQuery(sql);
        for (Map<String,Object> tmp:nameList){
            tmp.put("name",AesEncryptUtils.decrypt(tmp.get("name").toString()));
        }
//        for (Map<String,Object> tmp:nameList){
//            tmp.put("name",AesEncryptUtils.decrypt(tmp.get("name").toString()));//待i健康加密
//        }
        System.out.println("查询患者name和code结束:"+nameList);
        System.out.println("查询设备名称开始");
        List<Map<String,Object>> deviceList = hibenateUtils.createSQLQuery(sqlEqt);
@ -333,7 +334,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
                List<Map<String,Object>> nameList = new ArrayList<>();
                List<Map<String,Object>> deviceList = new ArrayList<>();
                if (StringUtils.isNotEmpty(idCard)){
                    sql = sql +" and t.idcard = '"+AesEncryptUtils.encrypt(idCard)+"'";
                    sql = sql +" and t.idcard = '"+idCard+"'";
//                    sql = sql +" and t.idcard = '"+AesEncryptUtils.encrypt(idCard)+"'";//待i健康加密
                    nameList = jdbcTempalte.queryForList(sql);
                }if (StringUtils.isNoneBlank(snCoed)){
                    sqlEqt = sqlEqt +" and t.device_code = '"+snCoed+"'";
@ -342,9 +344,9 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
                if(nameList.size()>0){
                    String code = null==nameList.get(0).get("code")?"":nameList.get(0).get("code").toString();
                    String name = null==nameList.get(0).get("name")?"": ConcealUtil.nameOrAddrConceal(nameList.get(0).get("name").toString());
                    locationDataVO.setIdCard(AesEncryptUtils.decrypt(idCard));
//                    String name = null==nameList.get(0).get("name")?"": ConcealUtil.nameOrAddrConceal(AesEncryptUtils.decrypt(nameList.get(0).get("name").toString()));//待i健康加密
                    locationDataVO.setCode(code);
                    locationDataVO.setName(AesEncryptUtils.decrypt(name));
                    locationDataVO.setName(name);
                }
                if (deviceList.size()>0){
                    String equipmentName = null==deviceList.get(0).get("device_name")?"":deviceList.get(0).get("device_name").toString();
@ -364,7 +366,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
                List<Map<String,Object>> nameList = new ArrayList<>();
                List<Map<String,Object>> deviceList = new ArrayList<>();
                if (StringUtils.isNotEmpty(idCard)){
                    sql = sql +" and t.idcard = '"+ AesEncryptUtils.encrypt(idCard)+"'";
                    sql = sql +" and t.idcard = '"+ idCard+"'";
//                    sql = sql +" and t.idcard = '"+ AesEncryptUtils.encrypt(idCard)+"'";//待i健康加密
                    nameList = jdbcTempalte.queryForList(sql);
                }if (StringUtils.isNoneBlank(snCoed)){
                    sqlEqt = sqlEqt +" and t.device_code = '"+snCoed+"'";
@ -372,7 +375,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
                }
                if(nameList.size()>0){
                    String code = null==nameList.get(0).get("code")?"":nameList.get(0).get("code").toString();
                    String name = null==nameList.get(0).get("name")?"": ConcealUtil.nameOrAddrConceal(AesEncryptUtils.decrypt(nameList.get(0).get("name").toString()));
                    String name = null==nameList.get(0).get("name")?"": ConcealUtil.nameOrAddrConceal(nameList.get(0).get("name").toString());
//                    String name = null==nameList.get(0).get("name")?"": ConcealUtil.nameOrAddrConceal(AesEncryptUtils.decrypt(nameList.get(0).get("name").toString()));//待i健康加密
                    locationDataVO.setCode(code);
                    locationDataVO.setName(name);
                }

+ 3 - 3
svr/svr-iot/src/main/java/com/yihu/iot/service/equipment/IotEqtDetailService.java

@ -165,9 +165,9 @@ public class IotEqtDetailService  extends BaseJpaService<IotEquipmentDetailDO, I
            params.put("city",city);
        }
       List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql.toString(),params);
       for (Map<String,Object> tmp:list){
           tmp.put("phone",AesEncryptUtils.decrypt(tmp.get("phone").toString()));
       }
//       for (Map<String,Object> tmp:list){
//           tmp.put("phone",AesEncryptUtils.decrypt(tmp.get("phone").toString()));//待i健康加密
//       }
       return list;
    }

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/gateway/GcClientDetailsService.java

@ -30,7 +30,7 @@ public class GcClientDetailsService{
        gcClientDetails.setAppId(getUUID());
        gcClientDetails.setAppSecret(getUUID());
        gcClientDetails.setAppUri(appUri);
        gcClientDetails.setCreateUserName(AesEncryptUtils.encrypt(createUserName));
        gcClientDetails.setCreateUserName(createUserName);
        gcClientDetails.setCreatieUser(creatieUser);
        gcClientDetails.setCreatieTime(new Date());
        gcClientDetails.setDel(1);

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

@ -113,7 +113,6 @@ public class MonitorPlatformService  {
                    locationDataVO.setLabel(null);
                    locationDataVO.setDiseaseCondition(Integer.parseInt(map.get("diseaseCondition").toString()));
                    locationDataVO.setCreateTime(map.get("createTime").toString());
//                    locationDataVO.setName(ConcealUtil.nameOrAddrConceal(map.get("name").toString()));
                    locationDataVO.setCode(null);
                    locationDataVO.setEquimentName((String) map.get("equimentName"));
                    locationDataVO = iotPatientDeviceService.addNameAndCodeToLocationVO(locationDataVO);
@ -193,7 +192,6 @@ public class MonitorPlatformService  {
                    locationDataVO.setLabel(null);
                    locationDataVO.setDiseaseCondition(Integer.parseInt(map.get("diseaseCondition").toString()));
                    locationDataVO.setCreateTime(map.get("createTime").toString());
//                    locationDataVO.setName(ConcealUtil.nameOrAddrConceal(map.get("name").toString()));
                    locationDataVO.setCode(null);
                    locationDataVO.setEquimentName((String) map.get("equimentName"));
                    locationDataVO = iotPatientDeviceService.addNameAndCodeToLocationVO(locationDataVO);
@ -1092,12 +1090,13 @@ public class MonitorPlatformService  {
        sql.append("from wlyy.wlyy_patient_device d,wlyy.wlyy_patient p  ");
        sql.append("WHERE d.`user` = p.`code` and d.del=0  ");
        if(org.apache.commons.lang3.StringUtils.isNotBlank(name)){
            sql.append("and (d.device_sn like '%"+name+"%' or p.`name` = '"+ AesEncryptUtils.encrypt(name)+"') ");
            sql.append("and (d.device_sn like '%"+name+"%' or p.`name` = '"+ name+"') ");
//            sql.append("and (d.device_sn like '%"+name+"%' or p.`name` = '"+ AesEncryptUtils.encrypt(name)+"') ");待i健康加密
        }
        List<JSONObject> jsonArray = myJdbcTemplate.queryJson(sql.toString(),new Object[]{});
        for (JSONObject obj:jsonArray){
            obj.put("name",AesEncryptUtils.decrypt(obj.getString("name")));
        }
//        for (JSONObject obj:jsonArray){
//            obj.put("name",AesEncryptUtils.decrypt(obj.getString("name")));//待i健康加密
//        }
        if(jsonArray.size()==0){
            sql= new StringBuffer(" select '5' as categoryCode, id,device_code as deviceSn,null as code,null as name,'健康小屋' as deviceName from xmiot.iot_equipmet_detail where device_code like '%"+name+"%'");
            jsonArray = myJdbcTemplate.queryJson(sql.toString(),new Object[]{});