Browse Source

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

ysj 5 years ago
parent
commit
637ec65145
54 changed files with 2553 additions and 385 deletions
  1. 15 15
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 393 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  3. 252 10
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  4. 3 2
      business/base-service/src/main/java/com/yihu/jw/hospital/ykyy/service/YkyyService.java
  5. 2 0
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  6. 27 11
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  7. 4 0
      business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java
  8. 36 62
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  9. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java
  10. 3 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyPatientRegisterTimeDO.java
  11. 3 2
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf02DO.java
  12. 14 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  13. 3 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPatientRegisterDO.java
  14. 14 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java
  15. 28 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java
  16. 68 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyAppDO.java
  17. 62 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyDO.java
  18. 23 2
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotDeviceDictDO.java
  19. 22 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotSystemDictDO.java
  20. 61 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/product/IotProductBaseInfoDO.java
  21. 33 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/product/IotProductExtendInfoDO.java
  22. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderDO.java
  23. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderRefundDO.java
  24. 335 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  25. 10 3
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  26. 11 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyOutpatientVO.java
  27. 22 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionInfoVO.java
  28. 12 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionVO.java
  29. 47 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyAppVO.java
  30. 31 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java
  31. 61 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductBaseInfoVO.java
  32. 32 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductExtendInfoVO.java
  33. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientSignInfoVO.java
  34. 33 0
      common/common-util/src/main/java/com/yihu/jw/util/common/BeanUtils.java
  35. 16 98
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  36. 24 19
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  37. 20 59
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  38. 138 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  39. 22 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java
  40. 18 13
      svr/svr-iot/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java
  41. 92 17
      svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java
  42. 15 4
      svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/IotDeviceDictController.java
  43. 2 2
      svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java
  44. 18 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyAppDao.java
  45. 10 2
      svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyDao.java
  46. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotDeviceDictDao.java
  47. 6 2
      svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotSystemDictDao.java
  48. 3 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyCertificateService.java
  49. 333 55
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java
  50. 28 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotDeviceDictService.java
  51. 42 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java
  52. 90 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/useragent/UserAgent.java
  53. 1 1
      svr/svr-iot/src/main/resources/application.yml
  54. 1 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

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

@ -270,11 +270,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if(StringUtils.isNotBlank(startTime)){
            totalSql += " AND create_time >= ? ";
            totalParams.add(startTime+" 00:00:00");
            totalParams.add(DateUtil.strToDateLong(startTime+" 00:00:00"));
        }
        if(StringUtils.isNotBlank(endTime)){
            totalSql += " AND create_time <= ? ";
            totalParams.add(endTime+" 23:59:59");
            totalParams.add(DateUtil.strToDateLong(endTime+" 23:59:59"));
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql,totalParams.toArray());
        Long count = 0L;
@ -324,11 +324,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if(StringUtils.isNotBlank(startTime)){
            sql += " AND o.create_time >= ? ";
            params.add(startTime+" 00:00:00");
            params.add(DateUtil.strToDateLong(startTime+" 00:00:00"));
        }
        if(StringUtils.isNotBlank(endTime)){
            sql += " AND o.create_time <= ? ";
            params.add(endTime+" 23:59:59");
            params.add(DateUtil.strToDateLong(endTime+" 23:59:59"));
        }
        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC LIMIT " + (page - 1) * size + "," + size + " ";
@ -452,7 +452,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
            count = Long.parseLong(rstotal.get(0).get("total").toString());
        }
        String sql ="SELECT " +
@ -692,13 +692,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //pay_status`:处方结算状态,0为未结算,1为结算成功,默认为0',
        String outPatientSql="";
        if ("1".equals(status)) {
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='13' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            sql = "UPDATE base.wlyy_prescription p SET p.status='13' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findByRealOrder(realOrder);
            jdbcTemplate.execute(sql);
        } else if ("2".equals(status)) {
            //开方成功时候,先用处方号获取本地处方状态是否为开方失败,如果是则需要更新本地的处方
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='20' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            sql = "UPDATE base.wlyy_prescription p SET p.status='20' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            //变更门诊状态
            outPatientSql="UPDATE base.wlyy_outpatient p SET p.`status`='2' WHERE p.adm_no='" + admNo + "'";
            jdbcTemplate.execute(outPatientSql);
@ -2747,7 +2747,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    " t. NAME AS \"roleName\"" +
                    " FROM " +
                    " base_doctor_role r " +
                    " JOIN base_doctor_role_dict t ON t.`code` = r.role_code " +
                    " JOIN base_doctor_role_dict t ON t.code = r.role_code " +
                    " WHERE " +
                    " r.doctor_code = '"+doctor+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
@ -2803,7 +2803,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
            if(listscore!=null&&listscore.size()>0){
                for(Map<String,Object> _listscore :listscore){
                    doctorScore += (Double)_listscore.get("score");
                    doctorScore += Double.parseDouble(_listscore.get("score").toString());
                }
            }
            doctorScore = doctorScore/3;
@ -3217,7 +3217,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "room.doctor AS doctor, " +
                "room.doctor_name AS doctorName " +
                "FROM wlyy_outpatient op,wlyy_hospital_waiting_room room " +
                "WHERE op.`status`=0 AND room.outpatient_id=op.id AND room.consult_type=2 " +
                "WHERE op.status=0 AND room.outpatient_id=op.id AND room.consult_type=2 " +
                "AND room.doctor IS NOT NULL ";
        if(StringUtils.isNoneBlank(dept)){
            waitingSql = waitingSql + " and op.dept = '"+dept+"' ";
@ -4606,7 +4606,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
        Long totalsqlAll = 0l;
        if (alltotal != null && alltotal.size() > 0) {
            totalsqlAll = (Long) alltotal.get(0).get("total");
            totalsqlAll = Long.parseLong(alltotal.get(0).get("total").toString());
        }
    
        object.put("all",totalsqlAll);
@ -4625,7 +4625,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
        Long twCount = 0l;
        if (imgtotal != null && imgtotal.size() > 0) {
            twCount = (Long) imgtotal.get(0).get("total");
            twCount = Long.parseLong(imgtotal.get(0).get("total").toString());
        }
    
        object.put("twCount",twCount);
@ -4644,7 +4644,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
        Long spcount = 0l;
        if (sptotal != null && sptotal.size() > 0) {
            spcount = (Long) sptotal.get(0).get("total");
            spcount = Long.parseLong(sptotal.get(0).get("total").toString());
        }
    
        object.put("spCount",spcount);
@ -4664,7 +4664,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
        Long xtcount = 0l;
        if (xttotal != null && xttotal.size() > 0) {
            xtcount = (Long) xttotal.get(0).get("total");
            xtcount = Long.parseLong(xttotal.get(0).get("total").toString());
        }
    
        object.put("xtCount",xtcount);
@ -4895,7 +4895,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<Map<String,Object>> findDoctorByName(String hospital, String name,String chargeType){
        String sql ="SELECT " +
                " d.id AS \"id\", " +
                " d.`name` AS \"name\"" +
                " d.name AS \"name\"" +
                " FROM " +
                " base_doctor d ";
        if(StringUtils.isNotBlank(hospital)){

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

@ -0,0 +1,393 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorOnlineTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
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.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.doctor.dao.DoctorWorkTimeDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
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.order.BusinessOrderService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.EhcHandler;
import com.ylzinfo.ehc.common.utils.DateUtils;
import com.ylzinfo.ehc.trans.TransRequest;
import com.ylzinfo.ehc.trans.TransResponse;
import jxl.write.*;
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.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.Boolean;
import java.util.*;
/**
 * Created by Trick on 2019/5/17.
 */
@Service
@Transactional
public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, PrescriptionDao> {
    private static final Logger logger = LoggerFactory.getLogger(YkyyPrescriptionService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private BasePatientMedicareCardDao basePatientMedicareCardDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private HospitalWaitingRoomDao hospitalWaitingRoomDao;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private BaseOrgDao baseOrgDao;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private PatientMappingService patientMappingService;
    @Autowired
    private DoctorMappingService doctorMappingService;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private WlyyChargeDictDao wlyyChargeDictDao;
    @Autowired
    private WlyyHospitalSysDictDao sysDictDao;
    @Autowired
    private DoctorWorkTimeDao doctorWorkTimeDao;
    @Autowired
    private PatientRegisterTimeDao patientRegisterTimeDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private WlyyDoctorClinicRoomDao wlyyDoctorClinicRoomDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private PrescriptionExpressageService sfexpressService;
    @Autowired
    private WlyyDoctorOnlineTimeDao wlyyDoctorOnlineTimeDao;
    @Autowired
    private OauthYlzConfigDao oauthYlzConfigDao;
    @Autowired
    private PatientRegisterDao patientRegisterDao;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private WlyyInspectionDao wlyyInspectionDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private SystemMessageService systemMessageService;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseDoctorPatientFollowDao baseOrgPatientDao;
    @Autowired
    private WlyyHospitalWorkRuleDao wlyyHospitalWorkRuleDao;
    @Autowired
    private BaseDoctorInfoService baseDoctorService;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Value("${demo.flag}")
    private boolean demoFlag;
    /**
     * 发起图文和视频复诊
     *
     * @param outpatientJson
     * @param expressageJson
     * @return
     * @throws Exception
     */
    public WlyyOutpatientDO appointmentRevisit(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception {
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        outpatientDO.setMjz("mz");
        outpatientDO.setStatus("0");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setOutpatientType("1");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setPayStatus(0);
        if (outpatientDO.getRegisterDate() == null) {
            outpatientDO.setRegisterDate(new Date());
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        BusinessOrderDO businessOrderDO = new BusinessOrderDO();
        businessOrderDO.setRelationCode(outpatientDO.getId());
        businessOrderDO.setRelationName("复诊-诊查费");
        businessOrderDO.setDescription("复诊-诊查费");
        businessOrderDO.setPatient(outpatientDO.getPatient());
        businessOrderDO.setPatientName(outpatientDO.getPatientName());
        businessOrderDO.setDoctor(outpatientDO.getDoctor());
        if (outpatientDO.getType().equalsIgnoreCase("1")) {
            businessOrderDO.setOrderType(1);
            businessOrderDO.setOrderCategory("2");
        } else if (outpatientDO.getType().equalsIgnoreCase("2")) {
            businessOrderDO.setOrderType(3);
            businessOrderDO.setOrderCategory("3");
        }
        businessOrderService.saveOrder(businessOrderDO);
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        try {
            //如果是视频预约咨询
            if (StringUtils.isNotBlank(registerJson)) {
                registerTimeDO = objectMapper.readValue(registerJson, WlyyPatientRegisterTimeDO.class);
                registerTimeDO.setOutpatientId(outpatient.getId());
                registerTimeDO.setCreateTime(new Date());
                patientRegisterTimeDao.save(registerTimeDO);
            }
        } catch (Exception e) {
            throw new RuntimeException("号源已经被预约,请选择其他号源");
        }
        //2.物流信息
        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class);
        expressageDO.setDel(1);
        expressageDO.setCreateTime(new Date());
        expressageDO.setOutpatientId(outpatient.getId());
        prescriptionExpressageDao.save(expressageDO);
        //3.创建候诊室
        createRoom(outpatient, chargeType);
        return outpatient;
    }
    /**
     * 创建候诊室
     *
     * @param outpatientDO
     * @return
     */
    public Boolean createRoom(WlyyOutpatientDO outpatientDO, String chargeType) {
        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO();
        waitingRoom.setDept(outpatientDO.getDept());
        waitingRoom.setDeptName(outpatientDO.getDeptName());
        waitingRoom.setHospital(outpatientDO.getHospital());
        waitingRoom.setHospitalName(outpatientDO.getHospitalName());
        //是否是有协同门诊医生
        if (StringUtils.isNotBlank(outpatientDO.getGeneralDoctor())) {
            waitingRoom.setGeneralDoctor(outpatientDO.getGeneralDoctor());
            waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName());
        }
        waitingRoom.setPatientId(outpatientDO.getPatient());
        waitingRoom.setPatientName(outpatientDO.getPatientName());
        waitingRoom.setReservationTime(outpatientDO.getRegisterDate());
        waitingRoom.setVisitStatus(0);
        //设置复诊类型
        waitingRoom.setReservationType(StringUtils.isNotBlank(outpatientDO.getOutpatientType()) ? Integer.parseInt(outpatientDO.getOutpatientType()) : 1);
        waitingRoom.setSort(0);
        waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType()));
        if (StringUtils.isNotBlank(outpatientDO.getDoctor())) {
            waitingRoom.setDoctor(outpatientDO.getDoctor());
            waitingRoom.setDoctorName(outpatientDO.getDoctorName());
        }
        waitingRoom.setOutpatientId(outpatientDO.getId());
        waitingRoom.setCreateTime(new Date());
        if (StringUtils.isNotBlank(chargeType)) {
            waitingRoom.setChargeType(chargeType);
        }
        hospitalWaitingRoomDao.save(waitingRoom);
        return true;
    }
    /**
     * 获取药品
     *
     `prescription_id` varchar(50) DEFAULT NULL COMMENT '处方code 关联表wlyy_prescription code',
     `drug_no` varchar(50) DEFAULT NULL COMMENT '药品编号',
     `drug_name` varchar(50) DEFAULT NULL COMMENT '药品名称',
     `disp_deposite` varchar(50) DEFAULT NULL COMMENT '库房号',
     `dosage` varchar(50) DEFAULT NULL COMMENT '药量',
     `quantity` varchar(50) DEFAULT NULL COMMENT '数量',
     `unit` varchar(50) DEFAULT NULL COMMENT '用量单位',
     `unit_name` varchar(50) DEFAULT NULL COMMENT '用量单位中文',
     `pack_unit` varchar(50) DEFAULT NULL COMMENT '包装单位',
     `pack_unit_name` varchar(50) DEFAULT NULL COMMENT '包装单位名称',
     `usage_code` varchar(50) DEFAULT NULL COMMENT '频率code',
     `usage_name` varchar(50) DEFAULT NULL COMMENT '频次名称',
     `supply_code` varchar(50) DEFAULT NULL COMMENT '用法',
     `supply_name` varchar(50) DEFAULT NULL COMMENT '用法名称',
     `days` varchar(50) DEFAULT NULL COMMENT '天数',
     `frequency` varchar(50) DEFAULT NULL COMMENT '组号',
     `serial` varchar(50) DEFAULT NULL COMMENT '药品序列号',
     `group_no` varchar(50) DEFAULT NULL COMMENT '库房号',
     `specification` varchar(50) DEFAULT NULL COMMENT '规格(10mgx10片/盒)',
     `pack_retprice` double(10,4) DEFAULT NULL COMMENT '包装价格',
     `herbal_count` varchar(10) DEFAULT NULL COMMENT '草药数量',
     `post_count` varchar(10) DEFAULT NULL COMMENT '贴数',
     `comm` varchar(50) DEFAULT NULL COMMENT '中药用法',
     `del` int(2) DEFAULT '1' COMMENT '1可用 0删除',
     `drug_place` varchar(100) DEFAULT NULL COMMENT '药品产地',
     `pack_quantity` int(11) DEFAULT NULL COMMENT '包装数量',
     PRIMARY KEY (`id`),
     */
    public JSONArray getDrugDictionary(String chargeCode, String pyKey, String winNo, String groupNo) throws Exception {
        List<Map<String, Object>> mapList = ykyyEntranceService.findYkYpxx(chargeCode, null, null, pyKey);
        JSONArray array = new JSONArray();
        for (Map<String,Object> map:mapList){
            JSONObject object = new JSONObject();
            object.put("charge_code",map.get("ypdm"));
            object.put("drugname",map.get("ypmc"));
            object.put("specification",map.get("yfgg"));
            object.put("pack_unit_name",map.get("yfdw"));
            object.put("pack_size",map.get("yfbz"));
            object.put("yfsx",map.get("yfsx"));//药房属性
            object.put("ypjl",map.get("ypjl"));//药剂量
            object.put("jldw",map.get("jldw"));//剂量单位
            object.put("py_code",map.get("pydm"));//拼音代码
            object.put("fyfs",map.get("fyfs"));//发药方式
            object.put("supply_code",map.get("gyff"));//给药方式
            object.put("yfzf",map.get("yfzf"));//药房作废
            object.put("supply_name",map.get("gyffmc"));//给药方式名称
            object.put("ybfl",map.get("ybfl"));//医保分类
            object.put("retprice",map.get("lsjg"));//零售价格
            object.put("kcsl",map.get("kcsl"));//库存
            object.put("ypcd",map.get("ypcd"));//产地
            object.put("zfpb",map.get("zfpb"));//作废判别
            object.put("jbywbz",map.get("jbywbz"));//基本药物标志
            object.put("ydyp",map.get("ydyp"));//药店药品
            object.put("ypmc2",map.get("ypmc2"));//药品名称2
            array.add(object);
        }
        return array;
    }
    /**
     * 获取药品用法
     */
    public JSONArray getDrugUse(String drugNo, String pyKey) throws Exception {
        List<Map<String,Object>> mapList = ykyyEntranceService.findYpyf(pyKey);
        return null;
    }
    /**
     * 医院频次
     *
     * @return
     */
    public JSONArray getDrugFrequency() throws Exception {
        return null;
    }
    /**
     * 检查模板选择接口
     *
     * @param bz_code
     * @param flag
     * @return
     * @throws Exception
     */
    public JSONArray getJcmb(String bz_code, String tc_no, String flag) throws Exception {
        return null;
    }
}

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

@ -3,6 +3,8 @@ package com.yihu.jw.hospital.prescription.service.entrance;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sun.webkit.dom.CSSStyleRuleImpl;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
@ -16,9 +18,7 @@ import com.yihu.jw.entity.base.score.BaseEvaluateDO;
import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
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.hospital.prescription.*;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
@ -27,23 +27,28 @@ 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.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.common.utils.DateUtils;
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.stereotype.Service;
import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.io.IOException;
import java.util.*;
/**
 * 眼科医院专用service
@ -58,6 +63,8 @@ public class YkyyEntranceService {
    private final static String url="http://192.168.20.55:10023/ykyy/createSQLQuery";
    private final static String saveUrl="http://192.168.20.55:10023/ykyy/save";
    private final static String orgCode ="350211A5004";
    private final static String orgName ="厦门大学附属厦门眼科中心";
@ -83,9 +90,6 @@ public class YkyyEntranceService {
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private OutpatientDao outpatientDao;
@ -101,6 +105,12 @@ public class YkyyEntranceService {
    @Autowired
    private BaseEvaluateDao baseEvaluateDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private ObjectMapper objectMapper;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
        return hibenateUtils.createSQLQuery(sql,params,page,size);
@ -576,4 +586,236 @@ public class YkyyEntranceService {
        BasePatientDO patientDO = basePatientDao.findById(patientMappingDO.getPatient());
        return patientDO;
    }
    /**
     * 查询药品信息
     * @param ypdm
     * @param ypmc
     * @param kusl
     * @return
     */
    public List<Map<String,Object>> findYkYpxx(String ypdm,String ypmc,String kusl,String pydm){
        String sql ="SELECT yp.ypxh AS \"ypxh\", yp.ypdm AS \"ypdm\", yp.ypmc AS \"ypmc\", yp.yfgg AS \"yfgg\"," +
                "yp.yfdw AS \"yfdw\"," +
                "yp.yfbz AS \"yfbz\"," +
                "yp.ypsx AS \"ypsx\"," +
                "yp.ypjl AS \"ypjl\"," +
                "yp.jldw AS \"jldw\"," +
                "yp.pydm AS \"pydm\"," +
                "yp.fyfs AS \"fyfs\"," +
                "yp.gyff AS \"gyff\"," +
                "yp.yfzf AS \"yfzf\"," +
                "yp.ybfl AS \"ybfl\"," +
                "yp.lsjg AS \"lsjg\"," +
                "yp.kcsl AS \"kcsl\"," +
                "yp.ypcd AS \"ypcd\"," +
                "yp.zfpb AS \"zfpb\"," +
                "yp.jbywbz AS \"jbywbz\"," +
                "yp.ydyp AS \"ydyp\"," +
                "yp.ypmc2 AS \"ypmc2\"," +
                "yp.gyffmc as \"gyffmc\""+  " FROM" +
                "V_ZKSG_MZ_YPXX yp where 1=1 ";
        if (StringUtils.isNoneBlank(ypdm)){
            sql+=" and yp.ypdm like '%"+ypdm+"%' ";
        }
        if (StringUtils.isNoneBlank(ypmc)){
            sql+=" and yp.ypmc like '%"+ypmc+"%' ";
        }
        if (StringUtils.isNoneBlank(kusl)){
            sql+=" and yp.kusl like '%"+kusl+"%' ";
        }
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and yp.pydm like '%"+pydm+"%' ";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;
    }
    /**
     * 查询检查项目
     *
     * @return
     */
    public List<Map<String,Object>> findYkJcxm(String pydm){
        String sql ="SELECT\n" +
                "\tmz.zlxmid AS \"zlxmid\",\n" +
                "\tmz.xmmc AS \"xmmc\",\n" +
                "\tmz.pydm AS \"pydm\",\n" +
                "\tmz.wbdm AS \"wbdm\",\n" +
                "\tmz.jxdm AS \"jxdm\",\n" +
                "\tmz.qtdm AS \"qtdm\",\n" +
                "\tmz.ydyzlb AS \"ydyzlb\",\n" +
                "\tmz.mlbh AS \"mlbh\",\n" +
                "\tmz.zxpc AS \"zxpc\",\n" +
                "\tmz.jfpc AS \"jfpc\",\n" +
                "\tmz.jsfs AS \"jsfs\",\n" +
                "\tmz.jszq AS \"jszq\",\n" +
                "\tmz.jsdw AS \"jsdw\",\n" +
                "\tmz.syxb AS \"syxb\",\n" +
                "\tmz.mxsy AS \"mxsy\",\n" +
                "\tmz.zysy AS \"zysy\",\n" +
                "\tmz.tjsy AS \"tjsy\",\n" +
                "\tmz.zxlb AS \"zxlb\",\n" +
                "\tmz.zxks AS \"zxks\",\n" +
                "\tmz.zxgzid AS \"zxgzid\",\n" +
                "\tmz.ywzx AS \"ywzx\",\n" +
                "\tmz.zxap AS \"zxap\",\n" +
                "\tmz.cpzx AS \"cpzx\",\n" +
                "\tmz.szzx AS \"szzx\",\n" +
                "\tmz.jjlx AS \"jjlx\",\n" +
                "\tmz.ycxzsl AS \"ycxzsl\",\n" +
                "\tmz.yblx AS \"yblx\",\n" +
                "\tmz.zxbz AS \"zxbz\",\n" +
                "\tmz.txid AS \"txid\",\n" +
                "\tmz.bgbh AS \"bgbh\",\n" +
                "\tmz.czsy AS \"czsy\",\n" +
                "\tmz.lzsy AS \"lzsy\",\n" +
                "\tmz.lccs AS \"lccs\",\n" +
                "\tmz.bwbz AS \"bwbz\",\n" +
                "\tmz.yblb AS \"yblb\"\n" +
                "FROM\n" +
                "\tV_ZKSG_JCXM_MZ wher 1=1 ";
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and pydm = '%"+pydm+"%'";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;
    }
    /**
     * 获取频次
     * @return
     */
    public List<Map<String,Object>> findSypc(String pcbm){
        String sql = "select s.pcbm as \"pcbm\",s.pcmc as \"pcmc\",s.pcmc1 as \"pcmc1\" from v_hlw_sypc s where 1=1 ";
        if (StringUtils.isNoneBlank(pcbm)){
            sql+=" and s.pcbm='"+pcbm+"' ";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;
    }
    /**
     * 获取用法
     * @return
     */
    public List<Map<String,Object>> findYpyf(String pydm){
        String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1 ";
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and y.pydm='"+pydm+"' ";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;
    }
    public String findByRealOrder(String code) throws Exception {
        List<WlyyPrescriptionDO>  wlyyPrescriptionDOs = prescriptionDao.findByPatientCode(code);
        if (wlyyPrescriptionDOs!=null&&wlyyPrescriptionDOs.size()!=0){
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOs.get(0);
            JSONObject objectString = (JSONObject) JSONObject.toJSON(wlyyPrescriptionDO);
            WlyyPrescriptionVO prescriptionVO =  JSONObject.toJavaObject(objectString,WlyyPrescriptionVO.class);
            List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = prescriptionInfoDao.findByPrescriptionId(wlyyPrescriptionDO.getId());
            List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
            for (WlyyPrescriptionInfoDO wlyyPrescriptionInfoDO:wlyyPrescriptionInfoDOS){
                JSONObject object = (JSONObject) JSONObject.toJSON(wlyyPrescriptionInfoDO);
                WlyyPrescriptionInfoVO prescriptionInfoVO = JSONObject.toJavaObject(object,WlyyPrescriptionInfoVO.class);
                wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
            }
            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            synPrecriptionHis(prescriptionVO);
        }
        return null;
    }
    public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO) throws Exception {
        HlwCf01DO hlwCf01DO = new HlwCf01DO();
        if (wlyyPrescriptionVO!=null){
            hlwCf01DO.setSPZT(0);
            hlwCf01DO.setFKZT(wlyyPrescriptionVO.getPayStatus());
            hlwCf01DO.setYFSB(3);
            hlwCf01DO.setCFLX(wlyyPrescriptionVO.getType());
            hlwCf01DO.setKFRQ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
            hlwCf01DO.setZFPB(1);
            hlwCf01DO.setFYBZ(0);
            hlwCf01DO.setPYBZ(0);
            hlwCf01DO.setDJYBZ(0);
            hlwCf01DO.setCFTS(1);
            hlwCf01DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
            hlwCf01DO.setYXPB(1);
            hlwCf01DO.setSCDDH(wlyyPrescriptionVO.getOrderNo());
            String patient = wlyyPrescriptionVO.getPatientCode();
            PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
            hlwCf01DO.setBRID(Integer.parseInt(patientMappingDO.getMappingCode()));
            hlwCf01DO.setBRXM(wlyyPrescriptionVO.getPatientName());
            hlwCf01DO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
            String doctor = wlyyPrescriptionVO.getDoctor();
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
            hlwCf01DO.setYSDM(doctorMappingDO.getMappingCode());
            hlwCf01DO.setJZKH(wlyyPrescriptionVO.getSsc());
            hlwCf01DO.setGUID(getCode());
            hibenateUtils.save(hlwCf01DO);
           /* String jsonString = JSONObject.toJSONString(hlwCf01DO);
            Map<String,Object> params = new HashedMap();
            params.put("json",jsonString);
            params.put("table","HLW_CF01");
            logger.info("HLW_CF01:"+jsonString);
            HttpResponse response = HttpUtils.doGet(url,params);
            if (response.getStatus()==200){
                logger.info("表HLW_CF01同步成功!");
            }else {
                logger.info("表HLW_CF01同步失败!"+response.getErrorMsg());
            }*/
            List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
            for (WlyyPrescriptionInfoVO wlyyPrescriptionInfoVO:wlyyPrescriptionInfoVOS){
                HlwCf02DO hlwCf02DO = new HlwCf02DO();
                hlwCf02DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
                hlwCf02DO.setYPXH(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugNo()));
                hlwCf02DO.setYPCD(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugPlace()));
                hlwCf02DO.setXMLX(1);
                hlwCf02DO.setCFTS(1);
                hlwCf02DO.setYPSL(Integer.parseInt(wlyyPrescriptionInfoVO.getQuantity()));
                hlwCf02DO.setYPDJ(wlyyPrescriptionInfoVO.getPackRetprice().intValue());
                hlwCf02DO.setHJJE(Integer.parseInt(wlyyPrescriptionInfoVO.getQuantity())*wlyyPrescriptionInfoVO.getPackRetprice().intValue());//划价价额
                hlwCf02DO.setYPZS(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));
                hlwCf02DO.setYCSL("0");
                hlwCf02DO.setFYGB(17);//费用归并
                hlwCf02DO.setZFBL(1);//自负比例
                hlwCf02DO.setYFDW(wlyyPrescriptionInfoVO.getPackUnitName());
                hlwCf02DO.setMRCS(Integer.parseInt(wlyyPrescriptionInfoVO.getDosage()));//每日次数
                hlwCf02DO.setYFBZ(wlyyPrescriptionInfoVO.getPackQuantity());
                hlwCf02DO.setYPYF(wlyyPrescriptionInfoVO.getUsageCode());
                hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));
                hlwCf02DO.setYFGG(wlyyPrescriptionInfoVO.getSpecification());
                hibenateUtils.save(hlwCf02DO);
              /*  String jsonString1 = JSONObject.toJSONString(hlwCf01DO);
                Map<String,Object> params1 = new HashedMap();
                params1.put("json",jsonString1);
                params1.put("table","HLW_CF02");
                logger.info("HLW_CF02:"+jsonString1);
                HttpResponse response1 = HttpUtils.doGet(url,params1);
                if (response1.getStatus()==200){
                    logger.info("表HLW_CF02同步成功!");
                }else {
                    logger.info("表HLW_CF02同步失败!"+response1.getErrorMsg());
                }
*/
            }
        }
        return null;
    }
    public String getCode() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
}

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

@ -15,6 +15,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.net.URLEncoder;
import java.util.Map;
/**
@ -184,10 +185,10 @@ public class YkyyService {
            url+="&pay_accout="+payAccount;
        }
        if (StringUtils.isNoneBlank(pcCallbackUrl)){
            url+="&pc_callback_url="+pcCallbackUrl;
            url+="&pc_callback_url="+ URLEncoder.encode(pcCallbackUrl);
        }
        if (StringUtils.isNoneBlank(appCallbackUrl)){
            url+="&app_callback_url="+appCallbackUrl;
            url+="&app_callback_url="+URLEncoder.encode(appCallbackUrl);
        }
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通新增订单接口:"+response);

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

@ -289,6 +289,8 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
        JSONArray jsonArray = new JSONArray();
        jsonArray.add(jb);
        logger.info("入参:"+jsonArray.toJSONString()+"入参:"+jb.toJSONString());
        String token = upNsUserToken(url);
        String res = postToInter(token, api, jsonArray,url);

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

@ -10,10 +10,12 @@ import com.yihu.jw.entity.base.wx.WxPayLogDO;
import com.yihu.jw.entity.base.wx.WxWechatDO;
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.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.ykyy.service.YkyyService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
@ -68,6 +70,8 @@ public class BusinessOrderService {
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private ConsultOrderDao consultOrderDao;
    @Autowired
    private OutpatientDao outpatientDao;
@ -82,6 +86,7 @@ public class BusinessOrderService {
        businessOrderDO.setStatus(0);
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        businessOrderDO.setUploadStatus(0);
        businessOrderDO.setPayType(1);
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/onlineChat/zjzx");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/doctor/consult");
@ -89,6 +94,12 @@ public class BusinessOrderService {
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/onlineChat/twzs");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/doctor/review");
        }
        List<WlyyHospitalSysDictDO> hospitalSysDictDOS = hospitalSysDictDao.findByDictName("WX_MONEY");
        String totalFee = null;
        if (hospitalSysDictDOS!=null&&hospitalSysDictDOS.size()!=0){
            totalFee= hospitalSysDictDOS.get(0).getDictValue();
        }
        businessOrderDO.setPayPrice(StringUtils.isNoneBlank(totalFee)?Double.parseDouble(totalFee):0.0);
        businessOrderDO = businessOrderDao.save(businessOrderDO);
        String patient = businessOrderDO.getPatient();
        BasePatientDO basePatientDO = patientDao.findById(patient);
@ -104,15 +115,20 @@ public class BusinessOrderService {
        String orderCatagrate = businessOrderDO.getOrderCategory();
        String pcCallBack=businessOrderDO.getPcCallbackUrl();
        String appCallBack = businessOrderDO.getAppCallbackUrl();
        String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
        String yktDoctor ="";
        JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
        if (jsonObject.getInteger("code")==200){
            JSONArray array = jsonObject.getJSONArray("data");
            if (array!=null&&array.size()!=0){
                yktDoctor=array.getJSONObject(0).getString("DOCTORUSERID");
        if (doctorMappingDO!=null&&StringUtils.isNoneBlank(doctorMappingDO.getMappingCode())){
            String doctorResponse = ykyyService.getYktDoctor(doctorMappingDO.getMappingCode());
            JSONObject jsonObject = JSONObject.parseObject(doctorResponse);
            if (jsonObject.getInteger("code")==200){
                JSONArray array = jsonObject.getJSONArray("data");
                if (array!=null&&array.size()!=0){
                    yktDoctor=array.getJSONObject(0).getString("DOCTORUSERID");
                }
            }
        }else {
            throw new Exception("医生映射表不存在!");
        }
        String response=ykyyService.addYktOrder(orderNo,patientId,orderAmout,description,state,orderType,yktDoctor,payType,null,patientTel,orderCatagrate,pcCallBack,appCallBack);
        JSONObject object = JSONObject.parseObject(response);
        if (object.getInteger("code")==200){
@ -205,11 +221,7 @@ public class BusinessOrderService {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        String body = businessOrderDO.getDescription();
        List<WlyyHospitalSysDictDO> hospitalSysDictDOS = hospitalSysDictDao.findByDictName("WX_MONEY");
        String totalFee = null;
        if (hospitalSysDictDOS!=null&&hospitalSysDictDOS.size()!=0){
            totalFee= hospitalSysDictDOS.get(0).getDictValue();
        }
        String totalFee = businessOrderDO.getPayPrice().intValue()+"";
        String patient = businessOrderDO.getPatient();
        String openid = "";
        if (StringUtils.isNoneBlank(patient)){
@ -463,6 +475,10 @@ public class BusinessOrderService {
                    ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
                    consultDo.setPayStatus(1);
                    consultOrderDao.save(consultDo);
                }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                    wlyyOutpatientDO.setPayStatus(1);
                    outpatientDao.save(wlyyOutpatientDO);
                }
            }
            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),businessOrderDO.getStatus().toString());

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java

@ -2,6 +2,7 @@ package com.yihu.jw.utils.hibernate;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -158,7 +159,10 @@ public class HibenateUtils {
    public void save(Object object) {
        Session session = (Session) entityManager.getDelegate();
        Transaction transaction = session.beginTransaction();
        transaction.begin();
        session.save(object);
        transaction.commit();
    }
}

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

@ -175,28 +175,21 @@ public class ImService {
	 * @return
	 */
	public List<Map<String,Object>>  findConsultRecordByPatient(String patient, String id,String type, int page,int pagesize, String title,Integer status,Integer payStatus) {
	/*	if(page >=1){
			page --;
		}
		
		if (pagesize <= 0) {
			pagesize = 10;
		}*/
		
		String  sql = "SELECT " +
				"a.id AS \"id\"," +
				"a.type AS \"type\"," +
				"a.title AS \"title\"," +
				"a.symptoms AS \"symptoms\"," +
				"a.czrq AS \"czrq\"," +
				"to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\"," +
				"b.status AS \"status\"," +
				"b.evaluate AS \"evaluate\"," +
				"d.name AS \"doctorName\"," +
				"d.photo AS \"doctorphoto\"," +
				"d.job_title_name AS \"jobTitleName\", " +
				"h.dept_name AS \"deptName\" " +
				"a.pay_status AS \"payStatus\","+
				"h.dept_name AS \"deptName\", " +
				"a.pay_status AS \"payStatus\" "+
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_doctor d, " +
@ -228,7 +221,7 @@ public class ImService {
		if (!StringUtils.isEmpty(payStatus)) {
			sql += " and a.pay_status = " + payStatus + "";
		}
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		sql += " ORDER BY a.czrq desc ";
		List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pagesize);
		/*result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));*/
		return result;
@ -264,7 +257,7 @@ public class ImService {
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
		Long count = 0L;
		if (rstotal != null && rstotal.size() > 0) {
			count = (Long) rstotal.get(0).get("total");
			count = Long.parseLong(rstotal.get(0).get("total").toString());
		}
		
		return count;
@ -286,9 +279,9 @@ public class ImService {
				"AND b.to_doctor='" +doctor+"' "+
				"AND a.del='1' " +
				"AND (a.type<> 9 or a.type<> 16)" +
				"AND a.`status`=0";
				"AND a.status=0";
		
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		
		String consultCode = "";
		if (rstotal != null && rstotal.size() > 0) {
@ -324,9 +317,9 @@ public class ImService {
				"AND a.actual_sender='" +general_doctor+"' "+
				"AND a.del='1' " +
				"AND a.type<> 12 " +
				"AND a.`status`=0";
				"AND a.status=0";
		
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		
		String consultCode = "";
		String specialDoctor = "";
@ -1437,7 +1430,11 @@ public class ImService {
		
		ConsultTeamDo consultTeamDo = consultTeamDao.findByConsult(consult);
		
		ConsultDo consultDo = consultDao.findOne(consult);
		
		object.put("doctorCode",consultTeamDo.getDoctor());
		//支付状态
		object.put("payStatus",consultDo.getPayStatus());
		
		return object;
	}
@ -1481,7 +1478,7 @@ public class ImService {
	 */
	public String getConsultCodeByOutpatientId(String outpatientid) {
		String totalSql = "SELECT id FROM wlyy_consult WHERE relation_code='"+outpatientid+"' ";
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		String id = "";
		if (rstotal != null && rstotal.size() > 0) {
			id = rstotal.get(0).get("id").toString();
@ -1496,7 +1493,7 @@ public class ImService {
	 */
	public String getOutpatientidByConsoultCode(String consult) {
		String totalSql = "SELECT relation_code as \"relation_code\" FROM wlyy_consult WHERE id='"+consult+"' ";
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		String id = "";
		if (rstotal != null && rstotal.size() > 0) {
			id = rstotal.get(0).get("relation_code").toString();
@ -1595,7 +1592,7 @@ public class ImService {
				"a.score as \"score\"," +
				"a.score_type as \"score_type\"," +
				"a.content as \"content\"," +
				"b.create_time as \"create_time\"," +
				"to_char(b.create_time,'YYYY-MM-DD hh24:mi:ss')  AS \"create_time\"," +
				"c.type as \"type\"," +
				"c.name as \"patientname\"," +
				"b.id as \"id\"," +
@ -1607,7 +1604,7 @@ public class ImService {
				"LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code " +
				"WHERE a.relation_code=b.id "+
				"AND c.consult='"+consult+"'";
		List<Map<String,Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList);
		List<Map<String,Object>> scoreList = hibenateUtils.createSQLQuery(sqlScoreList);
		if(scoreList.isEmpty()){
			return null;
		}else{
@ -1693,19 +1690,11 @@ public class ImService {
	 * @param end_time 结束时间
	 * @return
	 */
	public List<ConsultVO>  findConsultRecordByDoctor(String doctor, String id,
	public List<Map<String,Object>>  findConsultRecordByDoctor(String doctor, String id,
	                                                  String type, Integer status,
	                                                  int page,int pagesize,
	                                                  String title,String start_time,String end_time) {
		
		if(page >=1){
			page --;
		}
		
		if (pagesize <= 0) {
			pagesize = 10;
		}
		
		String  sql = "";
		//专家咨询
		if("1".equals(type) || "15".equals(type) || type.contains(",")){
@ -1714,7 +1703,7 @@ public class ImService {
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"d.name AS \"patientName\"," +
@ -1734,7 +1723,7 @@ public class ImService {
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"d.name AS \"patientName\"," +
@ -1755,10 +1744,6 @@ public class ImService {
		}
		
		
		
		List<ConsultVO> result = new ArrayList<>();
		
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			sql +=" and a.title like '"+title+"'";
@ -1792,10 +1777,9 @@ public class ImService {
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		sql += " ORDER BY a.czrq desc ";
		
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		return result;
		return hibenateUtils.createSQLQuery(sql,page,pagesize);
	}
	
	/**
@ -1855,7 +1839,7 @@ public class ImService {
			sql += " and a.id = '" + id + "'";
		}
		
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(sql);
		Long count = 0L;
		if (rstotal != null && rstotal.size() > 0) {
			count = (Long) rstotal.get(0).get("total");
@ -2087,25 +2071,17 @@ public class ImService {
	 * @param end_time 结束时间
	 * @return
	 */
	public List<ConsultVO>  findexpertConsultRecordByDoctor(String doctor, String id,
	public List<Map<String,Object>>   findexpertConsultRecordByDoctor(String doctor, String id,
	                                                  Integer type, Integer status,
	                                                  int page,int pagesize,
	                                                  String title,String start_time,String end_time,String patinet) {
		
		if(page >=1){
			page --;
		}
		
		if (pagesize <= 0) {
			pagesize = 10;
		}
		
		String  sql = "SELECT " +
				"a.id AS \"id\"," +
				"a.type AS \"type\"," +
				"a.title AS \"title\"," +
				"a.symptoms AS \"symptoms\"," +
				"a.czrq AS \"czrq\"," +
				"to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\"," +
				"b.status AS \"status\"," +
				"b.evaluate AS \"evaluate\"," +
				"d.name AS \"patientName\"," +
@ -2157,11 +2133,11 @@ public class ImService {
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		sql += " ORDER BY a.czrq desc ";
		
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
//		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		
		return result;
		return hibenateUtils.createSQLQuery(sql,page,pagesize);
	}
	
	
@ -2262,7 +2238,7 @@ public class ImService {
		
		String sql = "id AS \"id\",session_id AS \"session_id\",sender_id AS \"sender_id\",sender_name AS \"sender_name\",content_type AS \"content_type\",content AS \"content\",timestamp AS \"timestamp\"  from " + data_base_name + "." +
				tableName + " where id in(" + content + ") order by timestamp desc ";
		List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
		List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
		com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray();
		for (int i = 0; i < list.size(); i++) {
			Map<String, Object> map = list.get(i);
@ -2400,7 +2376,7 @@ public class ImService {
	 * @param type
	 * @return
	 */
	public List<ConsultVO> doctorUpcomingList(String doctorCode, String type) {
	public List<Map<String,Object>> doctorUpcomingList(String doctorCode, String type) {
		String sql = "";
		if("1,15".equals(type)) {
			sql = "SELECT " +
@ -2408,7 +2384,7 @@ public class ImService {
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"to_char(a.czrq,'YYYY-MM-DD hh24:mi:ss')  AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"b.doctor AS \"doctorCode\"," +
@ -2440,7 +2416,7 @@ public class ImService {
					"patient.sex AS \"patientsex\"," +
					"patient.photo AS \"patientphoto\"," +
					"op.id AS \"outpatientid\"," +
					"op.register_date AS \"registerDate\"," +
					"to_char(op.register_date,'YYYY-MM-DD hh24:mi:ss')  AS \"registerDate\"," +
					"op.status AS outpatientstatus " +
					"FROM wlyy_outpatient op," +
					"base_patient patient " +
@ -2463,9 +2439,7 @@ public class ImService {
			sql =sql +" ORDER BY op.create_time DESC";
		}
		
		List<ConsultVO> result = new ArrayList<>();
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		return result;
		return hibenateUtils.createSQLQuery(sql);
	}
	
	/**
@ -2492,10 +2466,10 @@ public class ImService {
		//医生角色
		String sql = "SELECT " +
				"count(id) AS \"total\"," +
				"doctor " +
				"doctor as \"doctor\"" +
				"FROM wlyy_consult_team " +
				"WHERE doctor IN ("+doctorids+") AND (type=1 OR type=15) and status = 0 GROUP BY doctor";
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
		return list;
	}
}

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java

@ -203,6 +203,7 @@ public class ConsultTeamDo extends UuidIdentityEntity {
		this.voice = voice;
	}
	
	@Column(name = "consult_comment")
	public String getComment() {
		return comment;
	}

+ 3 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyPatientRegisterTimeDO.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.hospital.doctor;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@ -99,7 +100,8 @@ public class WlyyPatientRegisterTimeDO extends UuidIdentityEntity {
    public void setTimeType(String timeType) {
        this.timeType = timeType;
    }
    
    @Column(name = "register_date")
    public String getDate() {
        return date;
    }

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

@ -10,7 +10,8 @@ import java.util.Date;
 *
 * */
@Entity
@Table(name = "HLW_CF02", catalog = "model")
@Table(name = "HLW_CF02")
@SequenceGenerator(name="id_generated", sequenceName="HLW_CF02_SEQ")
public class HlwCf02DO {
    private Integer sBXH;//NUMBER(18)   N注释
    private Integer cFSB;//NUMBER(18)   N识别序号
@ -57,7 +58,7 @@ public class HlwCf02DO {
    private String tHYY;//VARCHAR2(200) Y退回原因
    @Basic
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
    @Id
    @Column(name = "SBXH")
    public Integer getSBXH() {

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

@ -226,6 +226,11 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
     */
    private String evaluateStatus;
    /**
     * 付款状态0未付款1付款
     */
    private Integer payStatus;
	@Column(name = "adm_no")
    public String getAdmNo() {
@ -574,4 +579,13 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    @Column(name = "pay_status")
    public Integer getPayStatus() {
        return payStatus;
    }
    public void setPayStatus(Integer payStatus) {
        this.payStatus = payStatus;
    }
}

+ 3 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPatientRegisterDO.java

@ -2,6 +2,7 @@ package com.yihu.jw.entity.hospital.prescription;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@ -55,7 +56,8 @@ public class WlyyPatientRegisterDO extends UuidIdentityEntity {
    public void setRegisterNo(String registerNo) {
        this.registerNo = registerNo;
    }
    
    @Column(name = "register_date")
    public String getDate() {
        return date;
    }

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

@ -228,6 +228,11 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
     */
    private Double regFee;
    /**
     * 订单号
     */
    private String orderNo;
    @Column(name = "outpatient_id")
    public String getOutpatientId() {
        return outpatientId;
@ -554,4 +559,13 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
    public void setRegFee(Double regFee) {
        this.regFee = regFee;
    }
    @Column(name = "order_no")
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
}

+ 28 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java

@ -137,6 +137,16 @@ public class WlyyPrescriptionInfoDO extends UuidIdentityEntity {
     */
    private String comm;
    /**
     * 药品产地
     */
    private String drugPlace;
    /**
     * 药房包装
     */
    private Integer packQuantity;
    @Column(name = "prescription_id")
    public String getPrescriptionId() {
@ -342,4 +352,22 @@ public class WlyyPrescriptionInfoDO extends UuidIdentityEntity {
    public void setComm(String comm) {
        this.comm = comm;
    }
    @Column(name = "drug_place")
    public String getDrugPlace() {
        return drugPlace;
    }
    public void setDrugPlace(String drugPlace) {
        this.drugPlace = drugPlace;
    }
    @Column(name = "pack_quantity")
    public Integer getPackQuantity() {
        return packQuantity;
    }
    public void setPackQuantity(Integer packQuantity) {
        this.packQuantity = packQuantity;
    }
}

+ 68 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyAppDO.java

@ -0,0 +1,68 @@
package com.yihu.jw.entity.iot.company;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/4/27
 */
@Entity
@Table(name = "iot_company_app")
public class IotCompanyAppDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name = "saas_id")
    private String saasId;//
    @Column(name = "name")
    private String name;//应用名称',
    @Column(name = "company_id")
    private String companyId;//公司ID
    @Column(name = "company_name")
    private String companyName;
    @Column(name = "address_ip")
    private String addressIp;//访问IP地址
    @Column(name = "del")
    private String del;//是否删除 0:删除  1:不删除
    public IotCompanyAppDO() {
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saas_id) {
        this.saasId = saas_id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getCompanyId() {
        return companyId;
    }
    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }
    public String getAddressIp() {
        return addressIp;
    }
    public void setAddressIp(String addressIp) {
        this.addressIp = addressIp;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public String getCompanyName() {
        return companyName;
    }
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
}

+ 62 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/company/IotCompanyDO.java

@ -62,6 +62,20 @@ public class IotCompanyDO extends UuidIdentityEntityWithOperator implements Seri
    @Transient
    private List<IotCompanyTypeDO> typeList;//类型
    //    新增加的字段
    @Column(name = "enter_type")
    private String enterType;//厂商入驻类型 1:供应商  2:代理商 3:厂商
    @Column(name = "account_type")
    private String accountType;//注册类型(1:厂商注册  0:平台注册)
    @Column(name = "audit_message")
    private String auditMessage;//审核不通过信息说明
    @Column(name = "audit_time")
    private Date auditTime;//审核时间
    @Column(name = "audit_name")
    private String auditName;//审核人姓名
    @Transient
    private List<IotCompanyAppDO> appList;//应用实体
    public String getSaasId() {
        return saasId;
    }
@ -230,4 +244,52 @@ public class IotCompanyDO extends UuidIdentityEntityWithOperator implements Seri
    public void setTypeList(List<IotCompanyTypeDO> typeList) {
        this.typeList = typeList;
    }
    public String getEnterType() {
        return enterType;
    }
    public void setEnterType(String enterType) {
        this.enterType = enterType;
    }
    public String getAccountType() {
        return accountType;
    }
    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }
    public String getAuditMessage() {
        return auditMessage;
    }
    public void setAuditMessage(String auditMessage) {
        this.auditMessage = auditMessage;
    }
    public Date getAuditTime() {
        return auditTime;
    }
    public void setAuditTime(Date auditTime) {
        this.auditTime = auditTime;
    }
    public String getAuditName() {
        return auditName;
    }
    public void setAuditName(String auditName) {
        this.auditName = auditName;
    }
    public List<IotCompanyAppDO> getAppList() {
        return appList;
    }
    public void setAppList(List<IotCompanyAppDO> appList) {
        this.appList = appList;
    }
}

+ 23 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotDeviceDictDO.java

@ -20,10 +20,10 @@ public class IotDeviceDictDO extends UuidIdentityEntityWithOperator implements S
    private String saasId;
    @Column(name = "device_type")
    private String deviceType;//设备种类
    private String deviceType;//设备种类,iot_system_dict表的id
    @Column(name = "name")
    private String name;//设备种类名称
    private String name;//设备种类名称,iot_system_dict表的value
    @Column(name = "data_type")
    private String dataType;//测量数据种类
@ -31,6 +31,11 @@ public class IotDeviceDictDO extends UuidIdentityEntityWithOperator implements S
    @Column(name = "data_type_name")
    private String dataTypeName;//测量数据种类名称
    @Column(name = "unit")
    private String unit;//单位
    @Column(name = "field")
    private String field;//对应字段
    @Column(name = "del")
    private Integer del;//删除标志
@ -84,4 +89,20 @@ public class IotDeviceDictDO extends UuidIdentityEntityWithOperator implements S
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getUnit() {
        return unit;
    }
    public void setUnit(String unit) {
        this.unit = unit;
    }
    public String getField() {
        return field;
    }
    public void setField(String field) {
        this.field = field;
    }
}

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

@ -5,6 +5,7 @@ import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
/**
@ -29,6 +30,10 @@ public class IotSystemDictDO extends UuidIdentityEntityWithOperator implements S
    private Long sort;//排序
    @Column(name = "del")
    private Integer del;//删除标志
    @Column(name = "parent_code")
    private String parentCode;
    @Transient
    private String parentName;//父类字典名称
    public String getSaasId() {
        return saasId;
@ -85,4 +90,21 @@ public class IotSystemDictDO extends UuidIdentityEntityWithOperator implements S
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getParentCode() {
        return parentCode;
    }
    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }
    @Transient
    public String getParentName() {
        return parentName;
    }
    public void setParentName(String parentName) {
        this.parentName = parentName;
    }
}

+ 61 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/product/IotProductBaseInfoDO.java

@ -62,6 +62,19 @@ public class IotProductBaseInfoDO extends UuidIdentityEntityWithOperator impleme
    private String certificateName;//授权书名称
    @Column(name = "del")
    private Integer del;//删除标志
    //以下为新增的字段
    @Column(name = "register_name")
    private String registerName;//注册名称
    @Column(name = "spec")
    private String spec;//规格
    @Column(name = "unit")
    private String unit;//单位
    @Column(name = "purchase_price")
    private Double purchasePrice;//进货价
    @Column(name = "retail_price")
    private Double retailPrice;//零售价格
    @Column(name = "category_code")
    private String categoryCode;//设备类型标识
    public String getSaasId() {
        return saasId;
@ -246,4 +259,52 @@ public class IotProductBaseInfoDO extends UuidIdentityEntityWithOperator impleme
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getRegisterName() {
        return registerName;
    }
    public void setRegisterName(String registerName) {
        this.registerName = registerName;
    }
    public String getSpec() {
        return spec;
    }
    public void setSpec(String spec) {
        this.spec = spec;
    }
    public String getUnit() {
        return unit;
    }
    public void setUnit(String unit) {
        this.unit = unit;
    }
    public Double getPurchasePrice() {
        return purchasePrice;
    }
    public void setPurchasePrice(Double purchasePrice) {
        this.purchasePrice = purchasePrice;
    }
    public Double getRetailPrice() {
        return retailPrice;
    }
    public void setRetailPrice(Double retailPrice) {
        this.retailPrice = retailPrice;
    }
    public String getCategoryCode() {
        return categoryCode;
    }
    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }
}

+ 33 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/product/IotProductExtendInfoDO.java

@ -6,6 +6,7 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 产品扩展信息表
@ -36,6 +37,14 @@ public class IotProductExtendInfoDO extends UuidIdentityEntityWithOperator imple
    @Column(name = "del")
    private Integer del;//删除标志
    //以下为增加的字段
    @Column(name = "company_name")
    private String companyName;//生产企业名称
    @Column(name = "ratify_date")
    private Date ratifyDate;//批准日期
    @Column(name = "agency_name")
    private String agencyName;//代理人
    public String getSaasId() {
        return saasId;
    }
@ -115,4 +124,28 @@ public class IotProductExtendInfoDO extends UuidIdentityEntityWithOperator imple
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getCompanyName() {
        return companyName;
    }
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    public Date getRatifyDate() {
        return ratifyDate;
    }
    public void setRatifyDate(Date ratifyDate) {
        this.ratifyDate = ratifyDate;
    }
    public String getAgencyName() {
        return agencyName;
    }
    public void setAgencyName(String agencyName) {
        this.agencyName = agencyName;
    }
}

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

@ -17,7 +17,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "base_business_order_pay")
@SequenceGenerator(name="id_generated", sequenceName="BASE_BUSINESS_ORDER_PAY_SEQ")
@SequenceGenerator(name="id_generated", sequenceName="SEQ_BASE_BUSINESS_ORDER_PAY")
public class BusinessOrderDO extends IntegerIdentityEntity {
    private String patient;//居民code

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/order/BusinessOrderRefundDO.java

@ -15,7 +15,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "base_business_order_refund")
@SequenceGenerator(name="id_generated", sequenceName="BASE_BUSINESS_ORDER_REFUND_SEQ")
@SequenceGenerator(name="id_generated", sequenceName="SEQ_BASE_BUSINESS_ORDER_REFUND")
public class BusinessOrderRefundDO extends IntegerIdentityEntity {
    private String patient;//居民code

+ 335 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -369,6 +369,341 @@ public class BaseHospitalRequestMapping {
    }
    public static class YkyyPrescription extends BaseHospitalRequestMapping.Basic {
        public static final String PREFIX  = "/ykyyPrescription";
        //=====================start=======================================
        /**
         * 获取门诊记录
         */
        public static final String findOutpatientList = "/findOutpatientList";
        /**
         * 查询单条门诊记录接口
         */
        public static final String findOutpatientInfo ="/findOutpatientInfo";
        /**
         * 查询单条复诊信息全部接口
         */
        public static final String findReOutpatientInfo = "/findReOutpatientInfo";
        /**
         * 获取复诊记录类别
         */
        public static final String findReOutpatientList ="/findReOutpatientList";
        /**
         * 查询患者就诊卡
         */
        public static final String findPatientCard = "/findPatientCard";
        /**
         * 判断是否可用发起门诊
         */
        public static final String checkOutpatient ="/checkOutpatient";
        /**
         * 居民发起复诊
         */
        public static final String appointmentRevisit = "/appointmentRevisit";
        /**
         * 查询所有机构
         */
        public static final String findAllHospital ="/findAllHospital";
        /**
         * 查询机构底下部门
         */
        public static final String findDeptByHospital ="/findDeptByHospital";
        /**
         * 查询有所有已开放的科室
         */
        public static final String findDeptByKeyWord ="/findDeptByKeyWord";
        /**
         * 查询部门下医生
         */
        public static final String findDoctorByHospitalAndDept = "/findDoctorByHospitalAndDept";
        /**
         * 根据疾病名称,热门部门查询医生
         */
        public static final String findDoctorByHospitalAndDiseaseAndDept = "/findDoctorByHospitalAndDiseaseAndDept";
        /**
         * 居民关注医院
         */
        public static final String followOrgByPatient = "/followOrgByPatient";
        /**
         * 获取常见疾病、热门部门、医生拒绝接诊原因 字典
         */
        public static final String findHotDeptAndDiseaseDict = "/findHotDeptAndDiseaseDict";
        /**
         * 挂号
         */
        public static final String registerOutPatient ="/registerOutPatient";
        /**
         * 获取ICD10诊断编码
         */
        public static final String getICD10 ="/getICD10";
        /**
         * 获取药品字典
         */
        public static final String getDrugDictionary ="/getDrugDictionary";
        /**
         * 获取用药方式
         */
        public static final String getDrugUse ="/getDrugUse";
        /**
         * 获取用药频次
         */
        public static final String getDrugFrequency="/getDrugFrequency";
        /**
         * 下诊断
         */
        public static final String makeDiagnosis="/makeDiagnosis";
        /**
         * 获取订单列表
         */
        public static final String findExpressageList="/findExpressageList";
        /**
         * 设置订单
         */
        public static final String setMailno="/setMailno";
        /**
         * 订单导出
         */
        public static final String pushListWrite="/pushListWrite";
        /**
         * 获取号别字典
         */
        public static final String findByDeptTypeCode="/findByDeptTypeCode";
        /**
         * 获取卡信息
         */
        public static final String getCardInfo="/getCardInfo";
        /**
         * 查询医生带排班
         */
        public static final String findDoctorWithWork="/findDoctorWithWork";
        /**
         * 获取具体号源
         */
        public static final String findWorkTimeInfo="/findWorkTimeInfo";
        /**
         * 获取获取医生信息
         */
        public static final String findDoctorInfo="/findDoctorInfo";
        public static final String findDoctorBaseInfo="/findDoctorBaseInfo";
        /**
         * 取消门诊
         */
        public static final String cancelOutPatient="/cancelOutPatient";
        /**
         * 居民取消原因字典
         */
        public static final String findCancelReasonList="/findCancelReasonList";
        /**
         * 獲取快速咨詢時間
         */
        public static final String findFastRegisterDate="/findFastRegisterDate";
        /**
         * 获取快速咨询时间分段
         */
        public static final String findByTimeSlot="/findByTimeSlot";
        /**
         * 获取医生列表,带当月排班状态
         */
        public static final String findDoctorWithMouthWork="/findDoctorWithMouthWork";
        /**
         * 查询某个医生某个月份排班记录
         */
        public static final String findDoctorWorkTimeByMonth="/findDoctorWorkTimeByMonth";
        /**
         * 查询排班规则
         */
        public static final String findWorkRule="/findWorkRule";
        /**
         * 保存排班规则
         */
        public static final String updateWorkRule="/updateWorkRule";
        /**
         * 排班批量保存接口
         */
        public static final String saveDoctorWorkTimeJson="/saveDoctorWorkTimeJson";
        /**
         * 获取居民基础信息
         */
        public static final String findPatientInfo = "/findPatientInfo";
        /**
         * 保存医生在线排班
         */
        public static final String saveDoctorOnlineWork = "/saveDoctorOnlineWork";
        /**
         * 删除医生在线排班
         */
        public static final String delDoctorOnlineWork = "/delDoctorOnlineWork";
        /**
         *查询医生在线排班列表
         */
        public static final String findDoctorOnlineWorkList = "/findDoctorOnlineWorkList";
        /**
         * 发起协同门诊
         */
        public static final String cooperativeOutpatient = "/cooperativeOutpatient";
        /**
         * 设置门诊医生
         */
        public static final String saveOutpatientDoctor = "/saveOutpatientDoctor";
        /**
         * 验证授权
         */
        public static final String checkOauthQRCode = "/checkOauthQRCode";
        /**
         * 全科医生协同门诊列表
         */
        public static final String findByGeneralDoctor = "/findByGeneralDoctor";
        /**
         * 全科医生首页统计信息
         */
        public static final String findGeneralDoctorInfo = "/findGeneralDoctorInfo";
        /**
         * 发送i健康系统消息
         */
        public static final String sendWlyyOutpatientMes = "/sendWlyyOutpatientMes";
        /**
         * 设置I健康消息已读
         */
        public static final String readWlyyOutpatientMes = "/readWlyyOutpatientMes";
        /**
         * 厦门I健康签约信息接口
         */
        public static final String findWlyyPatient = "/findWlyyPatient";
        /**
         *  厦门I健康获取居民身份证
         */
        public static final String findPatientListBySscOrIdCard = "/findPatientListBySscOrIdCard";
        /**
         * 获取Base64医生头像
         */
        public static final String makeBase64Qrcode = "/makeBase64Qrcode";
        //=================end=======================================
        /**
         * 原处方记录
         */
        public static final String findOriginPrescriptionList = "/getOriginPrescriptionList";
        /**
         * 获取原来处方详情
         */
        public static final String findOriginPrescription = "/getOriginPrescriptionInfo";
        /**
         * 续方记录
         */
        public static final String findPrescriptionList = "/findPrescriptionList";
        /**
         * 获取所有居民相关信息,续方信息,物流信息,药品信息
         */
        public static final String findPrescriptionInfo ="/findPrescriptionInfo";
        /**
         * 判断是否可续方
         */
        public static final String checkPrescription = "/checkPrescription";
        /**
         * 居民取消续方
         */
        public static final String cancelPrescription ="/cancelPrescription";
        //居民获取当日就诊列表
        public static final String getTodayOutpatinetList ="/getTodayOutpatinetList";
        //获取医生
        public static final String getDoctorMapping ="/getDoctorMapping";
        //获取检查检验接口
        public static final String getInspectionDictionary ="/getInspectionDictionary";
        public static final String findPrescriptionLogByPreId = "/findPrescriptionLogByPreId";
        public static final String findByPartsCode = "/findByPartsCode";
        public static final String findDictByName = "/findDictByName";
        public static final String getJcmb="/getJcmb";
        public static final String getJymb="/getJymb";
        public static final String getTcxz="/getTcxz";
        public static final String getTcChild="/getTcChild";
        public static final String getInsChild="/getInsChild";
        public static final String getDoctorPreSign ="/getDoctorPreSign";
        public static final String getDoctorIntroduction ="/getDoctorIntroduction";
        public static final String findByDict ="/findByDict";
        //根据居民CODE换取居民请求秘钥
        public static final String getPatientAccetokenByIdcard="/getPatientAccetokenByIdcard";
        //医生待办事项列表
        public static final String doctorUpcomingList = "/doctorUpcomingList";
        public static final String setRecord = "/setRecord";
        public static final String findPatientRecord = "/findPatientRecord";
        public static final String findDoctorByName = "/findDoctorByName";
        public static final String findDeptWithDoctorWorkTime = "/findDeptWithDoctorWorkTime";
        public static final String findWorkTimeRule = "/findWorkTimeRule";
        public static final String saveWorkTimeRule = "/saveWorkTimeRule";
        public static final String checkDoctorWork = "/checkDoctorWork";
        public static final String importDoctorWork = "/importDoctorWork";
    }
    /**
     * 门诊处方物流

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

@ -41,6 +41,7 @@ public class IotRequestMapping {
    public static class System{
        public static final String findDictByCode = "findDictByCode";
        public static final String createDict = "createDict";
    }
    /**
@ -68,6 +69,10 @@ public class IotRequestMapping {
        public static final String findByBusinessLicense = "findByBusinessLicense";
        public static final String updCompany = "updCompany";
        public static final String delCompany = "delCompany";
        public static final String auditCompanyPass = "auditCompanyPass";
        public static final String auditCompanyNoPass = "auditCompanyNoPass";
        public static final String findAll = "findAll";
        public static final String enterType = "enterType";
        public static final String findCompanyCertPage = "findCompanyCertPage";
        public static final String findCompanyCertById = "findCompanyCertById";
@ -88,6 +93,8 @@ public class IotRequestMapping {
        public static final String message_success_find = "find success";
        public static final String message_success_create = "create success";
        public static final String message_success_find_functions = "find success";
        public static final String message_success_audit = "audit success";
        public static final String message_success_enterType = "enter success";
    }
@ -138,10 +145,10 @@ public class IotRequestMapping {
     * 设备字典模块常量
     */
    public static class DeviceDict{
        public static final String api_create = "deviceDict";
        public static final String api_delete = "deviceDict";
        public static final String api_create = "createDeviceDict";
        public static final String api_delete = "deleteDeviceDict";
        public static final String api_getById = "getDeviceDictById";
        public static final String api_update = "deviceDict";
        public static final String api_update = "updateDeviceDict";
        public static final String api_queryPage = "queryDeviceDictPage";
        public static final String api_getList = "getDeviceDictList";

+ 11 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyOutpatientVO.java

@ -210,6 +210,9 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    @ApiModelProperty(value = "医嘱", example = "模块1")
    private String advice;
    @ApiModelProperty(value = "付款状态", example = "付款状态")
    private Integer payStatus;
    public String getAdmNo() {
@ -466,4 +469,12 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    public void setAdvice(String advice) {
        this.advice = advice;
    }
    public Integer getPayStatus() {
        return payStatus;
    }
    public void setPayStatus(Integer payStatus) {
        this.payStatus = payStatus;
    }
}

+ 22 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionInfoVO.java

@ -143,6 +143,12 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "1可用 0删除", example = "模块1")
    private Integer del;
    @ApiModelProperty(value = "药品产地", example = "药品产地")
    private String drugPlace;
    @ApiModelProperty(value = "药房包装", example = "药房包装")
    private Integer packQuantity;
    private String comm;
@ -327,4 +333,20 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    public void setComm(String comm) {
        this.comm = comm;
    }
    public String getDrugPlace() {
        return drugPlace;
    }
    public void setDrugPlace(String drugPlace) {
        this.drugPlace = drugPlace;
    }
    public Integer getPackQuantity() {
        return packQuantity;
    }
    public void setPackQuantity(Integer packQuantity) {
        this.packQuantity = packQuantity;
    }
}

+ 12 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionVO.java

@ -292,6 +292,10 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "his-挂号费用", example = "模块1")
    private Integer hisRegisterFee;
    @ApiModelProperty(value = "订单号",example = "订单号")
    private String orderNo;
    /**
     * 处方结算状态,0为未结算,1为结算成功,默认为0
     */
@ -701,4 +705,12 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    public void setInspectionVOs(List<WlyyInspectionVO> inspectionVOs) {
        this.inspectionVOs = inspectionVOs;
    }
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
}

+ 47 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyAppVO.java

@ -0,0 +1,47 @@
package com.yihu.jw.restmodel.iot.company;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
 * 企业应用表
 * @author suhaiwen on 2020/4/24.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "企业应用类", description = "企业应用表")
public class IotCompanyAppVO implements Serializable {
    @ApiModelProperty("应用ID")
    private String id;
    @ApiModelProperty("应用名称")
    private String name;
    @ApiModelProperty("访问IP地址")
    private String addressIp;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAddressIp() {
        return addressIp;
    }
    public void setAddressIp(String addressIp) {
        this.addressIp = addressIp;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
}

+ 31 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java

@ -60,6 +60,13 @@ public class IotCompanyVO extends BaseVO implements Serializable {
    @ApiModelProperty("类型")
    private List<IotCompanyTypeVO> typeList;
    @ApiModelProperty("厂商入驻类型 1:供应商  2:代理商 3:厂商")
    private String enterType;//
    @ApiModelProperty("注册类型(1:厂商注册  0:平台注册)")
    private String accountType;
    @ApiModelProperty("应用")
    private List<IotCompanyAppVO> appList;
    public String getStatus() {
        return status;
    }
@ -219,4 +226,28 @@ public class IotCompanyVO extends BaseVO implements Serializable {
    public void setEhrUserId(String ehrUserId) {
        this.ehrUserId = ehrUserId;
    }
    public String getEnterType() {
        return enterType;
    }
    public void setEnterType(String enterType) {
        this.enterType = enterType;
    }
    public String getAccountType() {
        return accountType;
    }
    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }
    public List<IotCompanyAppVO> getAppList() {
        return appList;
    }
    public void setAppList(List<IotCompanyAppVO> appList) {
        this.appList = appList;
    }
}

+ 61 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductBaseInfoVO.java

@ -71,6 +71,19 @@ public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    private String certificateName;
    @ApiModelProperty("数据传输方式")
    private List<IotProductDataTransmissionVO> dataTransmissionVOList;
    //以下为新增加的字段
    @ApiModelProperty("注册名称")
    private String registerName;
    @ApiModelProperty("规格")
    private String spec;
    @ApiModelProperty("单位")
    private String unit;
    @ApiModelProperty("进货价")
    private Double purchasePrice;
    @ApiModelProperty("零售价格")
    private Double retailPrice;
    @ApiModelProperty("设备类型标识")
    private String categoryCode;
    public String getParentId() {
        return parentId;
@ -279,4 +292,52 @@ public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    public void setOriginTypeName(String originTypeName) {
        this.originTypeName = originTypeName;
    }
    public String getRegisterName() {
        return registerName;
    }
    public void setRegisterName(String registerName) {
        this.registerName = registerName;
    }
    public String getSpec() {
        return spec;
    }
    public void setSpec(String spec) {
        this.spec = spec;
    }
    public String getUnit() {
        return unit;
    }
    public void setUnit(String unit) {
        this.unit = unit;
    }
    public Double getPurchasePrice() {
        return purchasePrice;
    }
    public void setPurchasePrice(Double purchasePrice) {
        this.purchasePrice = purchasePrice;
    }
    public Double getRetailPrice() {
        return retailPrice;
    }
    public void setRetailPrice(Double retailPrice) {
        this.retailPrice = retailPrice;
    }
    public String getCategoryCode() {
        return categoryCode;
    }
    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }
}

+ 32 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductExtendInfoVO.java

@ -33,6 +33,14 @@ public class IotProductExtendInfoVO extends BaseVO implements Serializable {
    @ApiModelProperty("附件列表")
    private List<IotProductAttachmentVO> attachmentVOList;
    //以下为新增加字段
    @ApiModelProperty("生产企业名称")
    private String companyName;
    @ApiModelProperty("批准日期")
    private String ratifyDate;
    @ApiModelProperty("代理人")
    private String agencyName;
    public String getProductImg() {
        return productImg;
    }
@ -96,4 +104,28 @@ public class IotProductExtendInfoVO extends BaseVO implements Serializable {
    public void setAttachmentVOList(List<IotProductAttachmentVO> attachmentVOList) {
        this.attachmentVOList = attachmentVOList;
    }
    public String getCompanyName() {
        return companyName;
    }
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }
    public String getRatifyDate() {
        return ratifyDate;
    }
    public void setRatifyDate(String ratifyDate) {
        this.ratifyDate = ratifyDate;
    }
    public String getAgencyName() {
        return agencyName;
    }
    public void setAgencyName(String agencyName) {
        this.agencyName = agencyName;
    }
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientSignInfoVO.java

@ -58,6 +58,8 @@ public class PatientSignInfoVO {
    private String healthAssistant;
    @ApiModelProperty("计管师")
    private String healthAssistantName;
    @ApiModelProperty("专病签约CODE")
    private String specialCode;
    public String getRelationCode() {
        return relationCode;
@ -235,4 +237,12 @@ public class PatientSignInfoVO {
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    
    public String getSpecialCode() {
        return specialCode;
    }
    
    public void setSpecialCode(String specialCode) {
        this.specialCode = specialCode;
    }
}

+ 33 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/BeanUtils.java

@ -0,0 +1,33 @@
package com.yihu.jw.util.common;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import java.beans.PropertyDescriptor;
import java.util.HashSet;
import java.util.Set;
/**
 * create by hmf on 2020/04/27
 */
public class BeanUtils {
    /**
     * @Title: getNullPropertyNames
     * @Description: 获取值为空的属性名称
     * @createdBy:byrc
     */
    public static String[] getNullPropertyNames(Object source) {
        BeanWrapper src = new BeanWrapperImpl(source);
        PropertyDescriptor[] pds = src.getPropertyDescriptors();
        Set<String> emptyNames = new HashSet<String>();
        for (PropertyDescriptor pd : pds) {
            Object srcValue = src.getPropertyValue(pd.getName());
            if (srcValue == null)
                emptyNames.add(pd.getName());
        }
        String[] result = new String[emptyNames.size()];
        return emptyNames.toArray(result);
    }
}

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

@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@ -364,52 +365,16 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize
	)throws Exception{
		JSONArray array = new JSONArray();
		List<ConsultVO> data = imService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time);
		List<Map<String,Object>>  data = imService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time);
		
		if (data != null) {
			for (ConsultVO consult : data) {
				if (consult == null) {
					continue;
				}
				JSONObject json = new JSONObject();
				json.put("id", consult.getId());
				// 设置咨询类型:1专家咨询,9在线复诊,待扩展,13协同门诊
				json.put("type", consult.getType());
				
			for(Map<String,Object> consult :data){
				//如果是协同门诊,多返回全科医生的详细信息
				if(13 == consult.getType() && StringUtils.isNoneBlank(consult.getGeneralDoctor())){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(consult.getGeneralDoctor());
					json.put("generalDoctorName", baseDoctorDO.getName());
				if(13 == Integer.parseInt((String)consult.get("type")) && StringUtils.isNoneBlank((String)consult.get("generalDoctor"))){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById((String)consult.get("generalDoctor"));
					consult.put("generalDoctorName", baseDoctorDO.getName());
				}
				
				// 设置显示标题
				json.put("title", consult.getTitle());
				// 设置主诉
				json.put("symptoms", consult.getSymptoms());
				// 咨询状态
				json.put("status", consult.getStatus());
				// 设置咨询日期
				json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
				//是否评价
				json.put("evaluate", consult.getEvaluate());
				//患者ID
				json.put("patientId", consult.getPatientId());
				//患者性别
				json.put("patientsex", consult.getPatientsex());
				//患者姓名
				json.put("patientName", consult.getPatientName());
				//患者年龄
				json.put("patientAge", DateUtil.getAgeForIdcard(consult.getPatientIdcard()));
				//就诊记录ID
				json.put("outpatientId", consult.getOutpatientid());
				//图文或者视频类型
				json.put("consultType", consult.getConsultType());
				//诊断
				json.put("icd10Name", consult.getIcd10Name());
				
				array.add(json);
			}
		}
		
@ -417,7 +382,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		
		JSONObject result = new JSONObject();
		result.put("total",total);
		result.put("list",array);
		result.put("list",data);
		return success(result);
	}
	
@ -614,71 +579,24 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize
	)throws Exception{
		JSONArray array = new JSONArray();
		List<ConsultVO> data = imService.findexpertConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time,patient);
		List<Map<String,Object>>  data = imService.findexpertConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time,patient);
		
		if (data != null) {
			for (ConsultVO consult : data) {
				if (consult == null) {
					continue;
				}
				JSONObject json = new JSONObject();
				json.put("id", consult.getId());
				// 设置咨询类型:1专家咨询,9在线复诊,待扩展,13协同门诊
				json.put("type", consult.getType());
			for (Map<String,Object> consult : data) {
				
				//如果是协同门诊,多返回全科医生的详细信息
				if(13 == consult.getType() && StringUtils.isNoneBlank(consult.getGeneralDoctor())){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(consult.getGeneralDoctor());
					json.put("generalDoctorName", baseDoctorDO.getName());
				if(13 == Integer.parseInt((String)consult.get("type")) && StringUtils.isNoneBlank((String)consult.get("generalDoctor"))){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById((String)consult.get("generalDoctor"));
					consult.put("generalDoctorName", baseDoctorDO.getName());
				}
				
				List<BaseDoctorHospitalDO> hospitalDOs =  baseDoctorHospitalDao.findByDoctorCode(doctor);
				if(hospitalDOs!=null&&hospitalDOs.size()>0){
					json.put("hospital",hospitalDOs.get(0));
//					BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
//					rs.put("winNo",org.getWinNo());
//					json.put("deptName",hospitalDOs.get(0).getDeptName());
//					json.put("dept",hospitalDOs.get(0).getDeptCode());
					consult.put("hospital",hospitalDOs.get(0));
				}else{
					json.put("hospital",null);
//					json.put("winNo",null);
//					json.put("deptName",null);
//					json.put("dept",null);
					consult.put("hospital",null);
				}
				
				//医生职称
				json.put("jobTitleName", consult.getJobTitleName());
				//医生名称
				json.put("doctorName", consult.getDoctorName());
				
				// 设置显示标题
				json.put("title", consult.getTitle());
				// 设置主诉
				json.put("symptoms", consult.getSymptoms());
				// 咨询状态
				json.put("status", consult.getStatus());
				// 设置咨询日期
				json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
				//是否评价
				json.put("evaluate", consult.getEvaluate());
				
				//患者ID
				json.put("patientId", consult.getPatientId());
				//患者性别
				json.put("patientsex", consult.getPatientsex());
				//患者姓名
				json.put("patientName", consult.getPatientName());
				//患者年龄
				json.put("patientAge", DateUtil.getAgeForIdcard(consult.getPatientIdcard()));
				//就诊记录ID
				json.put("outpatientId", consult.getOutpatientid());
				//图文或者视频类型
				json.put("consultType", consult.getConsultType());
				//诊断
				json.put("icd10Name", consult.getIcd10Name());
				
				array.add(json);
			}
		}
		
@ -686,7 +604,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		
		JSONObject result = new JSONObject();
		result.put("total",total);
		result.put("list",array);
		result.put("list",data);
		return success(result);
	}
	

+ 24 - 19
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -129,7 +129,6 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
								@ApiParam(name = "pagesize", value = "分页大小")
								@RequestParam(value = "pagesize",required = false) int pagesize
								)throws Exception{
		JSONArray array = new JSONArray();
		List<Map<String,Object>>  data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,status,payStatus);
		
		/*if (data != null) {
@ -168,7 +167,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
		
		JSONObject result = new JSONObject();
		result.put("total",total);
		result.put("list",array);
		result.put("list",data);
		return success(result);
	}
	
@ -424,28 +423,34 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			hospitalSystemMessageService.saveMessage(systemMessageDO);
			BaseDoctorDO d = baseDoctorDao.findById(re.getString("doctor"));
			BasePatientDO p = basePatientDao.findById(re.getString("patient"));
			//眼科支付订单
			if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
				if (type==1||type==2){
					BusinessOrderDO businessOrderDO = new BusinessOrderDO();
					businessOrderDO.setDoctor(doctor);
					businessOrderDO.setPatient(patient);
					businessOrderDO.setPatientName(re.getString("patientName"));
					businessOrderDO.setDescription("专家咨询费");
					businessOrderDO.setOrderCategory("1");
					if (type==1){
						businessOrderDO.setOrderType(1);
					}else if (type==17){
						businessOrderDO.setOrderType(3);
						businessOrderDO.setRelationCode(re.getString("consult"));
						businessOrderDO.setRelationName("新增专家咨询");
			
			try {
				//眼科支付订单
				if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
					if (type==1||type==2){
						BusinessOrderDO businessOrderDO = new BusinessOrderDO();
						businessOrderDO.setDoctor(doctor);
						businessOrderDO.setPatient(patient);
						businessOrderDO.setPatientName(re.getString("patientName"));
						businessOrderDO.setDescription("专家咨询费");
						businessOrderDO.setOrderCategory("1");
						if (type==1){
							businessOrderDO.setOrderType(1);
							businessOrderDO.setRelationCode(re.getString("consult"));
							businessOrderDO.setRelationName("新增专家咨询");
						}else if (type==17){
							businessOrderDO.setOrderType(3);
							businessOrderDO.setRelationCode(re.getString("consult"));
							businessOrderDO.setRelationName("新增专家咨询");
						}
						businessOrderService.saveOrder(businessOrderDO);
					}
					businessOrderService.saveOrder(businessOrderDO);
				}
			}catch (Exception e){
			    logger.info("支付订单失败:"+e.getMessage());
			}
			//发送企业号推送
			try{
				

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

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeExcelReader;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeMainExcelDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
@ -953,72 +954,32 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "type",required = true) String type)throws Exception{
    
        com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
        List<ConsultVO> data = imService.doctorUpcomingList(doctorCode, type);
        List<Map<String,Object>>  data = imService.doctorUpcomingList(doctorCode, type);
    
        if (data != null) {
            for (ConsultVO consult : data) {
                if (consult == null) {
                    continue;
                }
                com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
                json.put("id", consult.getId());
                // 设置咨询类型:1专家咨询,9在线复诊,待扩展,13协同门诊
                json.put("type", consult.getType());
//
//                //如果是协同门诊,多返回全科医生的详细信息
//                if(13 == consult.getType() && StringUtils.isNoneBlank(consult.getGeneralDoctor())){
//                    BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(consult.getGeneralDoctor());
//                    json.put("generalDoctorName", baseDoctorDO.getName());
//                }
            
                // 设置显示标题
                json.put("title", consult.getTitle());
                // 设置主诉
                json.put("symptoms", consult.getSymptoms());
                // 咨询状态
                json.put("status", consult.getStatus());
                // 设置咨询日期
                json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
                //是否评价
                json.put("evaluate", consult.getEvaluate());
            
                //患者ID
                json.put("patientId", consult.getPatientId());
                //患者性别
                json.put("patientsex", consult.getPatientsex());
                //患者姓名
                json.put("patientName", consult.getPatientName());
                //患者年龄
                json.put("patientAge", DateUtil.getAgeForIdcard(consult.getPatientIdcard()));
                //就诊记录ID
                json.put("outpatientId", consult.getOutpatientid());
                //就诊记录状态
                json.put("outpatientstatus", consult.getOutpatientstatus());
                // 设置咨询日期
                json.put("registerDate", DateUtil.dateToStrLong(consult.getRegisterDate()));
                //图文或者视频类型
                json.put("consultType", consult.getConsultType());
                //诊断
                json.put("icd10Name", consult.getIcd10Name());
            for (Map<String,Object> consult : data) {
                
                Integer consultType =  Integer.parseInt((String)consult.get("type"));
                
                if("1,15".equals(type)){//专家咨询
                    if(1 == consult.getType()){//专家咨询
                        json.put("session_id", consult.getPatientId()+"_"+ consult.getDoctorCode()+"_1");
                    }else if(15 == consult.getType()){//家医求助
                        json.put("session_id", consult.getPatientId()+"_"+ consult.getGeneralDoctor()+"_"+ consult.getDoctorCode()+"_15");
                if("1,15".equals(consultType)){//专家咨询
                    if(1 == consultType){//专家咨询
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("doctorCode").toString()+"_1");
                    }else if(15 == consultType){//家医求助
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("generalDoctor").toString()+"_"+ consult.get("doctorCode").toString()+"_15");
                    }else{}
                }else if("9".equals(type)){//图文复诊
                    json.put("session_id", consult.getPatientId()+"_"+ consult.getOutpatientid()+"_9");
                    json.put("type",type);
                }else if("16".equals(type)){//视频复诊
                    json.put("session_id", consult.getPatientId()+"_"+ consult.getOutpatientid()+"_16");
                    json.put("type",type);
                }else if("9".equals(consultType)){//图文复诊
                    consult.put("session_id", consult.get("patientId").toString()+"_"+consult.get("outpatientid").toString()+"_9");
                    consult.put("type",consultType);
                }else if("16".equals(consultType)){//视频复诊
                    consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("outpatientid").toString()+"_16");
                    consult.put("type",consultType);
                }else if("12".equals(type)){//协同门诊
                    json.put("session_id", consult.getPatientId()+"_"+ consult.getOutpatientid()+"_12");
                    json.put("type",type);
                    consult.put("session_id", consult.get("patientId").toString()+"_"+consult.get("outpatientid").toString()+"_12");
                    consult.put("type",consultType);
                }else{}
            
                array.add(json);
                array.add(consult);
            }
        }
        return success(array);

+ 138 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java

@ -0,0 +1,138 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeExcelReader;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeMainExcelDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.*;
import com.yihu.jw.hospital.prescription.service.entrance.DoctorPreSignService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wlyy.service.WlyyBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2019/5/16
 */
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.YkyyPrescription.PREFIX)
@Api(value = "眼科医院在线复诊", description = "眼科医院在线复诊接口", tags = {"眼科医院在线复诊接口"})
public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private YkyyPrescriptionService prescriptionService;
    @Autowired
    private WlyyBusinessService wlyyBusinessService;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private InspectionService inspectionService;
    @Autowired
    private DoctorPreSignService doctorPreSignService;
    
    @Autowired
    private HospitalSystemMessageService hospitalSystemMessageService;
    @Autowired
    private WorkTimeService workTimeService;
    
    @Autowired
    private ImService imService;
    
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @PostMapping(value = BaseHospitalRequestMapping.YkyyPrescription.appointmentRevisit)
    @ApiOperation(value = "居民发起复诊", notes = "居民发起复诊")
    public ObjEnvelop appointmentRevisit(@ApiParam(name = "outpatientJson", value = "居民门诊json")
                                         @RequestParam(value = "outpatientJson", required = false)String outpatientJson,
                                         @ApiParam(name = "expressageJson", value = "居民物流json")
                                         @RequestParam(value = "expressageJson", required = false)String expressageJson,
                                         @ApiParam(name = "registerJson", value = "预约时间")
                                         @RequestParam(value = "registerJson", required = false)String registerJson,
                                         @ApiParam(name = "chargeType", value = "预约实体json")
                                         @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
       /* //发送系统消息
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO);
        //发送IM消息
        hospitalSystemMessageService.sendImMessage(systemMessageDO);
        //发送医生抢单消息
        if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
            hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
        }*/
        return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugDictionary)
    @ApiOperation(value = "获取药品字典", notes = "获取药品字典")
    public ListEnvelop getDrugDictionary(@ApiParam(name = "drugNo", value = "药品编码")
                                         @RequestParam(value = "drugNo", required = false)String drugNo,
                                         @ApiParam(name = "pyKey", value = "拼音关键字")
                                         @RequestParam(value = "pyKey", required = false)String pyKey,
                                         @ApiParam(name = "winNo", value = "分部编码")
                                         @RequestParam(value = "winNo", required = false)String winNo,
                                         @ApiParam(name = "groupNo", value = "药房编码")
                                         @RequestParam(value = "groupNo", required = false)String groupNo)throws Exception {
        return success(prescriptionService.getDrugDictionary(drugNo,pyKey,winNo,groupNo));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugUse)
    @ApiOperation(value = "获取用法", notes = "获取用法")
    public ListEnvelop getDrugUse(@ApiParam(name = "pyKey", value = "拼音关键字")
                                  @RequestParam(value = "pyKey", required = false)String pyKey,
                                  @ApiParam(name = "drugNo", value = "药品编码")
                                  @RequestParam(value = "drugNo", required = false)String drugNo)throws Exception {
        return success(prescriptionService.getDrugUse(drugNo,pyKey));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugFrequency)
    @ApiOperation(value = "获取用药频次", notes = "获取用药频次")
    public ListEnvelop getDrugFrequency()throws Exception {
        return success(prescriptionService.getDrugFrequency());
    }
}

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

@ -38,6 +38,8 @@ public class YkyyController extends EnvelopRestEndpoint {
    private String wxId;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @GetMapping(value = "/selectCardList")
@ -264,6 +266,26 @@ public class YkyyController extends EnvelopRestEndpoint {
    }
    /**
     *
     * his同步数据
     * @param code
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "ceshi", method = RequestMethod.POST)
    @ApiOperation("his同步数据")
    public ObjEnvelop findByRealOrder(
            @ApiParam(name = "code", value = "code", required = true)
            @RequestParam(required = true)String code) throws Exception {
        try {
            ykyyEntranceService.findByRealOrder(code);
            return ObjEnvelop.getSuccess("ok","");
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }

+ 18 - 13
svr/svr-iot/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java

@ -1,22 +1,16 @@
package com.yihu.iot.controller.common;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -29,22 +23,33 @@ public class IotSystemDictController extends EnvelopRestEndpoint {
    @Autowired
    private IotSystemDictService iotSystemDictService;
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    @GetMapping(value = IotRequestMapping.System.findDictByCode)
    @ApiOperation(value = "获取字典列表(不分页)")
    public MixEnvelop<IotSystemDictVO, IotSystemDictVO> getList(
    public MixEnvelop<IotSystemDictDO, IotSystemDictDO> getList(
            @ApiParam(name = "dictName", value = "字典名称", defaultValue = "COMPANY_TYPE")
            @RequestParam(value = "dictName", required = true) String dictName) throws Exception {
        try {
            List<IotSystemDictDO> doList = iotSystemDictDao.findByDictName(dictName);
            List<IotSystemDictVO> voList = convertToModels(doList,new ArrayList<IotSystemDictVO>(doList.size()),IotSystemDictVO.class);
            return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,voList);
            List<IotSystemDictDO> doList = iotSystemDictService.getListByDictName(dictName);
//            List<IotSystemDictVO> voList = convertToModels(doList,new ArrayList<IotSystemDictVO>(doList.size()),IotSystemDictVO.class);
            return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,doList);
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
        }
    }
    @PostMapping(value = IotRequestMapping.System.createDict)
    @ApiOperation(value = "创建字典", notes = "创建字典")
    public MixEnvelop<IotSystemDictDO, IotSystemDictDO> create(@ApiParam(name = "jsonData", value = "字典json", defaultValue = "{\"value\":\"血糖仪\", \"dictName\":\"DEVICE_TYPE\"}")
                                                       @RequestParam String jsonData) {
        try {
//            List<IotSystemDictDO> dictDOList = new ObjectMapper().readValue(jsonData, new TypeReference<List<IotSystemDictDO>>(){});
            IotSystemDictDO dictDO = toEntity(jsonData, IotSystemDictDO.class);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create, iotSystemDictService.create(dictDO));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 92 - 17
svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -11,10 +11,15 @@ import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.elasticsearch.action.ValidateActions;
import org.elasticsearch.common.recycler.Recycler;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
@ -35,12 +40,12 @@ public class IotCompanyController extends EnvelopRestEndpoint {
    @GetMapping(value = IotRequestMapping.Company.findCompanyPage)
    @ApiOperation(value = "分页查找企业", notes = "分页查找企业")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findCompanyPage(@ApiParam(name = "name", value = "供应商名称或联系人姓名", defaultValue = "")
                                       @RequestParam(value = "name", required = false) String name,
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findCompanyPage(@ApiParam(name = "accountType", value = "注册类型", defaultValue = "")
                                       @RequestParam(value = "accountType", required = false) String accountType,
                                                    @ApiParam(name = "status", value = "审核状态", defaultValue = "")
                                       @RequestParam(value = "status", required = false) String status,
                                                    @ApiParam(name = "type", value = "企业类型", defaultValue = "")
                                       @RequestParam(value = "type", required = false) String type,
                                                    @ApiParam(name = "enterType", value = "入驻类型", defaultValue = "")
                                       @RequestParam(value = "enterType", required = false) String enterType,
                                                    @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                       @RequestParam(value = "page", required = false) Integer page,
                                                    @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
@ -52,10 +57,10 @@ public class IotCompanyController extends EnvelopRestEndpoint {
            if(size == null){
                size = 10;
            }
            if(StringUtils.isBlank(type)){
                return iotCompanyService.queryPage(page,size,status,name);
            if(StringUtils.isBlank(status)){
                return iotCompanyService.queryPage(page,size,accountType,enterType);
            }else {
                return iotCompanyService.queryPage(page,size,status,name,type);
                return iotCompanyService.queryPage(page,size,status,accountType,enterType);
            }
        } catch (Exception e) {
@ -71,13 +76,79 @@ public class IotCompanyController extends EnvelopRestEndpoint {
        try {
            IotCompanyVO iotCompanyVO = toEntity(jsonData, IotCompanyVO.class);
            IotCompanyDO iotCompany = iotCompanyService.convertToModelDO(iotCompanyVO);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create, iotCompanyService.create(iotCompany));
            iotCompanyService.create(iotCompany);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Company.auditCompanyPass)
    @ApiOperation(value = "通过审核",notes = "通过审核")
    public MixEnvelop<IotCompanyVO,IotCompanyVO> auditCompanyPass(@ApiParam(name = "id",value = "id") @RequestParam(value = "id",required = true)String id){
        try {
            return  iotCompanyService.auditCompany(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Company.auditCompanyNoPass)
    @ApiOperation(value = "审核失败",notes = "审核失败")
    public MixEnvelop<IotCompanyVO,IotCompanyVO> auditCompanyNoPass(@ApiParam(name = "id",value = "id") @RequestParam(value = "id",required = true)String id,
                                                                    @ApiParam(name = "msg",value = "拒绝说明") @RequestParam(value = "msg",required = true,defaultValue = "")String msg){
        try {
            return  iotCompanyService.auditCompany(id, msg);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Company.enterType)
    @ApiOperation(value = "根据入驻类型查找企业",notes = "根据入驻类型查找企业")
    public MixEnvelop<IotCompanyVO,IotCompanyVO> findByEnterType(@ApiParam(name = "entryCode",value = "入驻类型") @RequestParam(value = "entryCode",required = true)String entryCode){
        try {
            List<IotCompanyDO>  iotCompanyDOList = iotCompanyService.findByEnterType(entryCode);
            List<IotCompanyVO> iotCompanyVOList = new ArrayList<>();
            for (IotCompanyDO iotCompanyDO : iotCompanyDOList) {
                IotCompanyVO iotCompanyVO = iotCompanyService.convertToModelVO(iotCompanyDO);
                iotCompanyVOList.add(iotCompanyVO);
            }
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_enterType,iotCompanyVOList);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Company.findAll)
    @ApiOperation(value = "查询所有企业", notes = "查询所有企业")
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> findAll(@ApiParam(name = "accountType", value = "注册类型" )
                                                                                       @RequestParam(value = "accountType", required = true)String accountType) {
        try {
           List<IotCompanyDO> iotCompanyDOList =  iotCompanyService.findAll(accountType);
            List<IotCompanyVO> iotCompanyVOList = new ArrayList<>();
            for (IotCompanyDO iotCompanyDO : iotCompanyDOList) {
                IotCompanyVO iotCompanyVO = iotCompanyService.convertToModelVO(iotCompanyDO);
                iotCompanyVOList.add(iotCompanyVO);
            }
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_find, iotCompanyVOList);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Company.findCompanyById)
    @ApiOperation(value = "根据id查找企业", notes = "根据id查找企业")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findByCode(@ApiParam(name = "id", value = "id")
@ -94,10 +165,12 @@ public class IotCompanyController extends EnvelopRestEndpoint {
    @GetMapping(value = IotRequestMapping.Company.findByBusinessLicense)
    @ApiOperation(value = "根据营业执照号查找企业", notes = "根据营业执照号查找企业")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findByBusinessLicense(@ApiParam(name = "businessLicense", value = "businessLicense")
                                            @RequestParam(value = "businessLicense", required = true) String businessLicense) {
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findByBusinessLicense(@ApiParam(name = "businessLicense", value = "营业执照号")
                                            @RequestParam(value = "businessLicense", required = true) String businessLicense,
                                               @ApiParam(name = "accountType", value = "注册类型")
                                            @RequestParam(value = "accountType", required = true) String accountType) {
        try {
            IotCompanyDO iotCompanyDO = iotCompanyService.findByBusinessLicense(businessLicense);
            IotCompanyDO iotCompanyDO = iotCompanyService.findByBusinessLicense(businessLicense,accountType);
            IotCompanyVO vo = iotCompanyService.convertToModelVO(iotCompanyDO);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_find, vo);
        } catch (Exception e) {
@ -112,7 +185,7 @@ public class IotCompanyController extends EnvelopRestEndpoint {
                              @RequestParam(value = "id", required = true) String id) {
        try {
            iotCompanyService.delCompany(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_find);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -122,12 +195,14 @@ public class IotCompanyController extends EnvelopRestEndpoint {
    @PostMapping(value = IotRequestMapping.Company.updCompany)
    @ApiOperation(value = "修改企业信息", notes = "修改企业信息")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> updCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                  @RequestParam(value = "jsonData", required = true)String jsonData) {
                                  @RequestParam(value = "jsonData", required = true)String jsonData,
                                                             @ApiParam(name = "accountType", value = "注册类型", defaultValue = "")
                                                             @RequestParam(value = "accountType", required = true)String accountType) {
        try {
            IotCompanyVO iotCompanyVO = toEntity(jsonData, IotCompanyVO.class);
            IotCompanyDO iotCompany = iotCompanyService.convertToModelDO(iotCompanyVO);
            iotCompanyService.updCompany(iotCompany);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_find);
            iotCompanyService.updCompany(iotCompany,accountType);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_update);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
@ -161,7 +236,7 @@ public class IotCompanyController extends EnvelopRestEndpoint {
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertById)
    @ApiOperation(value = "根据id查找企业证书", notes = "根据id查找企业证书")
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> findCompanyCertById(@ApiParam(name = "id", value = "id")
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> findCompanyCertById(@ApiParam(name = "id", value = "证书ID")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            IotCompanyCertificateDO iotCompanyCertificateDO = iotCompanyCertificateService.findById(id);
@ -220,7 +295,7 @@ public class IotCompanyController extends EnvelopRestEndpoint {
                                                           @RequestParam(value = "id", required = true)String id) {
        try {
            iotCompanyCertificateService.delCompanyCert(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_create);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_delete);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

+ 15 - 4
svr/svr-iot/src/main/java/com/yihu/iot/controller/dict/IotDeviceDictController.java

@ -9,10 +9,7 @@ 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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@ -43,4 +40,18 @@ public class IotDeviceDictController extends EnvelopRestEndpoint {
        List<IotDeviceDictDO> iotDeviceDicts = convertToModels(list, new ArrayList<>(list.size()), IotDeviceDictDO.class, fields);
        return MixEnvelop.getSuccessList(IotRequestMapping.DeviceDict.message_success_find_functions,iotDeviceDicts);
    }
    @PostMapping(value = IotRequestMapping.DeviceDict.api_create)
    @ApiOperation(value = "创建编辑设备字典")
    public MixEnvelop create(
            @ApiParam(name = "jsonData", value = "设备体征字典json数据")
            @RequestParam(value = "jsonData", required = false) String jsonData){
        try {
            IotDeviceDictDO dictDO = toEntity(jsonData, IotDeviceDictDO.class);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create, iotDeviceDictService.create(dictDO));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java

@ -179,7 +179,7 @@ public class IotProductController extends EnvelopRestEndpoint {
            if(re==-1){
                return MixEnvelop.getError("该产品已有关联订单,不允许删除",-1);
            }else {
                return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find);
                return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_delete);
            }
        } catch (Exception e) {
            e.printStackTrace();
@ -194,7 +194,7 @@ public class IotProductController extends EnvelopRestEndpoint {
        try {
            IotProductVO iotProductVO = toEntity(jsonData, IotProductVO.class);
            iotProductBaseInfoService.updProduct(iotProductVO);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find);
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_update);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

+ 18 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyAppDao.java

@ -0,0 +1,18 @@
package com.yihu.iot.dao.company;
import com.yihu.jw.entity.iot.company.IotCompanyAppDO;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/4/24
 */
public interface IotCompanyAppDao extends PagingAndSortingRepository<IotCompanyAppDO, String>,
        JpaSpecificationExecutor<IotCompanyAppDO> {
        List<IotCompanyAppDO> findByCompanyId(String companyId);
        }

+ 10 - 2
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyDao.java

@ -5,6 +5,8 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 企业表
 * @author yeshijie on 2018/1/15.
@ -15,6 +17,12 @@ public interface IotCompanyDao extends PagingAndSortingRepository<IotCompanyDO,
    @Query("from IotCompanyDO w where w.id =?1 and w.del=1 ")
    IotCompanyDO findById(String id);
    @Query("from IotCompanyDO w where w.businessLicense =?1 and w.del=1")
    IotCompanyDO findByBusinessLicense(String businessLicense);
    @Query("from IotCompanyDO w where w.businessLicense =?1 and w.accountType=?2 and w.del=1")
    IotCompanyDO findByBusinessLicense(String businessLicense,String accountType);
    @Query("from IotCompanyDO w where w.accountType =?1 and w.del=1")
    List<IotCompanyDO> findByAccountType(String accountType);
    @Query("from IotCompanyDO w where w.enterType =?1 and w.status=1 and w.del=1")
    List<IotCompanyDO> findByEnterType(String entryType);
}

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotDeviceDictDao.java

@ -11,6 +11,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface IotDeviceDictDao extends PagingAndSortingRepository<IotDeviceDictDO,String>,
        JpaSpecificationExecutor<IotDeviceDictDO> {
    @Query("from IotDeviceDictDO w where w.id =?1")
    @Query("from IotDeviceDictDO w where w.id =?1 and w.del = 1")
    IotDeviceDictDO findById(String id);
}

+ 6 - 2
svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotSystemDictDao.java

@ -13,7 +13,11 @@ import java.util.List;
public interface IotSystemDictDao extends PagingAndSortingRepository<IotSystemDictDO,String>,
        JpaSpecificationExecutor<IotSystemDictDO> {
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY sort")
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY w.parentCode,sort")
    List<IotSystemDictDO> findByDictName(String dictName);
    
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY w.code desc ")
    List<IotSystemDictDO> getAllByDictNameAndOrderByCodeDesc(String dictName);
    IotSystemDictDO findByDictNameAndCodeAndDel(String dictName, String code, Integer del);
}

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

@ -112,6 +112,9 @@ public class IotCompanyCertificateService extends BaseJpaService<IotCompanyCerti
     */
    public void delCompanyCert(String id){
        IotCompanyCertificateDO companyCert = iotCompanyCertificateDao.findById(id);
        if(companyCert==null){
            throw new RuntimeException("证书已删除,请勿重复操作");
        }
        companyCert.setDel(0);
        iotCompanyCertificateDao.save(companyCert);
    }

+ 333 - 55
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -1,11 +1,15 @@
package com.yihu.iot.service.company;
import com.yihu.iot.dao.company.IotCompanyAppDao;
import com.yihu.iot.dao.company.IotCompanyCertificateChangeRecordDao;
import com.yihu.iot.dao.company.IotCompanyDao;
import com.yihu.iot.dao.company.IotCompanyTypeDao;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.jw.entity.iot.company.IotCompanyAppDO;
import com.yihu.jw.entity.iot.company.IotCompanyCertificateChangeRecordDO;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.company.IotCompanyTypeDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyAppVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
@ -38,33 +42,47 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
    private JdbcTemplate jdbcTempalte;
    @Autowired
    private IotCompanyCertificateChangeRecordDao iotCompanyCertificateChangeRecordDao;
    @Autowired
    private IotCompanyAppDao iotCompanyAppDao;
    @Autowired
    private UserAgent userAgent;
    /**
     * 分页查找
     * 审核通过 分页查找
     * @param page
     * @param size
     * @param status
     * @param name
     * @param accountType
     * @param enterType
     * @return
     * @throws ParseException
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String name) throws ParseException {
    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String accountType, String enterType) throws ParseException {
        String filters = "del=1;";
        String semicolon = "";
        if(StringUtils.isNotBlank(name)){
            filters += "name?"+name+" g1;contactsName?"+name+" g1";
        if(StringUtils.isNotBlank(accountType)){
            filters += "accountType?"+accountType;
            semicolon = ";";
        }
        if(StringUtils.isNotBlank(status)){
            filters += semicolon +"status="+status;
        if(StringUtils.isNotBlank(enterType)){
            filters += semicolon +"enterType="+enterType;
            semicolon = ";";
        }
        String sorts = "-updateTime";
        //得到list数据
        String sorts = "-updateTime";//按更新时间降序
        List<IotCompanyDO> list = search(null, filters, sorts, page, size);
        list.forEach(one->{
            findType(one);
        });
        if(accountType.equalsIgnoreCase("1")){
            //得到list数据
            list.forEach(one->{
                findType(one);
            });
        }
        if(accountType.equalsIgnoreCase("0")){
            list.forEach(one->{
                findAppType(one);
            });
        }
        //获取总数
        long count = getCount(filters);
@ -84,8 +102,18 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        sources.forEach(one -> {
            IotCompanyVO target = new IotCompanyVO();
            BeanUtils.copyProperties(one, target);
            List<IotCompanyTypeVO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeVO.class);
            target.setTypeList(voList);
            if(target.getTypeList()!=null){
                List<IotCompanyTypeVO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeVO.class);
                target.setTypeList(voList);
            }
            if (target.getAppList()!=null){
                List<IotCompanyAppVO> appList = convertToModels(target.getAppList(),new ArrayList<>(target.getAppList().size()),IotCompanyAppVO.class);
                target.setAppList(appList);
            }
//            List<IotCompanyTypeVO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeVO.class);
//            List<IotCompanyAppVO> appList = convertToModels(target.getAppList(),new ArrayList<>(target.getAppList().size()),IotCompanyAppVO.class);
//            target.setTypeList(voList);
//            target.setAppList(appList);
            targets.add(target);
        });
        return targets;
@ -107,6 +135,10 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            List<IotCompanyTypeVO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeVO.class);
            target.setTypeList(voList);
        }
        if (target.getAppList()!=null){
            List<IotCompanyAppVO> appList = convertToModels(target.getAppList(),new ArrayList<>(target.getAppList().size()),IotCompanyAppVO.class);
            target.setAppList(appList);
        }
        return target;
    }
@ -123,8 +155,15 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        if(StringUtils.isNotBlank(iotCompanyVO.getBusinessStartTime())){
            target.setBusinessStartTime(DateUtil.strToDate(iotCompanyVO.getBusinessStartTime()));
        }
        List<IotCompanyTypeDO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeDO.class);
        target.setTypeList(voList);
        if (iotCompanyVO.getTypeList()!=null){
            List<IotCompanyTypeDO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeDO.class);
            target.setTypeList(voList);
        }
        if (iotCompanyVO.getAppList()!=null){
            List<IotCompanyAppDO> appList = convertToModels(target.getAppList(),new ArrayList<>(target.getAppList().size()),IotCompanyAppDO.class);
            target.setAppList(appList);
        }
        return target;
    }
@ -133,11 +172,44 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * @param page
     * @param size
     * @param status
     * @param name
     * @param type
     * @param accountType
     * @param enterType
     * @return
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String name, String type){
    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String accountType, String enterType){
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_company c WHERE c.del=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_company c  WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(status)){
            sql.append(" and c.status=? ");
            sqlCount.append(" and c.status='").append(status).append("' ");
            args.add(status);
        }
        if(StringUtils.isNotBlank(accountType)){
            sql.append(" and c.account_type=? ");
            sqlCount.append(" and c.account_type='").append(accountType).append("' ");
            args.add(accountType);
        }
        if(StringUtils.isNotBlank(enterType)){
            sql.append(" and c.enter_type=? ");
            sqlCount.append(" and c.enter_type='").append(enterType).append("' ");
            args.add(enterType);
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotCompanyDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotCompanyDO.class));
        list.forEach(one->{
            findType(one);
        });
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        //DO转VO
        List<IotCompanyVO> iotCompanyVOList = convertToModelVOs(list,new ArrayList<>(list.size()));
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
    }
/*    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String name, String type){
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_company c ,iot_company_type t WHERE c.del=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_company c ,iot_company_type t WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
@ -170,7 +242,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        List<IotCompanyVO> iotCompanyVOList = convertToModelVOs(list,new ArrayList<>(list.size()));
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
    }
    }*/
    /**
     * 新增
@ -178,23 +250,100 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * @return
     */
    public IotCompanyDO create(IotCompanyDO iotCompany) {
        iotCompany.setStatus("1");
        iotCompany.setSaasId(getCode());
        iotCompany.setDel(1);
        List<IotCompanyTypeDO> list = iotCompany.getTypeList();
        iotCompany = iotCompanyDao.save(iotCompany);
        String id = iotCompany.getId();
        //新增类型
        List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
        list.forEach(one->{
            IotCompanyTypeDO companyType = new IotCompanyTypeDO();
            companyType.setSaasId(getCode());
            companyType.setCompanyId(id);
            companyType.setType(one.getType());
            companyType.setTypeName(one.getTypeName());
            companyTypes.add(companyType);
        });
        iotCompanyTypeDao.save(companyTypes);
        if("1".equalsIgnoreCase(iotCompany.getAccountType())){
            //产商注册
            //1、判断企业名称是否已经注册
            List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
            for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                //判断营业执照号是否被注册
                if(iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense())&&iotCompanyDO.getStatus().equalsIgnoreCase("1")){
                    throw new RuntimeException("该营业执照号已经注册,请使用其他执照");
                }
                if(iotCompany.getName().equalsIgnoreCase(iotCompanyDO.getName())){
                    //该公司重新申请注册,则删除原先注册信息
                    if(iotCompanyDO.getStatus().equalsIgnoreCase("2")){
                        List<IotCompanyAppDO> apps = iotCompanyAppDao.findByCompanyId(iotCompanyDO.getId());
                        iotCompanyAppDao.delete(apps);
                        iotCompanyDao.delete(iotCompanyDO);
                    }else {
                        throw new RuntimeException("该企业已经注册,请使用注册账号登录");
                    }
                }
            }
            //保存产商信息
            iotCompany.setStatus("0");//待审核
            iotCompany.setSaasId(getCode());
            iotCompany.setDel(1);
            iotCompany = iotCompanyDao.save(iotCompany);
            String id = iotCompany.getId();
            //新增类型
            List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
            list.forEach(one->{
                IotCompanyTypeDO companyType = new IotCompanyTypeDO();
                companyType.setSaasId(getCode());
                companyType.setCompanyId(id);
                companyType.setType(one.getType());
                companyType.setTypeName(one.getTypeName());
                companyTypes.add(companyType);
            });
            iotCompanyTypeDao.save(companyTypes);
        }
        if("0".equalsIgnoreCase(iotCompany.getAccountType())){
            List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
            for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                //判断营业执照号是否被注册
                if (iotCompany.getBusinessLicense().equalsIgnoreCase(iotCompanyDO.getBusinessLicense()) && iotCompanyDO.getStatus().equalsIgnoreCase("1")) {
                    throw new RuntimeException("该营业执照号已经注册,请使用其他执照");
                }
            }
            //判断应用是否已经注册
            IotCompanyAppDO companyAppDO = iotCompany.getAppList().get(0);
            //查找所有应用名称
            Iterable<IotCompanyAppDO> appDOList = iotCompanyAppDao.findAll();
            IotCompanyDO companyTemp = new IotCompanyDO();
            for (IotCompanyAppDO app : appDOList) {
                if(app.getName().equalsIgnoreCase(companyAppDO.getName())){
                    String companyId = app.getCompanyId();
                    IotCompanyDO companyDO = iotCompanyDao.findOne(companyId);
                    //该平台重新申请注册
                    if(iotCompany.getName().equalsIgnoreCase(companyDO.getName())&&companyDO.getStatus().equalsIgnoreCase("2")){
                        //查找该企业下的app
                        List<IotCompanyAppDO> apps = iotCompanyAppDao.findByCompanyId(companyDO.getId());
                        //保存注册信息获取CompangId
                         companyTemp = iotCompanyDao.save(iotCompany);
                        //遍历apps找出与注册相同的app
                        for (IotCompanyAppDO appDO : apps) {
                            if (appDO.getName().equalsIgnoreCase(companyAppDO.getName())){
                                appDO.setDel("0");
                                iotCompanyAppDao.save(appDO);
                            }
                            //更改公司ID
                            appDO.setCompanyId(companyTemp.getId());
                        }
                    }
                    throw new RuntimeException("该应用已经注册,请使用注册账号登录");
                }
            }
            //平台接入
            companyTemp.setStatus("0");//待审核
            companyTemp.setSaasId(getCode());
            companyTemp.setDel(1);
            iotCompany = iotCompanyDao.save(companyTemp);
            //保存应用
            String id = iotCompany.getId();
            IotCompanyAppDO iotCompanyAppDO = new IotCompanyAppDO();
            iotCompanyAppDO.setSaasId(getCode());
            iotCompanyAppDO.setCompanyId(id);
            iotCompanyAppDO.setCompanyName(iotCompany.getName());
            iotCompanyAppDO.setName(companyAppDO.getName());
            iotCompanyAppDO.setAddressIp(companyAppDO.getAddressIp());
            iotCompanyAppDO.setDel("1");
            iotCompanyAppDao.save(iotCompanyAppDO);
        }
        return iotCompany;
    }
@ -206,7 +355,14 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     */
    public IotCompanyDO findById(String id) {
        IotCompanyDO company = iotCompanyDao.findById(id);
        findType(company);
        String accountType = company.getAccountType();
        if ("1".equalsIgnoreCase(accountType)){
            findType(company);
        }
        if ("0".equalsIgnoreCase(accountType)){
            List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyId(company.getId());
            company.setAppList(appDOList);
        }
        return company;
    }
@ -215,8 +371,8 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * @param businessLincense
     * @return
     */
    public IotCompanyDO findByBusinessLicense(String businessLincense){
        return iotCompanyDao.findByBusinessLicense(businessLincense);
    public IotCompanyDO findByBusinessLicense(String businessLincense,String accountType){
        return iotCompanyDao.findByBusinessLicense(businessLincense,accountType);
    }
    /**
@ -241,6 +397,25 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        company.setTypeList(list);
    }
    public void findAppType(IotCompanyDO company){
        if(company==null){
            return;
        }
        //查找类型
        List<IotCompanyAppDO> appList = iotCompanyAppDao.findByCompanyId(company.getId());
        List<IotCompanyAppDO> list = new ArrayList<>(8);
        if(appList.size()>0){
            appList.forEach(one->{
                IotCompanyAppDO vo = new IotCompanyAppDO();
                vo.setName(one.getName());
                vo.setAddressIp(one.getAddressIp());
                vo.setId(one.getId());
                list.add(vo);
            });
        }
        company.setAppList(appList);
    }
    /**
     * 查找企业类型
     * @param companyId
@ -256,6 +431,9 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     */
    public void delCompany(String id){
        IotCompanyDO company = iotCompanyDao.findById(id);
        if (company==null){
           throw new RuntimeException("该企业已删除,请勿重复操作");
        }
        company.setDel(0);
        iotCompanyDao.save(company);
    }
@ -264,22 +442,38 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * 修改
     * @param iotCompany
     */
    public void updCompany(IotCompanyDO iotCompany){
        //更新类型
        List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(iotCompany.getId());
        iotCompanyTypeDao.delete(typeList);
        List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
        iotCompany.getTypeList().forEach(one->{
            IotCompanyTypeDO companyType = new IotCompanyTypeDO();
            companyType.setSaasId(getCode());
            companyType.setCompanyId(iotCompany.getId());
            companyType.setType(one.getType());
            companyType.setTypeName(one.getTypeName());
            companyTypes.add(companyType);
        });
    public void updCompany(IotCompanyDO iotCompany,String accountType){
        
        if(accountType.equalsIgnoreCase("1")){
            //更新类型
            List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(iotCompany.getId());
            iotCompanyTypeDao.delete(typeList);
            List<IotCompanyTypeDO> companyTypes = new ArrayList<>(10);
            iotCompany.getTypeList().forEach(one->{
                IotCompanyTypeDO companyType = new IotCompanyTypeDO();
                companyType.setSaasId(getCode());
                companyType.setCompanyId(iotCompany.getId());
                companyType.setType(one.getType());
                companyType.setTypeName(one.getTypeName());
                companyTypes.add(companyType);
            });
        iotCompanyTypeDao.save(companyTypes);
            iotCompanyTypeDao.save(companyTypes);
        }
        //更新应用
        if(accountType.equalsIgnoreCase("0")){
            IotCompanyAppDO newApp = iotCompany.getAppList().get(0);
            IotCompanyAppDO oldApp = iotCompanyAppDao.findOne(newApp.getId());
            oldApp.setAddressIp(newApp.getAddressIp());
            oldApp.setName(newApp.getName());
            oldApp.setId(newApp.getId());
            oldApp.setCompanyId(iotCompany.getId());
            oldApp.setCompanyName(iotCompany.getName());
            oldApp.setSaasId(getCode());
            iotCompanyAppDao.save(oldApp);
        }
       
        //记录三证变更记录
        IotCompanyDO iotCompanyOld = iotCompanyDao.findById(iotCompany.getId());
@ -328,6 +522,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        }
        //修改企业记录
        iotCompanyOld.setEnterType(iotCompany.getEnterType());
        iotCompanyOld.setName(iotCompany.getName());
        iotCompanyOld.setIsThreeInOne(iotCompany.getIsThreeInOne());
        iotCompanyOld.setBusinessLicense(iotCompany.getBusinessLicense());
@ -361,4 +556,87 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            return true;
        }
    }
    /**
     * 通过审核
     * @param id 企业ID
     * @return
     */
    public MixEnvelop auditCompany(String id) {
        IotCompanyDO companyDO = findById(id);
        if (companyDO==null){
        }
        String uname = userAgent.getUNAME();
        if (uname==null){
            companyDO.setAuditName("system");
        }
        companyDO.setStatus("1");
        companyDO.setAuditTime(DateUtil.getNowDate());
        companyDO.setAuditName(uname);
        iotCompanyDao.save(companyDO);
        return MixEnvelop.getSuccess("审核操作成功");
    }
    /**
     * 审核失败
     * @param id 企业ID
     * @param msg 拒绝说明
     * @return
     */
    public MixEnvelop auditCompany(String id,String msg) {
        IotCompanyDO companyDO = findById(id);
        if (companyDO==null){
            return MixEnvelop.getError("无该企业");
        }
        String uname = userAgent.getUNAME();
        if (uname==null){
            companyDO.setAuditName("system");
        }
        companyDO.setStatus("2");
        companyDO.setAuditTime(DateUtil.getNowDate());
        companyDO.setAuditMessage(msg);
        companyDO.setAuditName(uname);
        iotCompanyDao.save(companyDO);
        return MixEnvelop.getSuccess("审核操作成功");
    }
    /**
     * 根据入驻类型查找企业信息
     * @param entryCode 入驻类型
     * @return
     */
    public List<IotCompanyDO> findByEnterType(String entryCode) {
        List<IotCompanyDO> companyDOList = iotCompanyDao.findByEnterType(entryCode);
        for (IotCompanyDO companyDO : companyDOList) {
            List<IotCompanyTypeDO> typeList = iotCompanyTypeDao.findByCompanyId(companyDO.getId());
            companyDO.setTypeList(typeList);
        }
        return companyDOList;
    }
    /**
     * 查找所有企业
     * @param accountType 标识 1:厂商 0:平台
     * @return
     */
    public List<IotCompanyDO> findAll(String accountType) {
        List<IotCompanyDO> iotCompanyDOS = new ArrayList<>();
        if("1".equalsIgnoreCase(accountType)){
            iotCompanyDOS = iotCompanyDao.findByAccountType(accountType);
            for (IotCompanyDO iotCompanyDO : iotCompanyDOS) {
                List<IotCompanyTypeDO> companyTypeDOS = iotCompanyTypeDao.findByCompanyId(iotCompanyDO.getId());
                iotCompanyDO.setTypeList(companyTypeDOS);
            }
        }
        if ("0".equalsIgnoreCase(accountType)){
            Iterable<IotCompanyDO> companyDOS = iotCompanyDao.findByAccountType(accountType);
            for (IotCompanyDO companyDO : companyDOS) {
                List<IotCompanyAppDO> appDOList = iotCompanyAppDao.findByCompanyId(companyDO.getId());
                companyDO.setAppList(appDOList);
                iotCompanyDOS.add(companyDO);
            }
        }
        return iotCompanyDOS;
    }
}

+ 28 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotDeviceDictService.java

@ -3,9 +3,15 @@ package com.yihu.iot.service.dict;
import com.yihu.iot.dao.dict.IotDeviceDictDao;
import com.yihu.jw.entity.iot.dict.IotDeviceDictDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import static com.yihu.jw.util.common.BeanUtils.getNullPropertyNames;
/**
 * @author yeshijie on 2017/12/8.
 */
@ -19,4 +25,26 @@ public class IotDeviceDictService extends BaseJpaService<IotDeviceDictDO,IotDevi
        return iotDeviceDictDao.findById(id);
    }
    /**
     * 新增或编辑体征字典
     * @param dictDO
     * @return
     */
    public IotDeviceDictDO create(IotDeviceDictDO dictDO) {
        //判断新增或者编辑
        if(StringUtils.isNotBlank(dictDO.getId())){
            IotDeviceDictDO oldDictDO = iotDeviceDictDao.findById(dictDO.getId());
            BeanUtils.copyProperties(dictDO, oldDictDO, getNullPropertyNames(dictDO));
            oldDictDO.setUpdateTime(new Date());
            iotDeviceDictDao.save(oldDictDO);
            return oldDictDO;
        }else {
            dictDO.setSaasId(getCode());
            dictDO.setDel(1);
            dictDO.setCreateTime(new Date());
            iotDeviceDictDao.save(dictDO);
            return dictDO;
        }
    }
}

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

@ -5,9 +5,11 @@ import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.service.common.MyJdbcTemplate;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
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.HashMap;
import java.util.List;
import java.util.Map;
@ -39,6 +41,45 @@ public class IotSystemDictService extends BaseJpaService<IotSystemDictDO,IotSyst
    }
    public IotSystemDictDO create(IotSystemDictDO dictDO) {
        String value = dictDO.getValue();
        String parentCode = dictDO.getParentCode();
        //判断新增或者编辑
        if(StringUtils.isNotBlank(dictDO.getCode())){
            dictDO = iotSystemDictDao.findByDictNameAndCodeAndDel(dictDO.getDictName(), dictDO.getCode(), 1);
            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 {
                dictDO.setCode("1");
            }
            dictDO.setSaasId(getCode());
            dictDO.setDel(1);
            dictDO.setCreateTime(new Date());
        }
        iotSystemDictDao.save(dictDO);
        return dictDO;
    }
    /**
     * 根据字典类名获取相关字典数据
     * @param dictName
     * @return
     */
    public List<IotSystemDictDO> getListByDictName(String dictName){
        List<IotSystemDictDO> systemDictDOList = iotSystemDictDao.findByDictName(dictName);
        for(IotSystemDictDO dictDO : systemDictDOList){
            if(StringUtils.isNotBlank(dictDO.getParentCode())){
                //获取父类字典名称
                IotSystemDictDO parentDict = iotSystemDictDao.findOne(dictDO.getParentCode());
                dictDO.setParentName(parentDict.getValue());
            }
        }
        return systemDictDOList;
    }
}

+ 90 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/useragent/UserAgent.java

@ -0,0 +1,90 @@
package com.yihu.iot.service.useragent;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
 * 用户头部信息获取
 * Created by Trick on 2018/10/30.
 */
@Component
public class UserAgent {
    /**
     * 获取当前登录人ID
     * @return
     */
    public String getUID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("uid");
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取登录人姓名
     * @return
     */
    public String getUNAME(){
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            String info = json.getString("uname");
            String uname = java.net.URLDecoder.decode(info,"UTF-8");
            return uname;
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取角色ID
     * @return
     */
    public String getROLEID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("roleid");
        } catch (Exception e) {
            return null;
        }
    }
    public JSONObject getUserAgent(){
        try{
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            JSONObject user = JSON.parseObject(userAgent);
            return user;
        }catch (Exception e){
            return null;
        }
    }
}

+ 1 - 1
svr/svr-iot/src/main/resources/application.yml

@ -81,7 +81,7 @@ fastDFS:
spring:
  profiles: dev
  datasource:
    url: jdbc:mysql://172.26.0.204:3306/xmiot?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    url: jdbc:mysql://172.26.0.104:3306/xmiot?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg@jkzl2019
  elasticsearch:

+ 1 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistService.java

@ -687,6 +687,7 @@ public class SpecialistService{
                " d.dept_name AS deptName, " +
                " d.hospital, " +
                " d.hospital_name AS hospital_name, " +
                " r.id AS specialCode, " +
                " d.`level` " +
                " FROM " +
                " wlyy_specialist.wlyy_specialist_patient_relation r " +