浏览代码

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

# Conflicts:
#	svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceDao.java
#	svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotPatientDeviceDao.java
mengkang 5 年之前
父节点
当前提交
052533ffdc
共有 38 个文件被更改,包括 2965 次插入222 次删除
  1. 15 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 187 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/XzyyPrescriptionService.java
  3. 10 30
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  4. 25 125
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  5. 116 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  6. 88 5
      business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java
  7. 1 1
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  8. 102 1
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  9. 488 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwGhmxDO.java
  10. 317 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwYsMzJbzdDO.java
  11. 258 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwYsMzJzLsDO.java
  12. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceDO.java
  13. 70 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotDeviceOverhaulDO.java
  14. 40 1
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/device/IotPatientDeviceDO.java
  15. 20 0
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
  16. 12 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  17. 101 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotPatientDeviceVO.java
  18. 7 0
      common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java
  19. 144 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  20. 7 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/RegisterService.java
  21. 250 2
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java
  22. 12 0
      server/svr-authentication/src/main/resources/application.yml
  23. 43 2
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  24. 6 28
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java
  25. 15 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  26. 77 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java
  27. 9 1
      svr/svr-iot/pom.xml
  28. 94 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceOverhaulController.java
  29. 85 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java
  30. 8 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceDao.java
  31. 19 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotDeviceOverhaulDao.java
  32. 4 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/device/IotPatientDeviceDao.java
  33. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceInventoryService.java
  34. 40 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOverhaulService.java
  35. 165 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java
  36. 10 10
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java
  37. 19 0
      svr/svr-iot/src/main/resources/application.yml
  38. 90 1
      svr/svr-iot/src/main/resources/bootstrap.yml

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -145,6 +145,18 @@ public class IotRequestMapping {
        public static final String updateLocation= "updateLocation";
        public static final String createPatientDevice = "createPatientDevice";
        //设备维修
        public static final String createRepairDevice = "createRepairDevice";
        public static final String getRepairDeviceList = "getRepairDeviceList";
        public static final String getDeviceInfoByDeviceSn = "getDeviceInfoByDeviceSn";
        public static final String deleteRepairDevice = "deleteRepairDevice";
        //设备检修
        public static final String getOverhaulDeviceList = "getOverhaulDeviceList";
        public static final String getOverhaulListByPatientDeviceId = "getOverhaulListByPatientDeviceId";
        public static final String delOverhaulByPatientDeviceId = "delOverhaulByPatientDeviceId";
        public static final String updateOverhaulStatusById = "updateOverhaulStatusById";
    }

+ 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;
    }
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -47,4 +47,8 @@ public interface IotPatientDeviceDao extends PagingAndSortingRepository<IotPatie
    @Query("from IotPatientDeviceDO a where a.sim = ?1 and  a.del=1 ")
    IotPatientDeviceDO findBySim(String sim);
    @Modifying
    @Query("update IotPatientDeviceDO t set t.del = ?2 where t.id = ?1")
    void updateDelById(String id, int del);
}

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

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

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

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

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

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

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

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

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

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

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

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