Explorar o código

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

zdm %!s(int64=5) %!d(string=hai) anos
pai
achega
14d38cb393
Modificáronse 23 ficheiros con 1211 adicións e 157 borrados
  1. 2 1
      business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyChargeDictDao.java
  2. 21 0
      business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyHospitalSysDictDao.java
  3. 8 1
      business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/DoctorWorkTimeDao.java
  4. 15 0
      business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/PatientRegisterTimeDao.java
  5. 370 72
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  6. 13 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  7. 13 5
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyDoctorWorkTimeDO.java
  8. 24 5
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyPatientRegisterTimeDO.java
  9. 20 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  10. 194 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/doctor/WlyyDoctorWorkTimeVO.java
  11. 70 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyChargeDictVO.java
  12. 0 14
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/config/JpaConfig.java
  13. 2 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/SysDictDao.java
  14. 53 6
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  15. 2 35
      svr/svr-iot/pom.xml
  16. 24 2
      svr/svr-iot/src/main/java/com/yihu/iot/controller/analyzer/IotAnalyzerController.java
  17. 132 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/IotAnalyzerService.java
  18. 79 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/WlyyIotD.java
  19. 14 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/WlyyIotDDao.java
  20. 144 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/WlyyIotM.java
  21. 8 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/WlyyIotMDao.java
  22. 2 2
      svr/svr-iot/src/main/resources/application.yml
  23. 1 14
      svr/svr-iot/src/main/resources/bootstrap.yml

+ 2 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyChargeDictDao.java

@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import javax.transaction.Transactional;
import java.util.List;
/**
 * Created by zdm on 2019/5/28.
@ -12,5 +13,5 @@ import javax.transaction.Transactional;
@Transactional
public interface WlyyChargeDictDao extends PagingAndSortingRepository<WlyyChargeDictDO, String>, JpaSpecificationExecutor<WlyyChargeDictDO> {
    List<WlyyChargeDictDO>  findByDeptTypeCode(String deptTypeCode);
}

+ 21 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyHospitalSysDictDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.hospital.dict;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/6/17.
 */
public interface WlyyHospitalSysDictDao extends PagingAndSortingRepository<WlyyHospitalSysDictDO, String>, JpaSpecificationExecutor<WlyyHospitalSysDictDO> {
    WlyyHospitalSysDictDO findByHospitalAndDictCode(String hospital, String dictCode);
    List<WlyyHospitalSysDictDO> findByHospitalAndDictName(String hospital, String dictName);
    WlyyHospitalSysDictDO findById(String id);
    List<WlyyHospitalSysDictDO> findByDictName(String dictName);
}

+ 8 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/DoctorWorkTimeDao.java

@ -2,11 +2,18 @@ package com.yihu.jw.hospital.doctor.dao;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
/**
 * Created by Trick on 2019/5/31.
 */
public interface DoctorWorkTimeDao extends PagingAndSortingRepository<WlyyDoctorWorkTimeDO, String>, JpaSpecificationExecutor<WlyyDoctorWorkTimeDO> {
    
    @Query("from WlyyDoctorWorkTimeDO a where a.doctor = ?1 and a.endTime > ?2 and a.endTime < ?3 order by a.startTime asc")
    List<WlyyDoctorWorkTimeDO> findDoctorWorkTime(String doctor, Date startTime, Date endTime);
}

+ 15 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/PatientRegisterTimeDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.hospital.doctor.dao;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/6/19.
 */
public interface PatientRegisterTimeDao extends PagingAndSortingRepository<WlyyPatientRegisterTimeDO, String>, JpaSpecificationExecutor<WlyyPatientRegisterTimeDO> {
    List<WlyyPatientRegisterTimeDO> findByDoctorAndWorkId(String doctor,String workId);
}

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

@ -8,13 +8,19 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
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.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.consult.dao.DoctorClinicRoomConsultDao;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
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.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.*;
@ -24,21 +30,18 @@ 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.doctor.WlyyDoctorWorkTimeVO;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import jxl.*;
import jxl.write.*;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -49,10 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.Boolean;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * Created by Trick on 2019/5/17.
@ -97,6 +97,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private OutpatientDao outpatientDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private WlyyChargeDictDao wlyyChargeDictDao;
    @Autowired
    private WlyyHospitalSysDictDao sysDictDao;
    @Autowired
    private DoctorWorkTimeDao doctorWorkTimeDao;
    @Autowired
    private PatientRegisterTimeDao patientRegisterTimeDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -193,6 +201,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.origin_adm_no AS originAdmNo, " +
                " o.register_no AS registerNo, " +
                " o.origin_register_no AS originRegisterNo, " +
                " o.origin_con_no AS originConNo," +
                " o.con_no AS conNo," +
                " o.hospital," +
                " o.hospital_name AS hospitalName," +
                " o.win_no AS winNo," +
@ -461,10 +471,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     * @throws Exception
     */
    public Boolean appointmentRevisit(String outpatientJson,String expressageJson)throws Exception{
    public Boolean appointmentRevisit(String outpatientJson,String expressageJson,String registerJson)throws Exception{
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
@ -476,6 +485,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        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);
@ -489,61 +512,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return true;
    }
//    /**
//     *
//     * @param json
//     * @return
//     */
//    public String paymentCallback(JSONObject json)throws Exception{
//
//        //创建续方
//        createPrescription(json);
//        //创建诊室
//        createRoom(json);
//        return null;
//    }
//    public Boolean createPrescription(JSONObject json) throws Exception{
//
//        String patient = json.getString("patient");
//        String doctor = json.getString("doctor");
//
//        String originRealOrder = json.getString("originRealOrder");
//        String originAdmNo = json.getString("originAdmNo");
//        String serialNo = json.getString("serialNo");
//
//
//        BasePatientDO basePatientDO = basePatientDao.findById(patient);
//        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),patient,"1");
//        BaseDoctorDO baseDoctorDO = baseDoctorDao.findOne(doctor);
//        String patNo  = patientMappingService.findHisPatNoByIdCard(basePatientDO.getIdcard());
//
//        WlyyPrescriptionVO originPrescriptionVO = findOriginPrescription(serialNo,patNo,originAdmNo,originRealOrder,demoFlag);
//
//        WlyyPrescriptionDO prescription = new WlyyPrescriptionDO();
//        prescription.setOriginAdmNo(originAdmNo);
//        prescription.setOriginRealOrder(originRealOrder);
//        prescription.setOriginSerialNo(serialNo);
//        prescription.setStatus(0);
//        prescription.setPatientCode(patient);
//        prescription.setPatientName(basePatientDO.getName());
//        prescription.setSsc(cardDO.getCode());
//        prescription.setDoctor(doctor);
//        prescription.setDoctorName(baseDoctorDO.getName());
//
//        List<WlyyPrescriptionInfoVO> originInfoVOs = originPrescriptionVO.getInfoVOs();
//        List<WlyyPrescriptionInfoDO> infoDOs = new ArrayList<>();
//        List<WlyyPrescriptionDiagnosisVO> diagnosisVOs = originPrescriptionVO.getDiagnosisVOs();
//        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = new ArrayList<>();
//
//        prescriptionInfoDao.save(convertToModels(originInfoVOs,infoDOs,WlyyPrescriptionInfoDO.class));
//        prescriptionDiagnosisDao.save(convertToModels(diagnosisVOs,diagnosisDOs,WlyyPrescriptionDiagnosisDO.class));
//        prescriptionDao.save(prescription);
//        return true;
//    }
    /**
     * 创建候诊室
     * @param outpatientDO
@ -648,10 +616,20 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param orgCode
     * @return
     */
    public List<DictHospitalDeptVO> findDeptByHospital(String orgCode){
    public List<DictHospitalDeptVO> findDeptByHospital(String orgCode,String dept){
        List<DictHospitalDeptDO> list =  dictHospitalDeptDao.findByOrgCodeIn(orgCode);
        List<DictHospitalDeptVO> rs = new ArrayList<>();
        return convertToModels(list,rs,DictHospitalDeptVO.class);
        convertToModels(list,rs,DictHospitalDeptVO.class);
        if(rs!=null&&rs.size()>0&&StringUtils.isNotBlank(dept)){
            //排序
            for(int i=0;i<rs.size();i++){
                String id = rs.get(i).getCode();
                if(dept.equals(id)){
                    Collections.swap(list,0,i);
                }
            }
        }
        return rs;
    }
    /**
@ -660,23 +638,106 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param dept
     * @return
     */
    public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept){
    public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String chargeType,String dept,String doctorCode){
        String sql ="SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +
                " h.doctor_duty_code, " +
                " h.doctor_duty_name " +
                " d.expertise," +
                " d.introduce," +
                " d.job_title_code AS jobTitleCode, " +
                " d.job_title_name AS jobTitleName," +
                " d.charge_type AS chargeType" +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " WHERE  " +
                " h.dept_code = '"+dept+"' " +
                " AND h.org_code = '"+orgCode+"'";
        if(StringUtils.isNotBlank(chargeType)){
            sql+=" AND d.charge_type ='"+chargeType+"'";
        }
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0&&StringUtils.isNotBlank(doctorCode)){
            //排序
            for(int i=0;i<list.size();i++){
                String id = (String)list.get(i).get("id");
                if(doctorCode.equals(id)){
                    Collections.swap(list,0,i);
                }
            }
        }
        return list;
    }
    /**
     * 获取医生列表
     * @param orgCode
     * @param dept
     * @return
     */
    public MixEnvelop findDoctorWithWork(String orgCode,String dept,String chargeType,String doctorCode,Integer page,Integer size){
        String totalSql ="SELECT " +
                " count(1) AS total " +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " WHERE  " +
                " h.dept_code = '"+dept+"' " +
                " AND h.org_code = '"+orgCode+"'";
        if(StringUtils.isNotBlank(chargeType)){
            totalSql+=" AND d.charge_type ='"+chargeType+"'";
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = (Long) rstotal.get(0).get("total");
        }
        String sql ="SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +
                " d.expertise," +
                " d.introduce," +
                " d.job_title_code AS jobTitleCode, " +
                " d.job_title_name AS jobTitleName," +
                " d.charge_type AS chargeType" +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " WHERE  " +
                " h.dept_code = '"+dept+"' " +
                " AND h.org_code = '"+orgCode+"'";
        if(StringUtils.isNotBlank(chargeType)){
            sql+=" AND d.charge_type ='"+chargeType+"'";
        }
        sql += " LIMIT " + (page - 1) * size + "," + size + "";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
            //获取排班
            for(Map<String,Object> doctor :list){
                String id = (String)doctor.get("id");
                List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(id);
                doctor.put("workTime",times);
            }
            if(StringUtils.isNotBlank(doctorCode)){
                //排序
                for(int i=0;i<list.size();i++){
                    String id = (String)list.get(i).get("id");
                    if(doctorCode.equals(id)){
                        Collections.swap(list,0,i);
                    }
                }
            }
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
    /**
     * 挂号
     * @return
@ -695,6 +756,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            //存储挂号号
            String serialNo = (String)rs.get("serial_no");
            outpatientDO.setRegisterNo(serialNo);
            String conNo = (String)rs.get("@times");
            outpatientDO.setCardNo(conNo);
        }
        return rs;
@ -1059,4 +1122,239 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        ws.addCell(label);
    }
    public List<WlyyChargeDictVO> findByDeptTypeCode(String deptTypeCode){
        List<WlyyChargeDictDO> dictDOs = wlyyChargeDictDao.findByDeptTypeCode(deptTypeCode);
        List<WlyyChargeDictVO> dictVOs = new ArrayList<>();
        return convertToModels(dictDOs,dictVOs,WlyyChargeDictVO.class);
    }
    public List<WlyyDoctorWorkTimeVO> findDoctorWorkTime(String doctor){
        //获取医生排班规则
        List<WlyyHospitalSysDictDO> list = sysDictDao.findByDictName("Scheduling");
        Calendar ncTime = Calendar.getInstance();
        ncTime.setTime(new Date());
        Calendar scTime = Calendar.getInstance();
        scTime.setTime(new Date());
        Calendar ecTime = Calendar.getInstance();
        ecTime.setTime(new Date());
        //设置几天号源,及最后天号源的开放时间
        int days =Integer.parseInt(findHospitalSysDictValue(list,"OpenDays"));
        String closeTime = findHospitalSysDictValue(list,"CloseTime");
        //比较当前时间是否超过开放时间
        if(DateUtil.strToDate(DateUtil.getTimeShort(),DateUtil.HH_MM_SS).after(DateUtil.strToDate(closeTime,DateUtil.HH_MM))){
            //当前时间超过开放时间,可以预约最后一天全部号源
            ecTime.add(Calendar.DAY_OF_MONTH,days);
            ecTime.set(ecTime.get(Calendar.YEAR),ecTime.get(Calendar.MONTH),ecTime.get(Calendar.DATE),23,59,59);
        }else{
            //当前时间没超过开放时间,可以预约最后一天前一天全部号源
            ecTime.add(Calendar.DAY_OF_MONTH,days>1?days-1:0);
            ecTime.set(ecTime.get(Calendar.YEAR),ecTime.get(Calendar.MONTH),ecTime.get(Calendar.DATE),23,59,59);
        }
        List<WlyyDoctorWorkTimeDO> times =  doctorWorkTimeDao.findDoctorWorkTime(doctor,scTime.getTime(),ecTime.getTime());
        workTimeFilter(list,times);
        List<WlyyDoctorWorkTimeVO> timeVOs = new ArrayList<>();
        convertToModels(times,timeVOs,WlyyDoctorWorkTimeVO.class);
        if(timeVOs!=null&&timeVOs.size()>0){
            for(WlyyDoctorWorkTimeVO timeVO : timeVOs){
                timeVO.setCount(findWorkTimeCount(timeVO.getId()));
            }
        }
        return timeVOs;
    }
    public List<WlyyDoctorWorkTimeDO> workTimeFilter(List<WlyyHospitalSysDictDO> sys,List<WlyyDoctorWorkTimeDO> times){
        if(times!=null&&times.size()>0){
            //上午号源开放的最早天数
            int AMCloseDays =Integer.parseInt(findHospitalSysDictValue(sys,"AMCloseDays"));
            //每一天上午的最早预约的过号时间
            String AMCloseTime = findHospitalSysDictValue(sys,"AMCloseTime");
            //下午号源开放的最早天数
            int PMCloseDays =Integer.parseInt(findHospitalSysDictValue(sys,"PMCloseDays"));
            //每一天下午的最早预约的过号时间
            String PMCloseTime = findHospitalSysDictValue(sys,"PMCloseTime");
            Iterator it = times.iterator();
            while (it.hasNext()){
                //设置上午过号时间
                Calendar scAMTime = Calendar.getInstance();
                scAMTime.setTime(new Date());
                scAMTime.add(Calendar.DAY_OF_MONTH,AMCloseDays);
                //设置下午午过号时间
                Calendar scPMTime = Calendar.getInstance();
                scPMTime.setTime(new Date());
                scPMTime.add(Calendar.DAY_OF_MONTH,PMCloseDays);
                WlyyDoctorWorkTimeDO time = (WlyyDoctorWorkTimeDO)it.next();
                Boolean filter = true;
                //1.【上午的排班中】 且 【排班结束时间】如果在【开放时间】前,则移除
                if(filter&&"1".equals(time.getTimeType())&&time.getEndTime().before(scAMTime.getTime())){
                    it.remove();
                    filter=false;
                }
                //2.【下午午的排班中】 且 【排班结束时间】如果在【开放时间】前,则移除该排班
                if(filter&&"2".equals(time.getTimeType())&&time.getEndTime().before(scPMTime.getTime())){
                    it.remove();
                    filter=false;
                }
                //3.如果【当前时间】过了【上午放号时间】,则移除所有上午的排班
                if(filter&&"1".equals(time.getTimeType())&&
                        DateUtil.strToDate(DateUtil.getTimeShort(),DateUtil.HH_MM_SS).after(DateUtil.strToDate(AMCloseTime,DateUtil.HH_MM))){
                    scAMTime.set(scAMTime.get(Calendar.YEAR),scAMTime.get(Calendar.MONTH),scAMTime.get(Calendar.DATE),12,00,00);
                    if(time.getEndTime().before(scAMTime.getTime())){
                        it.remove();
                        filter=false;
                    }
                }
                //4.如果【当前时间】过了【下午午放号时间】,则移除所有下午的排班
                if(filter&&"2".equals(time.getTimeType())&&
                        DateUtil.strToDate(DateUtil.getTimeShort(),DateUtil.HH_MM_SS).after(DateUtil.strToDate(PMCloseTime,DateUtil.HH_MM))){
                    scPMTime.set(scAMTime.get(Calendar.YEAR),scAMTime.get(Calendar.MONTH),scAMTime.get(Calendar.DATE),12,00,00);
                    if(time.getEndTime().before(scPMTime.getTime())){
                        it.remove();
                    }
                }
            }
        }
        return times;
    }
    public String findHospitalSysDictValue(List<WlyyHospitalSysDictDO> list,String dictCode){
        if(list!=null&&list.size()>0){
            for(WlyyHospitalSysDictDO sysDictDO : list){
                if(dictCode.equals(sysDictDO.getDictCode())){
                    return sysDictDO.getDictValue();
                }
            }
        }
        return "";
    }
    /**
     * 获取卡信息
     * @param cardNo
     * @param demoFlag
     * @return
     * @throws Exception
     */
    public net.sf.json.JSONObject getCardInfo(String cardNo, boolean demoFlag) throws Exception {
        return entranceService.qutpatientBalance(cardNo,demoFlag);
    }
    public List<Map<String,Object>> findWorkTimeInfo(String id){
        WlyyDoctorWorkTimeDO timeDO = doctorWorkTimeDao.findOne(id);
        Calendar sc = Calendar.getInstance();
        sc.setTime(timeDO.getStartTime());
        List<Map<String,Object>> rs = new ArrayList<>();
        //1.根据当前时间,去取已过时间的号源
        while (sc.getTime().before(timeDO.getEndTime())){
            if(new Date().before(sc.getTime())){
                break;
            }
            //加上时间间隔
            sc.add(Calendar.MINUTE,timeDO.getTimeInterval());
        }
        List<WlyyPatientRegisterTimeDO> registerTimeDOs = patientRegisterTimeDao.findByDoctorAndWorkId(timeDO.getDoctor(),id);
        //2.根据时间间隔拆分号源
        while (sc.getTime().before(timeDO.getEndTime())){
            Map<String,Object> t = new HashedMap();
            t.put("startTime",DateUtil.dateToStr(sc.getTime(),"yyyy-MM-dd HH:mm:ss"));
            //加上时间间隔
            sc.add(Calendar.MINUTE,timeDO.getTimeInterval());
            if(sc.getTime().after(timeDO.getEndTime())){
                break;
            }
            t.put("endTime",DateUtil.dateToStr(sc.getTime(),"yyyy-MM-dd HH:mm:ss"));
            if(registerTimeDOs!=null&&registerTimeDOs.size()>0){
                Boolean registered = false;
                for(WlyyPatientRegisterTimeDO registerTimeDO : registerTimeDOs){
                    if(t.get("startTime").equals(DateUtil.dateToStr(registerTimeDO.getStartTime(),"yyyy-MM-dd HH:mm:ss"))){
                        registered = true;
                    }
                }
                t.put("registered",registered);
            }
            rs.add(t);
        }
        return rs;
    }
    public Integer findWorkTimeCount(String id){
        WlyyDoctorWorkTimeDO timeDO = doctorWorkTimeDao.findOne(id);
        Calendar sc = Calendar.getInstance();
        sc.setTime(timeDO.getStartTime());
        List<Map<String,Object>> rs = new ArrayList<>();
        //1.根据当前时间,去取已过时间的号源
        while (sc.getTime().before(timeDO.getEndTime())){
            if(new Date().before(sc.getTime())){
                break;
            }
            //加上时间间隔
            sc.add(Calendar.MINUTE,timeDO.getTimeInterval());
        }
        List<WlyyPatientRegisterTimeDO> registerTimeDOs = patientRegisterTimeDao.findByDoctorAndWorkId(timeDO.getDoctor(),id);
        //2.根据时间间隔拆分号源
        while (sc.getTime().before(timeDO.getEndTime())){
            Map<String,Object> t = new HashedMap();
            t.put("startTime",DateUtil.dateToStr(sc.getTime(),"yyyy-MM-dd HH:mm:ss"));
            //加上时间间隔
            sc.add(Calendar.MINUTE,timeDO.getTimeInterval());
            if(sc.getTime().after(timeDO.getEndTime())){
                break;
            }
            t.put("endTime",DateUtil.dateToStr(sc.getTime(),"yyyy-MM-dd HH:mm:ss"));
            if(registerTimeDOs!=null&&registerTimeDOs.size()>0){
                Boolean registered = false;
                for(WlyyPatientRegisterTimeDO registerTimeDO : registerTimeDOs){
                    if(t.get("startTime").equals(DateUtil.dateToStr(registerTimeDO.getStartTime(),"yyyy-MM-dd HH:mm:ss"))){
                        registered = true;
                    }
                }
                if(!registered){
                    rs.add(t);
                }
            }else {
                rs.add(t);
            }
        }
        return rs.size();
    }
}

+ 13 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -162,6 +162,10 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
	 */
	private String jobTitleName;
    /**
     * 号别字典
     */
    private String chargeType;
    /**
	 * 作废标识,1正常,0作废
	 */
@ -398,4 +402,13 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    public void setJobTitleName(String jobTitleName) {
        this.jobTitleName = jobTitleName;
    }
    @Column(name = "charge_type")
    public String getChargeType() {
        return chargeType;
    }
    public void setChargeType(String chargeType) {
        this.chargeType = chargeType;
    }
}

+ 13 - 5
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyDoctorWorkTimeDO.java

@ -24,10 +24,11 @@ public class WlyyDoctorWorkTimeDO extends UuidIdentityEntity {
    private String registerName;//挂号类别名称
    private Double registerFee;//费用
    private String type;//1.线上;2.线下',
    private String timeType;//1.上午 7:00~12:00;2.下午12:00~18:00;4.晚上 其他时间段',
    private String timeType;//1.上午00:00~12:00之前;2.下午12:00~00:00;',
    private Date startTime;//开始时间',
    private Date endTime;//结束时间',
    private Date date;//排班日期',
    private String date;//排班日期',
    private Integer timeInterval;//号源间隔
    private Date createTime;//创建时间',
    public String getDoctor() {
@ -137,12 +138,11 @@ public class WlyyDoctorWorkTimeDO extends UuidIdentityEntity {
        this.endTime = endTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getDate() {
    public String getDate() {
        return date;
    }
    public void setDate(Date date) {
    public void setDate(String date) {
        this.date = date;
    }
@ -154,4 +154,12 @@ public class WlyyDoctorWorkTimeDO extends UuidIdentityEntity {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getTimeInterval() {
        return timeInterval;
    }
    public void setTimeInterval(Integer timeInterval) {
        this.timeInterval = timeInterval;
    }
}

+ 24 - 5
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyPatientRegisterTimeDO.java

@ -14,6 +14,8 @@ import java.util.Date;
@Table(name = "wlyy_patient_register_time")
public class WlyyPatientRegisterTimeDO extends UuidIdentityEntity {
    private String outpatientId;//门诊记录id
    private String patient;//患者code',
    private String patientName;//患者姓名',
    private String doctor;//医生code',
@ -21,8 +23,17 @@ public class WlyyPatientRegisterTimeDO extends UuidIdentityEntity {
    private String workId;//医生排班id',
    private Date startTime;//预约开始时间',
    private Date endTime;//
    private String timeType;//1.上午00:00~12:00之前;2.下午12:00~00:00;',
    private String date;//预约日期',
    private Date create_time;//创建时间',
    private Date createTime;//创建时间',
    public String getOutpatientId() {
        return outpatientId;
    }
    public void setOutpatientId(String outpatientId) {
        this.outpatientId = outpatientId;
    }
    public String getPatient() {
        return patient;
@ -81,6 +92,14 @@ public class WlyyPatientRegisterTimeDO extends UuidIdentityEntity {
        this.endTime = endTime;
    }
    public String getTimeType() {
        return timeType;
    }
    public void setTimeType(String timeType) {
        this.timeType = timeType;
    }
    public String getDate() {
        return date;
    }
@ -90,11 +109,11 @@ public class WlyyPatientRegisterTimeDO extends UuidIdentityEntity {
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreate_time() {
        return create_time;
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

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

@ -118,6 +118,26 @@ public class BaseHospitalRequestMapping {
         * 订单导出
         */
        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";
        //=================end=======================================
        /**

+ 194 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/doctor/WlyyDoctorWorkTimeVO.java

@ -0,0 +1,194 @@
package com.yihu.jw.restmodel.hospital.doctor;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by Trick on 2019/6/18.
 */
@ApiModel(value = "WlyyDoctorWorkTimeVO", description = "医生工作时间")
public class WlyyDoctorWorkTimeVO {
    @ApiModelProperty(value = "排班id", example = "模块1")
    private String id;
    @ApiModelProperty(value = "医生code", example = "模块1")
    private String doctor;//医生code',
    @ApiModelProperty(value = "医生名称", example = "模块1")
    private String doctorName;//医生名称',
    @ApiModelProperty(value = "医院code", example = "模块1")
    private String hospital;//医院code
    @ApiModelProperty(value = "医院名称", example = "模块1")
    private String hospitalName;//医院名称
    @ApiModelProperty(value = "部门", example = "模块1")
    private String dept;//部门
    @ApiModelProperty(value = "部门名称", example = "模块1")
    private String deptName;//部门名称
    @ApiModelProperty(value = "挂号code", example = "模块1")
    private String registerCode;//挂号code',
    @ApiModelProperty(value = "挂号类别名称", example = "模块1")
    private String registerName;//挂号类别名称
    @ApiModelProperty(value = "费用", example = "模块1")
    private Double registerFee;//费用
    @ApiModelProperty(value = "1.线上;2.线下',", example = "模块1")
    private String type;//1.线上;2.线下',
    @ApiModelProperty(value = "1.上午00:00~12:00之前;2.下午12:00~00:00;',", example = "模块1")
    private String timeType;//1.上午00:00~12:00之前;2.下午12:00~00:00;',
    @ApiModelProperty(value = "开始时间", example = "模块1")
    private Date startTime;//开始时间',
    @ApiModelProperty(value = "结束时间", example = "模块1")
    private Date endTime;//结束时间',
    @ApiModelProperty(value = "号别code", example = "模块1")
    private String date;//排班日期',
    @ApiModelProperty(value = "号源间隔", example = "模块1")
    private Integer timeInterval;//号源间隔
    @ApiModelProperty(value = "创建时间", example = "模块1")
    private Date createTime;//创建时间',
    @ApiModelProperty(value = "当前号源数目", example = "模块1")
    private Integer count;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getRegisterCode() {
        return registerCode;
    }
    public void setRegisterCode(String registerCode) {
        this.registerCode = registerCode;
    }
    public String getRegisterName() {
        return registerName;
    }
    public void setRegisterName(String registerName) {
        this.registerName = registerName;
    }
    public Double getRegisterFee() {
        return registerFee;
    }
    public void setRegisterFee(Double registerFee) {
        this.registerFee = registerFee;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getTimeType() {
        return timeType;
    }
    public void setTimeType(String timeType) {
        this.timeType = timeType;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public String getDate() {
        return date;
    }
    public void setDate(String date) {
        this.date = date;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Integer getTimeInterval() {
        return timeInterval;
    }
    public void setTimeInterval(Integer timeInterval) {
        this.timeInterval = timeInterval;
    }
    public Integer getCount() {
        return count;
    }
    public void setCount(Integer count) {
        this.count = count;
    }
}

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

@ -0,0 +1,70 @@
package com.yihu.jw.restmodel.hospital.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by Trick on 2019/6/17.
 */
@ApiModel(value = "WlyyHisPrescriptionVO", description = "诊查费实体")
public class WlyyChargeDictVO {
    /**号别code*/
    @ApiModelProperty(value = "号别code", example = "模块1")
    private String chargeType;
    /**号别名称*/
    @ApiModelProperty(value = "号别名称", example = "模块1")
    private String chargeName;
    /**诊查费,单位元*/
    @ApiModelProperty(value = "诊查费,单位元", example = "模块1")
    private double reqFee;
    /**创建时间*/
    @ApiModelProperty(value = "创建时间", example = "模块1")
    private Date createTime;
    /**6总部7金榜8夏禾*/
    @ApiModelProperty(value = "6总部7金榜8夏禾", example = "模块1")
    private String deptTypeCode;
    public String getChargeType() {
        return chargeType;
    }
    public void setChargeType(String chargeType) {
        this.chargeType = chargeType;
    }
    public String getChargeName() {
        return chargeName;
    }
    public void setChargeName(String chargeName) {
        this.chargeName = chargeName;
    }
    public double getReqFee() {
        return reqFee;
    }
    public void setReqFee(double reqFee) {
        this.reqFee = reqFee;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getDeptTypeCode() {
        return deptTypeCode;
    }
    public void setDeptTypeCode(String deptTypeCode) {
        this.deptTypeCode = deptTypeCode;
    }
}

+ 0 - 14
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/config/JpaConfig.java

@ -1,14 +0,0 @@
package com.yihu.jw.hospital.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.jpa.JpaTransactionManager;
@Configuration
public class JpaConfig {
    @Bean
    public JpaTransactionManager transactionManager(){
        return new JpaTransactionManager();
    }
}

+ 2 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/SysDictDao.java

@ -15,4 +15,6 @@ public interface SysDictDao extends PagingAndSortingRepository<WlyyHospitalSysDi
    List<WlyyHospitalSysDictDO> findByHospitalAndDictName(String hospital, String dictName);
    WlyyHospitalSysDictDO findById(String id);
    List<WlyyHospitalSysDictDO> findByDictName(String dictName);
}

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

@ -181,8 +181,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByHospital)
    @ApiOperation(value = "查询机构底下部门", notes = "查询机构底下部门")
    public ListEnvelop findDeptByHospital(@ApiParam(name = "orgCode", value = "机构code")
                                          @RequestParam(value = "orgCode", required = true)String orgCode) {
        return success(prescriptionService.findDeptByHospital(orgCode));
                                          @RequestParam(value = "orgCode", required = true)String orgCode,
                                          @ApiParam(name = "dept", value = "需要置顶部门")
                                          @RequestParam(value = "dept", required = true)String dept) {
        return success(prescriptionService.findDeptByHospital(orgCode,dept));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByHospitalAndDept)
@ -190,8 +192,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    public ListEnvelop findDoctorByHospitalAndDept(@ApiParam(name = "orgCode", value = "机构code")
                                                   @RequestParam(value = "orgCode", required = true)String orgCode,
                                                   @ApiParam(name = "dept", value = "部门code")
                                                   @RequestParam(value = "dept", required = true)String dept) {
        return success(prescriptionService.findDoctorByHospitalAndDept(orgCode,dept));
                                                   @RequestParam(value = "dept", required = true)String dept,
                                                   @ApiParam(name = "chargeType", value = "号别")
                                                   @RequestParam(value = "chargeType", required = false)String chargeType,
                                                   @ApiParam(name = "doctorCode", value = "需要置顶医生")
                                                   @RequestParam(value = "doctorCode", required = true)String doctorCode) {
        return success(prescriptionService.findDoctorByHospitalAndDept(orgCode,dept,chargeType,doctorCode));
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.appointmentRevisit)
@ -199,8 +205,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    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)throws Exception {
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.appointmentRevisit(outpatientJson,expressageJson));
                                         @RequestParam(value = "expressageJson", required = false)String expressageJson,
                                         @ApiParam(name = "registerJson", value = "预约时间")
                                         @RequestParam(value = "registerJson", required = false)String registerJson)throws Exception {
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getICD10)
@ -300,6 +308,45 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        OutputStream os = response.getOutputStream();
        prescriptionService.pushListWrite(os,list);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByDeptTypeCode)
    @ApiOperation(value = "就诊费用查询", notes = "就诊费用查询")
    public ListEnvelop findByDeptTypeCode(@ApiParam(name = "deptTypeCode", value = "6总部7金榜8夏禾")
                                @RequestParam(value = "deptTypeCode", required = false)String deptTypeCode) throws Exception{
        return success(prescriptionService.findByDeptTypeCode(deptTypeCode));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getCardInfo)
    @ApiOperation(value = "获取卡信息", notes = "获取卡信息")
    public ObjEnvelop getCardInfo(@ApiParam(name = "cardNo", value = "卡号")
                                  @RequestParam(value = "cardNo", required = false)String cardNo) throws Exception {
        return success(prescriptionService.getCardInfo(cardNo,demoFlag));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorWithWork)
    @ApiOperation(value = "查询医生带排班", notes = "查询医生带排班")
    public ObjEnvelop findDoctorWithWork(@ApiParam(name = "orgCode", value = "机构code")
                                         @RequestParam(value = "orgCode", required = true)String orgCode,
                                         @ApiParam(name = "dept", value = "部门code")
                                         @RequestParam(value = "dept", required = true)String dept,
                                         @ApiParam(name = "doctorCode", value = "需要置顶医生code")
                                         @RequestParam(value = "doctorCode", required = false)String doctorCode,
                                         @ApiParam(name = "chargeType", value = "号别")
                                         @RequestParam(value = "chargeType", required = false)String chargeType,
                                         @ApiParam(name = "page", value = "第几页")
                                         @RequestParam(value = "page", required = true)Integer page,
                                         @ApiParam(name = "size", value = "每页大小")
                                         @RequestParam(value = "size", required = true)Integer size) {
        return success(prescriptionService.findDoctorWithWork(orgCode,dept,chargeType,doctorCode,page,size));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findWorkTimeInfo)
    @ApiOperation(value = "获取具体号源", notes = "获取具体号源")
    public ListEnvelop findWorkTimeInfo(@ApiParam(name = "id", value = "排班id")
                                        @RequestParam(value = "id", required = false)String id) {
        return success(prescriptionService.findWorkTimeInfo(id));
    }
    //===========

+ 2 - 35
svr/svr-iot/pom.xml

@ -11,7 +11,7 @@
    </parent>
    <groupId>com.yihu.iot</groupId>
    <artifactId>svr-iot</artifactId>
    <artifactId>svr-iot-third</artifactId>
    <version>${parent.version}</version>
    <packaging>war</packaging>
@ -42,23 +42,6 @@
        </dependency>
        <!-- 支持Tomcat启动 -->
        <!--<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
@ -116,30 +99,15 @@
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <!--<dependency>
            <groupId>com.yihu.base</groupId>
            <artifactId>common-log</artifactId>
        </dependency>-->
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>fastdfs-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>elasticsearch-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <!--<dependency>
            <groupId>com.yihu</groupId>
            <artifactId>common-data-es-starter</artifactId>
            <version>1.1.2</version>
        </dependency>-->
    </dependencies>
    <build>
        <finalName>svr-iot</finalName>
        <finalName>svr-iot-third</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
@ -154,5 +122,4 @@
            </plugin>
        </plugins>
    </build>
</project>

+ 24 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/analyzer/IotAnalyzerController.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.iot.datainput.service.DataInputService;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.service.analyzer.IotAnalyzerService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.util.date.DateUtil;
@ -37,12 +38,15 @@ public class IotAnalyzerController extends EnvelopRestEndpoint {
    @Autowired
    ObjectMapper objectMapper;
    @Autowired
    private IotAnalyzerService iotAnalyzerService;
    /**
     * 基于奕拓小屋上传的体征数据,进行解析入库
     * 基于奕拓小屋上传的体征数据,进行解析入库  V1.0 版本
     * @param jsonData
     * @return
     */
    @PostMapping(value = "/yitouxiaowu" ,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = "/yitouxiaowuBK" ,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "奕拓体征数据解析入库", notes = "奕拓体征数据解析入库")
    public String updateDeviceDataTest(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
@ -725,6 +729,24 @@ public class IotAnalyzerController extends EnvelopRestEndpoint {
    }
    /**
     * 基于奕拓小屋上传的体征数据,进行解析入库  V2.0 版本
     * @param jsonData
     * @return
     */
    @PostMapping(value = "/yitouxiaowu" ,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "奕拓体征数据解析入库", notes = "奕拓体征数据解析入库")
    public Envelop updateDeviceData(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData)throws Exception {
        boolean res = iotAnalyzerService.analyzerMapM(jsonData);
        if(res){
            return success("体征数据上传成功");
        }else {
            return failed("体征数据上传失败");
        }
    }
}

+ 132 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/IotAnalyzerService.java

@ -0,0 +1,132 @@
package com.yihu.iot.service.analyzer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.mysql.query.BaseJpaService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
/**
 * @author cws on 2019/6/16
 */
@Service
public class IotAnalyzerService extends BaseJpaService<WlyyIotD, WlyyIotDDao> {
    private Logger logger = LoggerFactory.getLogger(IotAnalyzerService.class);
    @Autowired
    private WlyyIotDDao wlyyIotDDao;
    @Autowired
    private WlyyIotMDao wlyyIotMDao;
    @Autowired
    ObjectMapper objectMapper;
    /**
     * 针对上传的体数据进行基础数据的解析,进行主表数据的存储
     * @param jsonData
     * @return
     * @throws Exception
     */
    public boolean analyzerMapM(String jsonData)throws Exception{
        WlyyIotM wlyyIotM = new WlyyIotM();
        boolean addFlag = false;
        String mid = "";
        //1-0 JSON 数据解析成 map 对象
        Map<String, Object> dataDetail = objectMapper.readValue(jsonData, HashMap.class);
        // 1-1 存储体征数据的基本信息
        LinkedHashMap memberMap = (LinkedHashMap)dataDetail.get("Member");
        wlyyIotM.setSn(dataDetail.get("MachineId") == null? "":dataDetail.get("MachineId").toString());
        wlyyIotM.setUnitNo(dataDetail.get("UnitNo") == null? "":dataDetail.get("UnitNo").toString());
        wlyyIotM.setUnitName(dataDetail.get("UnitName") == null? "":dataDetail.get("UnitName").toString());
        wlyyIotM.setDoctorId(dataDetail.get("DoctorId") == null? "":dataDetail.get("DoctorId").toString());
        wlyyIotM.setDoctorName(dataDetail.get("DoctorName") == null? "":dataDetail.get("DoctorName").toString());
        wlyyIotM.setRecordNo(dataDetail.get("RecordNo") == null? "":dataDetail.get("RecordNo").toString());
        wlyyIotM.setMeasureTime(dataDetail.get("MeasureTime") == null? "":dataDetail.get("MeasureTime").toString());
        wlyyIotM.setDeviceName("弈拓健康小屋测量仪");
        wlyyIotM.setDeviceModel(dataDetail.get("DeviceType") == null? "":dataDetail.get("DeviceType").toString());
        wlyyIotM.setMacAddr(dataDetail.get("MacAddr") == null? "":dataDetail.get("MacAddr").toString());
        wlyyIotM.setIdCardNo(memberMap.get("IdCode")==null?"":memberMap.get("IdCode").toString());
        wlyyIotM.setUserName(memberMap.get("Name")==null?"":memberMap.get("Name").toString());
        WlyyIotM wlyyIotMS =  wlyyIotMDao.save(wlyyIotM);
        if(wlyyIotMS != null){
            // 主表存储成功后,返回主表ID,用于细表存储关联用
            mid = wlyyIotMS.getId().toString();
        }
        for (Map.Entry entry : dataDetail.entrySet()) {
            String code = entry.getKey().toString();
            if("Member".equals(code) || "Member".equals(code) ){
                continue;
            }
            if("Height".equals(code) || "Fat".equals(code)|| "MinFat".equals(code)|| "BloodPressure".equals(code)|| "Bo".equals(code)
                    || "Ecg".equals(code)|| "PEEcg".equals(code)|| "Temperature".equals(code)|| "Whr".equals(code)|| "BloodSugar".equals(code)
                    || "Ua".equals(code)|| "Chol".equals(code)|| "BloodFat".equals(code)|| "Cardiovascular".equals(code)|| "BMD".equals(code)
                    || "Alcohol".equals(code)|| "Lung".equals(code)|| "Hb".equals(code)|| "Urinalysis".equals(code)){
                LinkedHashMap valueMap = (LinkedHashMap)entry.getValue();
                analyzerMapD(valueMap,mid,code);
            }
        }
        return true;
    }
    /**
     * 单项细表数据存储,因为体征数据上传,不管怎么样都返回成功,若数据未上传则直接查看LOG日志
     * @param mapInfo
     * @param mid
     * @param type
     * @return
     * @throws Exception
     */
    public boolean analyzerMapD(Map<String,Object> mapInfo, String mid,String type)throws Exception{
        boolean addFlag = false;
        for (Map.Entry<String, Object> entry : mapInfo.entrySet()) {
            String code = entry.getKey().toString();
            String value = entry.getValue() == null?"":entry.getValue().toString();
            // 当数值为空时,不进行存储操作
            if("".equals(value) || "0".equals(value) || "null".equals(value) ){
                continue;
            }else {
                WlyyIotD wlyyIotD = new WlyyIotD();
                wlyyIotD.setMid(mid);
                wlyyIotD.setType(type);
                wlyyIotD.setCode(code);
                wlyyIotD.setValue(value);
                wlyyIotD = addIotRecord(wlyyIotD);
                if(wlyyIotD != null){
                    logger.info( "体征数据新增成功:id = " + wlyyIotD.getId() + " ; type = " + type +" ; code = " + code +"; value = " +  value);
                    continue;
                }else {
                    logger.error( "体征数据新增成功:mid = " + mid + " ; type = " + type +" ; code = " + code +"; value = " +  value);
                    continue;
                }
            }
        }
        return true;
    }
    /**
     * 单条记录的存储,用于遍历循环操作
     * @param wlyyIotD
     * @return
     */
    public WlyyIotD addIotRecord(WlyyIotD wlyyIotD){
        WlyyIotD wlyyIotDRes = wlyyIotDDao.save(wlyyIotD);
        if(wlyyIotDRes != null){
            return wlyyIotDRes;
        }else{
            return null;
        }
    }
}

+ 79 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/WlyyIotD.java

@ -0,0 +1,79 @@
package com.yihu.iot.service.analyzer;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
@Entity
@Table(name = "wlyy_iot_d")
public class WlyyIotD extends UuidIdentityEntity implements Serializable {
    @Column(name = "mid")
    private String mid;
    @Column(name = "type")
    private String type;
    @Column(name = "code")
    private String code;
    @Column(name = "name")
    private String name;
    @Column(name = "value")
    private String value;
    @Column(name = "unit")
    private String unit;
    public String getMid() {
        return mid;
    }
    public void setMid(String mid) {
        this.mid = mid;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getUnit() {
        return unit;
    }
    public void setUnit(String unit) {
        this.unit = unit;
    }
}

+ 14 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/WlyyIotDDao.java

@ -0,0 +1,14 @@
package com.yihu.iot.service.analyzer;
import com.yihu.jw.entity.base.dict.DictDiseaseDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
public interface WlyyIotDDao extends PagingAndSortingRepository<WlyyIotD, Integer>, JpaSpecificationExecutor<WlyyIotD>  {
}

+ 144 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/WlyyIotM.java

@ -0,0 +1,144 @@
package com.yihu.iot.service.analyzer;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
@Entity
@Table(name = "wlyy_iot_m")
public class WlyyIotM extends UuidIdentityEntity implements Serializable {
    @Column(name = "sn")
    private String sn;
    @Column(name = "device_name")
    private String deviceName;
    @Column(name = "device_model")
    private String deviceModel;
    @Column(name = "id_card_no")
    private String idCardNo;
    @Column(name = "user_name")
    private String userName;
    @Column(name = "unit_no")
    private String unitNo;
    @Column(name = "unit_name")
    private String unitName;
    @Column(name = "doctor_id")
    private String doctorId;
    @Column(name = "doctor_name")
    private String doctorName;
    @Column(name = "record_no")
    private String recordNo;
    @Column(name = "measure_time")
    private String measureTime;
    @Column(name = "mac_addr")
    private String macAddr;
    public String getSn() {
        return sn;
    }
    public void setSn(String sn) {
        this.sn = sn;
    }
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    public String getDeviceModel() {
        return deviceModel;
    }
    public void setDeviceModel(String deviceModel) {
        this.deviceModel = deviceModel;
    }
    public String getIdCardNo() {
        return idCardNo;
    }
    public void setIdCardNo(String idCardNo) {
        this.idCardNo = idCardNo;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    public String getUnitNo() {
        return unitNo;
    }
    public void setUnitNo(String unitNo) {
        this.unitNo = unitNo;
    }
    public String getUnitName() {
        return unitName;
    }
    public void setUnitName(String unitName) {
        this.unitName = unitName;
    }
    public String getDoctorId() {
        return doctorId;
    }
    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getRecordNo() {
        return recordNo;
    }
    public void setRecordNo(String recordNo) {
        this.recordNo = recordNo;
    }
    public String getMeasureTime() {
        return measureTime;
    }
    public void setMeasureTime(String measureTime) {
        this.measureTime = measureTime;
    }
    public String getMacAddr() {
        return macAddr;
    }
    public void setMacAddr(String macAddr) {
        this.macAddr = macAddr;
    }
}

+ 8 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/analyzer/WlyyIotMDao.java

@ -0,0 +1,8 @@
package com.yihu.iot.service.analyzer;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface WlyyIotMDao extends PagingAndSortingRepository<WlyyIotM, Integer>, JpaSpecificationExecutor<WlyyIotM>  {
}

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

@ -125,9 +125,9 @@ spring:
    password: jkzlehr@123
  elasticsearch:
    cluster-name: jkzl #默认即为elasticsearch  集群名
    cluster-nodes: 59.61.92.90:9208,59.61.92.90:9210 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    cluster-nodes: 59.61.92.90:9208, 59.61.92.90:9210 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    jest:
      uris: http://59.61.92.90:9208,http://59.61.92.90:9210
      uris: http://59.61.92.90:9208, http://59.61.92.90:9210
  wlyy:
    url: http://www.xmtyw.cn/wlyy/
#fast-dfs:

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

@ -1,16 +1,3 @@
spring:
  application:
    name: svr-iot  #注册到发现服务的id 如果id一样 eurika会自动做负载
  cloud:
    config:
      failFast: true
      username: jw
      password: jkzl
---
spring:
  profiles: jwdev
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.107:1221}
      label: ${wlyy.spring.config.label:jwdev}
    name: svr-iot-third  #注册到发现服务的id 如果id一样 eurika会自动做负载