Forráskód Böngészése

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

wangzhinan 5 éve
szülő
commit
5f42182449

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

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

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

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

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

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

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

@ -6,12 +6,12 @@ import javax.persistence.*;
import java.util.Date;
/**
 * 眼科处方表1数据
 * 挂号明细表
 *
 * */
//@ApiModel(value = "HlwCf01VO", description = "眼科处方表1数据")
@Entity
@Table(name = "HLW_GHMX")
@Table(name = "v_hlw_ghmx")
public class HlwGhmxDO {
    private Integer sBXH;//NUMBER(18)N0识别序号

+ 2 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwYsMzJbzdDO.java

@ -7,12 +7,11 @@ import javax.persistence.Table;
import java.util.Date;
/**
 * 眼科处方表1数据
 * 疾病诊断表
 *
 * */
//@ApiModel(value = "HlwCf01VO", description = "眼科处方表1数据")
@Entity
@Table(name = "HLW_GHMX")
@Table(name = "v_hlwys_mz_jbzd")
public class HlwYsMzJbzdDO {
    private Integer jLBH;//N	NUMBER(18)	N			主键
    private Integer jZXH;//N	NUMBER(18)	N			就诊序号

+ 3 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwYsMzJzLsDO.java

@ -6,11 +6,11 @@ import javax.persistence.*;
import java.util.Date;
/**
 * 眼科处方表1数据
 * 就诊历史表
 *
 * */
@Entity
@Table(name = "v_ms_dd02")
@Table(name = "v_hlwys_mz_jzls")
public class HlwYsMzJzLsDO {
    private Integer jZXH;//NUMBER(18)N
    private Integer gHXH;//NUMBER(18)N
@ -93,6 +93,7 @@ public class HlwYsMzJzLsDO {
        this.zYZD = zYZD;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "KSSJ")
    public Date getKSSJ() {
        return kSSJ;

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

@ -148,6 +148,8 @@ public class IotRequestMapping {
        //设备维修
        public static final String createRepairDevice = "createRepairDevice";
        public static final String getRepairDeviceList = "getRepairDeviceList";
        public static final String getDeviceInfoByDeviceSn = "getDeviceInfoByDeviceSn";
        public static final String deleteRepairDevice = "deleteRepairDevice";
    }

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

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

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

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

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

@ -1,10 +1,12 @@
package com.yihu.jw.hospital.endpoint.Xzyy;
import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -53,28 +55,6 @@ public class XzyyController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 挂号
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/registerOutPatient")
    @ApiOperation(value = "挂号", notes = "挂号")
    public ObjEnvelop registerOutPatient(@ApiParam(name = "outPatientId", value = "门诊id", required = true)
                                  @RequestParam(value = "outPatientId",required = true)String outPatientId,
                                  @ApiParam(name = "doctor", value = "医生code", required = true)
                                  @RequestParam(value = "doctor",required = true)String doctor,
                                  @ApiParam(name = "chargeType", value = "号别", required = true)
                                   @RequestParam(value = "chargeType",required = true)String chargeType)throws Exception{
        try {
            return ObjEnvelop.getSuccess("ok",xzzxEntranceService.registerOutPatient(outPatientId,doctor,chargeType));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 获取单条门诊就诊记录
     * @return
@ -93,8 +73,6 @@ public class XzyyController extends EnvelopRestEndpoint {
        }
    }
    /**
     * 获取门诊下所有处方信息
     * @return

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

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

+ 54 - 5
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java

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

+ 82 - 4
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -8,18 +8,21 @@ import com.yihu.iot.service.common.ElasticSearchQueryGenerator;
import com.yihu.jw.device.LocationDataDO;
import com.yihu.jw.entity.iot.device.IotPatientDeviceDO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import io.searchbox.client.JestResult;
import iot.device.LocationDataVO;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.util.*;
@ -275,16 +278,91 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        return count;
    }
    public List<IotPatientDeviceVO> createRepairDevice(String deviceSn, Integer status, String damageDescription, String damageImages) {
    /**
     * 新增编辑维修记录
     * @param deviceSn
     * @param status
     * @param damageDescription
     * @param damageImages
     * @param repairDescription
     * @return
     */
    public List<IotPatientDeviceVO> createRepairDevice(String deviceSn, Integer status, String damageDescription, String damageImages, String repairDescription) {
        List<IotPatientDeviceDO> patientDeviceDOList = iotPatientDeviceDao.findByDeviceSn(deviceSn);
        for(IotPatientDeviceDO patientDeviceDO : patientDeviceDOList){
            patientDeviceDO.setStatus(status);
            patientDeviceDO.setDamageDescription(damageDescription);
            patientDeviceDO.setDamageImages(damageImages);
            if(StringUtils.isNotBlank(damageDescription)) {
                patientDeviceDO.setDamageDescription(damageDescription);
            }
            if(StringUtils.isNotBlank(damageImages)) {
                patientDeviceDO.setDamageImages(damageImages);
            }
            if(StringUtils.isNotBlank(repairDescription)) {
                patientDeviceDO.setRepairDescription(repairDescription);
            }
            patientDeviceDO.setUpdateTime(new Date());
        }
        iotPatientDeviceDao.save(patientDeviceDOList);
        List<IotPatientDeviceVO> patientDeviceVOS = new ArrayList<>();
        return convertToModels(patientDeviceDOList, patientDeviceVOS, IotPatientDeviceVO.class);
    }
    /**
     * 根据设备码获取相关厂商信息
     * @param deviceSn
     * @return
     */
    public List<IotPatientDeviceVO> getDeviceInfoByDeviceSn(String deviceSn) {
        String sql = "SELECT p.id,p.device_sn,p.device_id,p.device_name, GROUP_CONCAT(p.patient_name) as patientName,p.idcard,p.mobile,d.manufacturer_id, c.`name` manufacturerName,c.contacts_name, c.contacts_mobile " +
                "FROM `iot_patient_device` p, iot_device d LEFT JOIN iot_company c on d.manufacturer_id = c.id and c.status = 1 " +
                "where p.device_sn = '" + deviceSn + "' and p.del =  1 and p.device_id= d.id GROUP BY p.device_sn ";
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        return list;
    }
    /**
     * 获取设备维修记录
     * @param deviceSn
     * @param status
     * @param manufacturerId
     * @param page
     * @param pageSize
     * @return
     */
    public MixEnvelop<IotPatientDeviceVO, IotPatientDeviceVO> getRepairDeviceList(String deviceSn, Integer status, String manufacturerId, Integer page, Integer pageSize) {
        String sql ="SELECT p.device_sn,p.device_id,p.device_name,GROUP_CONCAT(p.patient_name) as patientName,p.idcard,p.mobile,p.`status`,p.damage_description,p.damage_images,p.repair_description,d.manufacturer_id, c.`name` manufacturerName,c.contacts_name, c.contacts_mobile " +
                "FROM `iot_patient_device` p, iot_device d LEFT JOIN iot_company c on d.manufacturer_id = c.id and c.status = 1 " +
                "where  p.del =  1 and p.`status` is not null and p.`status` > 0 and p.device_id= d.id ";
        if(StringUtils.isNotBlank(deviceSn)){
            sql += " and p.device_sn like '%" + deviceSn + "%' ";
        }
        if(StringUtils.isNotBlank(manufacturerId)){
            sql +=" and d.manufacturer_id = '" +manufacturerId + "' ";
        }
        if(status != null){
            sql += " and p.status = " +status;
        }else if(StringUtils.isNotBlank(manufacturerId)){
            sql +=" and p.status in (2,3,4) ";//厂商只展示三种维修状态
        }
        sql +=" GROUP BY p.device_sn ORDER BY p.update_time desc ";
        if (page != null && pageSize != null) {
            String sqlCount = "SELECT count(DISTINCT p.device_sn) " + sql.substring(sql.indexOf("FROM"), sql.length());
            Long count = jdbcTemplate.queryForObject(sqlCount, Long.class);
            sql += "limit " +(page-1)* pageSize + "," +pageSize;
            List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
            return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Device.message_success_find, list,page, pageSize,count);
        }
        List<IotPatientDeviceVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(IotPatientDeviceVO.class));
        return MixEnvelop.getSuccessList(IotRequestMapping.Device.message_success_find, list);
    }
    public void deleteRepairDevice(String deviceSn) {
        List<IotPatientDeviceDO> patientDeviceDOList = iotPatientDeviceDao.findByDeviceSn(deviceSn);
        for(IotPatientDeviceDO patientDeviceDO : patientDeviceDOList){
            patientDeviceDO.setStatus(0);
            patientDeviceDO.setUpdateTime(new Date());
        }
        iotPatientDeviceDao.save(patientDeviceDOList);
    }
}