瀏覽代碼

在线复诊

Trick 6 年之前
父節點
當前提交
d0bffd40b7
共有 14 個文件被更改,包括 605 次插入147 次删除
  1. 4 2
      business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java
  2. 6 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java
  3. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java
  4. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionExpressageDao.java
  5. 246 113
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  6. 99 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/consult/WlyyHospitalWaitingRoomDO.java
  7. 57 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  8. 7 19
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageDO.java
  9. 32 2
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  10. 40 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyOutpatientVO.java
  11. 7 6
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionExpressageVO.java
  12. 14 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionVO.java
  13. 73 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  14. 16 1
      svr/svr-internet-hospital/src/main/resources/application.yml

+ 4 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java

@ -55,8 +55,9 @@ public class PatientMappingService {
            patientMappingDao.save(mappingDO);
            return mappingCode;
        }else{
            throw new RuntimeException("获取his居民信息失败!");
        }
        return null;
    }
    public String findHisPatNoByPatient(String patient)throws Exception{
@ -85,7 +86,8 @@ public class PatientMappingService {
            patientMappingDao.save(mappingDO);
            return mappingCode;
        }else{
            throw new RuntimeException("获取his居民信息失败!");
        }
        return null;
    }
}

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

@ -2,10 +2,16 @@ package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/6/3.
 */
public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatientDO, String>, JpaSpecificationExecutor<WlyyOutpatientDO> {
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.status in(0,1)")
    List<WlyyOutpatientDO> findByPatientList(String patient);
}

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

@ -1,6 +1,7 @@
package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -14,4 +15,6 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    @Query("select a from WlyyPrescriptionDO a where a.patientCode = ?1 and a.status >= 0 ")
    List<WlyyPrescriptionDO> findByPatientCode(String patientCode);
    List<WlyyPrescriptionDO> findByOutpatientId(String outpatientId);
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionExpressageDao.java

@ -11,5 +11,5 @@ import java.util.List;
 */
public interface PrescriptionExpressageDao extends PagingAndSortingRepository<WlyyPrescriptionExpressageDO, String>, JpaSpecificationExecutor<WlyyPrescriptionExpressageDO> {
    List<WlyyPrescriptionExpressageDO> findByPrescriptionId(String prescriptionId);
    List<WlyyPrescriptionExpressageDO> findByOutpatientId(String outpatientId);
}

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

@ -1,5 +1,6 @@
package com.yihu.jw.hospital.prescription.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
@ -9,10 +10,7 @@ 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.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.consult.dao.DoctorClinicRoomConsultDao;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
@ -21,12 +19,16 @@ import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.org.dao.BaseOrgDao;
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.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 net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
@ -79,6 +81,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private PatientMappingService patientMappingService;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -97,6 +101,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return entranceService.BS30025(patNo,null,null,startTime,endTime,demoFlag);
    }
    /**
     * 查询单条门诊记录
     * @param patient
     * @param registerSn
     * @param admNo
     * @return
     */
    public WlyyOutpatientVO findOutpatientInfo(String patient,String registerSn,String admNo)throws Exception{
        String patNo =patientMappingService.findHisPatNoByPatient(patient);
        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo,admNo,registerSn,null,null,demoFlag);
        if(list!=null&&list.size()>0){
            return list.get(0);
        }
        return null;
    }
    /**
     * 原处方记录列表
     * @param registerSn
@ -130,7 +151,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    /**
     *
     * 获取复诊记录列表
     * @param patient
     * @param status
     * @param page
@ -143,8 +164,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " FROM " +
                " wlyy_outpatient o " +
                " WHERE " +
                " o.patient = '"+patient+"'" +
                " o.status = "+status;
                " o.patient = '"+patient+"'";
        if(status!=null){
            totalSql +=  " AND o.status = "+status;
        }
        if(StringUtils.isNotBlank(startTime)){
            totalSql += " AND create_time >='"+startTime+" 00:00:00'";
        }
@ -169,6 +192,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.doctor AS doctor, " +
                " o.doctor_name AS doctorName, " +
                " o.idcard AS idcard, " +
                " o.card_no AS cardNo," +
                " o.mjz AS mjz, " +
                " o.icd10 AS icd10, " +
                " o.icd10_name AS icd10Name, " +
@ -181,13 +205,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " FROM " +
                " wlyy_outpatient o " +
                " WHERE " +
                " o.patient = '"+patient+"'" +
                " o.status = "+status;
                " o.patient = '"+patient+"'";
        if(status!=null){
            sql +=  " AND o.status = "+status;
        }
        if(StringUtils.isNotBlank(startTime)){
            totalSql += " AND create_time >='"+startTime+" 00:00:00'";
            sql += " AND create_time >='"+startTime+" 00:00:00'";
        }
        if(StringUtils.isNotBlank(endTime)){
            totalSql += " AND create_time <='"+endTime+" 23:59:59'";
            sql += " AND create_time <='"+endTime+" 23:59:59'";
        }
        sql += " LIMIT " + (page - 1) * size + "," + size + "";
        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class));
@ -195,6 +221,57 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
    /**
     * 获取单条复诊记录信息
     * @param outpatientId
     * @return
     */
    public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId){
        com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
        //复诊信息
        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId);
        rs.put("outpatient",convertToModel(outpatientDO,WlyyOutpatientVO.class));
        //居民详情
        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
        rs.put("patientName",basePatientDO.getName());
        rs.put("patientId",basePatientDO.getId());
        rs.put("idCard",basePatientDO.getIdcard());
        rs.put("sex", basePatientDO.getSex());
        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),outpatientDO.getPatient(),"1");
        rs.put("ssc",cardDO);
        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
        //获取处方信息
        List<WlyyPrescriptionDO> prescriptionDOs = prescriptionDao.findByOutpatientId(outpatientId);
        List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>();
        if(prescriptionDOs!=null&&prescriptionDOs.size()>0){
            convertToModels(prescriptionDOs,prescriptionVOs,WlyyPrescriptionVO.class);
            for(WlyyPrescriptionVO vo:prescriptionVOs){
                //疾病信息
                vo.setDiagnosisVOs(findDiagnosisById(vo.getId()));
                //药品信息
                List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>();
                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()),infoVOs,WlyyPrescriptionInfoVO.class));
            }
        }
        rs.put("prescriptions",prescriptionVOs);
        //物流信息
        List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByOutpatientId(outpatientId);
        if(expressageDOs!=null&&expressageDOs.size()>0){
            rs.put("expressage",convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class));
        }else{
            rs.put("expressage",null);
        }
        return rs;
    }
    /**
     * 查询历史
     * @param patient
@ -329,14 +406,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("ssc",cardDO);
        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
        //物流信息
        List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByPrescriptionId(wlyyPrescriptionDO.getId());
        if(expressageDOs!=null&&expressageDOs.size()>0){
            rs.put("expressage",convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class));
        }else{
            rs.put("expressage",null);
        }
        //诊断信息
        rs.put("diagnosis",findDiagnosisById(wlyyPrescriptionDO.getId()));
@ -354,119 +423,112 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return true;
    }
    /**
     * 预约
     * @param json
     * @return
     */
    public Boolean appointmentRevisit(JSONObject json)throws Exception{
        //1.创建支付
        //2.支付回调
        paymentCallback(json);
        return true;
    }
    /**
     *
     * @param json
     * 发起图文和视频复诊
     * @param outpatientJson
     * @param expressageJson
     * @return
     * @throws Exception
     */
    public String paymentCallback(JSONObject json)throws Exception{
        //创建续方
        createPrescription(json);
        //创建诊室
        createRoom(json);
        return null;
    }
    public Boolean createPrescription(JSONObject json) throws Exception{
    public Boolean appointmentRevisit(String outpatientJson,String expressageJson)throws Exception{
        String patient = json.getString("patient");
        String doctor = json.getString("doctor");
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class);
        outpatientDO.setStatus("0");
        outpatientDO.setCreateTime(new Date());
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        String originRealOrder = json.getString("originRealOrder");
        String originAdmNo = json.getString("originAdmNo");
        String serialNo = json.getString("serialNo");
        //2.物流信息
        BasePatientDO patientDO = basePatientDao.findById(outpatient.getPatient());
        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson,WlyyPrescriptionExpressageDO.class);
        expressageDO.setDel(1);
        expressageDO.setCreateTime(new Date());
        prescriptionExpressageDao.save(expressageDO);
        //3.创建候诊室
        createRoom(outpatient);
        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 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;
//    }
    public Boolean createRoom(JSONObject json){
        String patient = json.getString("patient");
        String doctor = json.getString("doctor");
        String dept = json.getString("dept");
        String hospital = json.getString("hospital");
        String reservationTime = json.getString("reservationTime");
        Integer consultType = json.getInt("consultType");
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findOne(doctor);
        List<WlyyDoctorClinicRoomDO> list = doctorClinicRoomConsultDao.findByDoctorAndStatus(doctor,1);
        if(list!=null&&list.size()>0){
            //已经有诊室不做操作
        }else{
            //未有诊室则新增
            WlyyDoctorClinicRoomDO room = new WlyyDoctorClinicRoomDO();
            room.setDoctor(doctor);
            room.setDoctorName(baseDoctorDO.getName());
            room.setClinicName(baseDoctorDO.getName());
            DictHospitalDeptDO deptDO = dictHospitalDeptDao.findByCode(dept);
            room.setDept(dept);
            room.setDept(deptDO.getName());
            BaseOrgDO baseOrgDO = baseOrgDao.findByCode(hospital);
            room.setDept(hospital);
            room.setDept(baseOrgDO.getName());
            room.setClinicStatus(-1);
            room.setDate(new Date());
            room.setStatus(1);
            doctorClinicRoomConsultDao.save(room);
        }
    /**
     * 创建候诊室
     * @param outpatientDO
     * @return
     */
    public Boolean createRoom(WlyyOutpatientDO outpatientDO){
        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO();
        waitingRoom.setConsultType(1);
        waitingRoom.setPatientId(patient);
        waitingRoom.setPatientName(basePatientDO.getName());
        waitingRoom.setReservationTime(DateUtil.strToDate(reservationTime));
        waitingRoom.setPatientId(outpatientDO.getPatient());
        waitingRoom.setPatientName(outpatientDO.getPatientName());
        waitingRoom.setReservationTime(outpatientDO.getAdmDate());
        waitingRoom.setVisitStatus(0);
        waitingRoom.setReservationType(1);
        waitingRoom.setSort(0);
        waitingRoom.setConsultType(consultType);
        waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType()));
        if(StringUtils.isNotBlank(outpatientDO.getDoctor())){
            waitingRoom.setDoctor(outpatientDO.getDoctor());
            waitingRoom.setDoctor(outpatientDO.getDoctorName());
        }
        waitingRoom.setOutpatientId(outpatientDO.getId());
        waitingRoom.setCreateTime(new Date());
        HospitalWaitingRoomDao.save(waitingRoom);
        return true;
@ -492,5 +554,76 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return true;
    }
    /**
     * 获取卡记录
     * @param patient
     * @return
     * @throws Exception
     */
    public JSONArray findPatientCard(String patient)throws Exception{
        return entranceService.BS15018(null,patient,demoFlag);
    }
    public JSONObject checkOutpatient(String patient){
        //-1卡余额不足,,-2 存在未结束的诊断热 1成功
        JSONObject rs = new JSONObject();
        //1.判断钱是否够
        //2.判断是否有未结束的
        List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient);
        if(list!=null&&list.size()>0){
            rs.put("code",-2);
            rs.put("mes","存在未结束的诊断");
            return rs;
        }
        rs.put("code",1);
        rs.put("mes","验证通过");
        return rs;
    }
    /**
     * 获取所有医院列表
     * @return
     */
    public List<BaseOrgVO> findAllHospital(){
        List<BaseOrgDO> list = baseOrgDao.findByDel("1");
        List<BaseOrgVO> rs = new ArrayList<>();
        return convertToModels(list,rs,BaseOrgVO.class);
    }
    /**
     * 获取机构下部门信息
     * @param orgCode
     * @return
     */
    public List<DictHospitalDeptVO> findDeptByHospital(String orgCode){
        List<DictHospitalDeptDO> list =  dictHospitalDeptDao.findByOrgCodeIn(orgCode);
        List<DictHospitalDeptVO> rs = new ArrayList<>();
        return convertToModels(list,rs,DictHospitalDeptVO.class);
    }
    /**
     * 获取医生列表
     * @param orgCode
     * @param dept
     * @return
     */
    public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept){
        String sql ="SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +
                " h.doctor_duty_code, " +
                " h.doctor_duty_name " +
                " 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+"'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
}

+ 99 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/consult/WlyyHospitalWaitingRoomDO.java

@ -39,6 +39,36 @@ public class WlyyHospitalWaitingRoomDO extends UuidIdentityEntity {
	 */
	private String patientName;
    /**
     * 医院code
     */
    private String hospital;
    /**
     * 医院名称
     */
    private String hospitalName;
    /**
     * 部门
     */
    private String dept;
    /**
     * 部门名称
     */
    private String deptName;
    /**
     * 医生
     */
    private String doctor;
    /**
     * 医生名称
     */
    private String doctorName;
    /**
	 * 0离线 1在线(候诊) 2已诊
	 */
@ -70,6 +100,12 @@ public class WlyyHospitalWaitingRoomDO extends UuidIdentityEntity {
	 */
	private String outpatientId;
    /**
     *  创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;
	@Column(name = "saas_id")
    public String getSaasId() {
@ -151,4 +187,67 @@ public class WlyyHospitalWaitingRoomDO extends UuidIdentityEntity {
	public void setOutpatientId(String outpatientId) {
		this.outpatientId = outpatientId;
	}
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "dept")
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    @Column(name = "dept_name")
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 57 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -39,6 +39,21 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
	 */
	private String originRegisterNo;
    /**
     * 1.图文 2.视频
     */
    private String type;
    /**
     * 医院编码
     */
    private String hospital;
    /**
     * 医院名称
     */
    private String hospitalName;
    /**
	 * 部门
	 */
@ -74,6 +89,11 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
	 */
	private String idcard;
    /**
     * 就诊卡
     */
    private String cardNo;
    /**
	 * 门急诊标记(MZ门诊,JZ急诊)
	 */
@ -153,7 +173,34 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
        this.originRegisterNo = originRegisterNo;
    }
	@Column(name = "dept")
    @Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "dept")
    public String getDept() {
        return dept;
    }
@ -283,4 +330,13 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setDiseaseImg(String diseaseImg) {
        this.diseaseImg = diseaseImg;
    }
    @Column(name="card_no")
    public String getCardNo() {
        return cardNo;
    }
    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }
}

+ 7 - 19
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageDO.java

@ -19,15 +19,11 @@ import java.util.Date;
@Table(name = "wlyy_prescription_expressage")
public class WlyyPrescriptionExpressageDO extends UuidIdentityEntity {
    /**
	 * 
	 */
	private String saasId;
    /**
	 * 关联wlyy_wlyy_prescription id
	 * 门诊记录ID
	 */
	private String prescriptionId;
	private String outpatientId;
    /**
	 * 快递单号
@ -142,21 +138,13 @@ public class WlyyPrescriptionExpressageDO extends UuidIdentityEntity {
	private Integer del;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    @Column(name = "outpatient_id")
    public String getOutpatientId() {
        return outpatientId;
    }
	@Column(name = "prescription_id")
    public String getPrescriptionId() {
        return prescriptionId;
    }
    public void setPrescriptionId(String prescriptionId) {
        this.prescriptionId = prescriptionId;
    public void setOutpatientId(String outpatientId) {
        this.outpatientId = outpatientId;
    }
	@Column(name = "mailno")

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

@ -26,6 +26,7 @@ public class BaseHospitalRequestMapping {
        public static final String PREFIX  = "/prescription";
        //=====================start=======================================
        /**
         * 获取门诊记录
         */
@ -35,11 +36,42 @@ public class BaseHospitalRequestMapping {
         * 查询单条门诊记录接口
         */
        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";
        //=================end=======================================
        /**
         * 原处方记录
         */
@ -67,8 +99,6 @@ public class BaseHospitalRequestMapping {
         * 获取医生及号员信息
         */
        public static final String findDoctorList = "/findDoctorList";
        //支付+预约
        public static final String appointmentRevisit = "/appointmentRevisit";
        /**
         * 进入候诊室

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

@ -47,6 +47,18 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
	@ApiModelProperty(value = "原始挂号流水号", example = "模块1")
    private String originRegisterNo;
    /**
     * 医院编码
     */
    @ApiModelProperty(value = "医院编码", example = "模块1")
    private String hospital;
    /**
     * 医院名称
     */
    @ApiModelProperty(value = "医院名称", example = "模块1")
    private String hospitalName;
    /**
	 * 部门
	 */
@ -89,6 +101,9 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
	@ApiModelProperty(value = "身份证号", example = "模块1")
    private String idcard;
    @ApiModelProperty(value = "就诊卡", example = "模块1")
    private String cardNo;
    /**
	 * 门急诊标记(MZ门诊,JZ急诊)
	 */
@ -136,6 +151,7 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @ApiModelProperty(value = "创建时间", example = "模块1")
    private Date createTime;
@ -174,6 +190,22 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
        this.originRegisterNo = originRegisterNo;
    }
    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;
    }
@ -288,4 +320,12 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    public void setDiseaseImg(String diseaseImg) {
        this.diseaseImg = diseaseImg;
    }
    public String getCardNo() {
        return cardNo;
    }
    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }
}

+ 7 - 6
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionExpressageVO.java

@ -31,8 +31,8 @@ public class WlyyPrescriptionExpressageVO extends UuidIdentityVOWithOperator {
    /**
	 * 关联wlyy_wlyy_prescription id
	 */
	@ApiModelProperty(value = "关联wlyy_wlyy_prescription id", example = "模块1")
    private String prescriptionId;
	@ApiModelProperty(value = "关联门诊记录", example = "模块1")
    private String outpatientId;
    /**
	 * 快递单号
@ -305,11 +305,12 @@ public class WlyyPrescriptionExpressageVO extends UuidIdentityVOWithOperator {
        this.saasId = saasId;
    }
    public String getPrescriptionId() {
        return prescriptionId;
    public String getOutpatientId() {
        return outpatientId;
    }
    public void setPrescriptionId(String prescriptionId) {
        this.prescriptionId = prescriptionId;
    public void setOutpatientId(String outpatientId) {
        this.outpatientId = outpatientId;
    }
    public String getMailno() {

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

@ -85,6 +85,9 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "居民身份证号", example = "模块1")
    private String idcard;
    @ApiModelProperty(value = "居民就诊卡", example = "模块1")
    private String cardNo;
    /**
     * 社保卡号
     */
@ -298,6 +301,9 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "关联药品实体", example = "模块1")
    List<WlyyPrescriptionInfoVO> infoVOs;
    @ApiModelProperty(value = "关联物流实体", example = "模块1")
    WlyyPrescriptionExpressageVO expressage;
    public String getOutpatientId() {
        return outpatientId;
    }
@ -631,4 +637,12 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    public void setDiseaseImg(String diseaseImg) {
        this.diseaseImg = diseaseImg;
    }
    public WlyyPrescriptionExpressageVO getExpressage() {
        return expressage;
    }
    public void setExpressage(WlyyPrescriptionExpressageVO expressage) {
        this.expressage = expressage;
    }
}

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

@ -1,6 +1,8 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -12,6 +14,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
@ -37,7 +40,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private boolean demoFlag;
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientList)
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录 V1.00")
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录")
    public ListEnvelop findOutpatientList(@ApiParam(name = "patient", value = "居民id")
                               @RequestParam(value = "patient",required = false) String patient,
                               @ApiParam(name = "startTime", value = "开始时间")
@ -48,6 +51,18 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(vos);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientInfo)
    @ApiOperation(value = " 查询单条门诊就诊记录")
    public ObjEnvelop findOutpatientInfo(@ApiParam(name = "patient", value = "居民id")
                                         @RequestParam(value = "patient",required = false) String patient,
                                         @ApiParam(name = "registerSn", value = "流水号")
                                         @RequestParam(value = "registerSn",required = false) String registerSn,
                                         @ApiParam(name = "admNo", value = "就诊唯一号")
                                         @RequestParam(value = "admNo",required = false) String admNo)throws Exception{
        WlyyOutpatientVO obj = prescriptionService.findOutpatientInfo(patient,registerSn,admNo);
        return success(obj);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOriginPrescriptionList)
    @ApiOperation(value = "门诊下所有处方信息")
    public ListEnvelop findOriginPrescriptionList(
@ -112,7 +127,15 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return prescriptionService.findReOutpatientList(patient,status,startTime,endTime,page,size);
    }
        @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionInfo)
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findReOutpatientInfo)
    @ApiOperation(value = "查询复诊记录,处方,居民信息,物流(单条)", notes = "查询复诊记录,处方,居民信息,物流(单条)")
    public ObjEnvelop findReOutpatientInfo(@ApiParam(name = "outpatientId", value = "复诊ID")
                                           @RequestParam(value = "outpatientId", required = true) String outpatientId)throws Exception{
        com.alibaba.fastjson.JSONObject obj =  prescriptionService.findReOutpatientInfo(outpatientId);
        return success(obj);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionInfo)
    @ApiOperation(value = "获取所有居民相关信息,续方信息,物流信息,药品信息(单条)", notes = "获取所有居民相关信息,续方信息,物流信息,药品信息(单条)")
    public ObjEnvelop<Map<String,Object>> findPrescriptionInfo(@ApiParam(name = "prescriptionId", value = "续方明细")
                                                               @RequestParam(value = "prescriptionId", required = false) String prescriptionId) {
@ -135,6 +158,54 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.cancelPrescription(prescriptionId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientCard)
    @ApiOperation(value = "查询患者就诊卡", notes = "查询患者就诊卡")
    public ListEnvelop findPatientCard(@ApiParam(name = "patient", value = "续方明细")
                                       @RequestParam(value = "patient", required = true)String patient)throws Exception {
        return success(prescriptionService.findPatientCard(patient));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkOutpatient)
    @ApiOperation(value = "判断是否可用发起门诊", notes = "判断是否可用发起门诊")
    public ObjEnvelop checkOutpatient(@ApiParam(name = "patient", value = "续方明细")
                                      @RequestParam(value = "patient", required = true)String patient){
        return success(prescriptionService.checkOutpatient(patient));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findAllHospital)
    @ApiOperation(value = "查询所有机构", notes = "查询所有机构")
    public ListEnvelop findAllHospital() {
        return success(prescriptionService.findAllHospital());
    }
    @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));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByHospital)
    @ApiOperation(value = "查询机构底下部门", notes = "查询机构底下部门")
    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));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.appointmentRevisit)
    @ApiOperation(value = "居民发起复诊", notes = "居民发起复诊")
    public ObjEnvelop appointmentRevisit(@ApiParam(name = "outpatientJson", value = "居民门诊json")
                                         @RequestParam(value = "outpatientJson", required = false)String outpatientJson,
                                         @ApiParam(name = "outpatientJson", value = "居民物流json")
                                         @RequestParam(value = "outpatientJson", required = false)String expressageJson)throws Exception {
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.appointmentRevisit(outpatientJson,expressageJson));
    }
    //===========

+ 16 - 1
svr/svr-internet-hospital/src/main/resources/application.yml

@ -116,6 +116,11 @@ sms:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
hospital:
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
---
spring:
  profiles: jwtest
@ -153,6 +158,11 @@ myFamily:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
hospital:
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
---
spring:
  profiles: prod
@ -186,4 +196,9 @@ myFamily:
  qrCodeFailurTime: 2
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
  flag: false
hospital:
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01