Browse Source

复诊,协同门诊优化需求

huangwenjie 5 years ago
parent
commit
46d1c7eeb4

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

@ -1919,12 +1919,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    
    /**
     * 医生可接单列表(图文)
     * 医生可接单列表(图文复诊、视频复诊、协同门诊)
     * @param doctor
     * @param type
     * @param type 1:图文诊室,2:视频诊室(视频复诊、协同门诊)
     * @query_status 0:图文复诊候诊 1:图文复诊抢单列表
     * @return
     */
    public List<Map<String,Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type) {
    public List<Map<String,Object>> findWaitingRoomOutpatientByDoctor(String doctor, Integer type,Integer query_status) {
        
        String sql ="SELECT " +
                "room.outpatient_id AS id," +
@ -1948,14 +1949,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "room.patient_id=patient.id " +
                "AND room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 ";
        if(type == 2){
        //视频复诊,协同门诊 医生抢单
        if(type == 2 ){
            sql +=  "AND room.doctor IS NULL ";
        }else{
            sql +=  "AND (room.doctor IS NULL or room.doctor='"+doctor+"') ";
            //图文复诊候诊列表
            if(0 == query_status){
                sql +=  "AND room.doctor='"+doctor+"' ";
            }else{
                //图文复诊医生抢单列表
                sql +=  "AND room.doctor IS NULL  ";
            }
            
        }
        
        sql += "AND room.consult_type="+type;
        //协同门诊
        if(3 == type){
            sql += "AND room.reservation_type=2 ";
        }else{
            //在线复诊
            sql += "AND room.reservation_type=1 AND room.consult_type="+type ;
        }
        
        
        
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list!=null&&list.size()>0){
@ -2661,7 +2677,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "AND outpatient.status = 0 " +
                "AND room.doctor='"+doctor+"' " +
                "AND room.reservation_time is not null " +
                "AND room.consult_type= 2 ";
                "AND room.consult_type= 2 AND room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' order by room.reservation_time DESC ";
//                "AND room.reservation_time>='"+DateUtil.getStringDate("yyyy-MM-dd")+" 00:00:00"+"' ";
    
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
@ -2727,8 +2743,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outpatientCode);
        wlyyOutpatientDO.setDoctor(doctor);
        wlyyOutpatientDO.setDoctorName(baseDoctorDO.getName());
        
        
        outpatientDao.save(wlyyOutpatientDO);
    }
    
    /**
@ -3192,4 +3207,95 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs;
    }
    
    /**
     * 查询医生所有可抢单的数量
     * @param doctor
     * @return
     */
    public com.alibaba.fastjson.JSONObject findWaitingRoomOutpatientNumberByDoctor(String doctor) {
    
        com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
        
    
        //总数
        String sqlAll = "SELECT " +
                " COUNT(room.outpatient_id) AS total " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_outpatient outpatient " +
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL ";
    
        List<Map<String, Object>> alltotal = jdbcTemplate.queryForList(sqlAll);
    
        Long totalsqlAll = 0l;
        if (alltotal != null && alltotal.size() > 0) {
            totalsqlAll = (Long) alltotal.get(0).get("total");
        }
    
        object.put("all",totalsqlAll);
    
        //图文复诊
        String imgAll = "SELECT " +
                " COUNT(room.outpatient_id) AS total " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_outpatient outpatient " +
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=1 AND room.consult_type=1 ";
    
        List<Map<String, Object>> imgtotal = jdbcTemplate.queryForList(imgAll);
    
        Long twCount = 0l;
        if (imgtotal != null && imgtotal.size() > 0) {
            twCount = (Long) imgtotal.get(0).get("total");
        }
    
        object.put("twCount",twCount);
    
        //视频复诊
        String spsql = "SELECT " +
                " COUNT(room.outpatient_id) AS total " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_outpatient outpatient " +
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=1 AND room.consult_type=2 ";
    
        List<Map<String, Object>> sptotal = jdbcTemplate.queryForList(spsql);
    
        Long spcount = 0l;
        if (sptotal != null && sptotal.size() > 0) {
            spcount = (Long) sptotal.get(0).get("total");
        }
    
        object.put("spCount",spcount);
    
        
        //协同门诊
        String xtsql = "SELECT " +
                " COUNT(room.outpatient_id) AS total " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "wlyy_outpatient outpatient " +
                "WHERE " +
                " room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 AND room.doctor IS NULL AND room.reservation_type=2";
    
        List<Map<String, Object>> xttotal = jdbcTemplate.queryForList(xtsql);
    
        Long xtcount = 0l;
        if (xttotal != null && xttotal.size() > 0) {
            xtcount = (Long) xttotal.get(0).get("total");
        }
    
        object.put("xtCount",xtcount);
        
        
        return object;
    }
}

+ 27 - 4
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -1420,9 +1420,14 @@ public class ImService {
	 * @param status 咨询状态:0全部,1候诊中,2就诊中,3结束
	 * @param pagesize 分页大小
	 * @param title 标题关键字
	 * @param start_time 开始时间
	 * @param end_time 结束时间
	 * @return
	 */
	public List<ConsultVO>  findConsultRecordByDoctor(String doctor, String id,Integer type, Integer status,int page,int pagesize, String title) {
	public List<ConsultVO>  findConsultRecordByDoctor(String doctor, String id,
	                                                  Integer type, Integer status,
	                                                  int page,int pagesize,
	                                                  String title,String start_time,String end_time) {
		
		if(page >=1){
			page --;
@ -1460,9 +1465,17 @@ public class ImService {
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			sql +=" and a.title like '"+title+"'";
			
			
		}
		
		if(!StringUtils.isEmpty(start_time)){
			sql +=" and a.czrq >= '"+start_time+"'";
		}
		
		if(!StringUtils.isEmpty(end_time)){
			sql +=" and a.czrq <= '"+end_time+"'";
		}
		
		
		//咨询状态
		if(status != 0){
			
@ -1497,9 +1510,11 @@ public class ImService {
	 * @param status 咨询状态:0全部,1候诊中,2就诊中,3结束
	 * @param pagesize 分页大小
	 * @param title 标题关键字
	 * @param start_time 开始时间
	 * @param end_time 结束时间
	 * @return
	 */
	public Long countConsultRecordByDoctor(String doctor, String id,Integer type, Integer status,String title) {
	public Long countConsultRecordByDoctor(String doctor, String id,Integer type, Integer status,String title,String start_time,String end_time) {
		
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
@ -1516,6 +1531,14 @@ public class ImService {
			sql +=" and a.title like '"+title+"'";
		}
		
		if(!StringUtils.isEmpty(start_time)){
			sql +=" and a.czrq >= '"+start_time+"'";
		}
		
		if(!StringUtils.isEmpty(end_time)){
			sql +=" and a.czrq <= '"+end_time+"'";
		}
		
		//咨询状态
		if(status != 0){
			

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

@ -338,7 +338,7 @@ public class BaseHospitalRequestMapping {
        //添加复诊咨询
        public static final String addPrescriptionConsult ="/addPrescriptionConsult";
        
        //医生可接单列表(图文)
        //医生可接单列表(图文复诊、视频复诊、协同门诊)
        public static final String findWaitingRoomOutpatientByDoctor = "findWaitingRoomOutpatientByDoctor";
    
        //导诊台居民列表
@ -374,12 +374,17 @@ public class BaseHospitalRequestMapping {
        //修改医生咨询在线状态
        public static final String updateDoctorConsultStatus= "updateDoctorConsultStatus";
        
        //复诊图文咨询人数,视频咨询人数
        //复诊图文咨询人数,视频咨询人数、协同门诊人数,可抢单人数
        public static final String doctorIndexConsultCount="doctorIndexConsultCount";
    
        //测试发送处方消息
        public static final String testSendPrescriptionIM = "testSendPrescriptionIM";
        
        //全科医生等候协同门诊,排队数量
        public static final String generalDoctorWaitingNumber = "generalDoctorWaitingNumber";
    
        //查询医生所有可抢单的数量
        public static final String findWaitingRoomOutpatientNumberByDoctor = "findWaitingRoomOutpatientNumberByDoctor";
    }
    /**

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

@ -48,13 +48,15 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	
	
	@GetMapping (value = BaseHospitalRequestMapping.DodtorIM.findWaitingRoomOutpatientByDoctor)
	@ApiOperation(value = "医生可接单列表(图文)", notes = "医生可接单列表(图文)")
	@ApiOperation(value = "医生可接单列表(图文复诊、视频复诊、协同门诊)", notes = "医生可接单列表(图文复诊、视频复诊、协同门诊)")
	public ListEnvelop findPrescriptionConsultByDoctor(
			@ApiParam(name = "doctor", value = "医生CODE",defaultValue = "1cd15ffe6b3a11e69f7c005056850d66")
			@RequestParam(value = "doctor",required = true) String doctor,
			@ApiParam(name = "type", value = "图文复诊:1视频复诊:2")
			@RequestParam(value = "type",required = true) Integer type){
		return success("请求成功",prescriptionService.findWaitingRoomOutpatientByDoctor(doctor,type));
			@ApiParam(name = "type", value = "图文诊室:1、视频:2")
			@RequestParam(value = "type",required = true) Integer type,
			@ApiParam(name = "query_status", value = "0:图文复诊候诊 1:图文复诊抢单列表")
			@RequestParam(value = "",required = false) Integer query_status){
		return success("请求成功",prescriptionService.findWaitingRoomOutpatientByDoctor(doctor,type,query_status));
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.findWaitingRoomPatient)
@ -249,7 +251,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorIndexConsultCount)
	@ApiOperation(value = "复诊图文咨询人数,视频咨询人数", notes = "复诊图文咨询人数,视频咨询人数")
	@ApiOperation(value = "复诊图文咨询人数,视频咨询人数、协同门诊人数,可抢单人数", notes = "复诊图文咨询人数,视频咨询人数、协同门诊人数,可抢单人数")
	public Envelop doctorIndexConsultCount(@ApiParam(name = "doctor", value = "医生CODE")
	                                           @RequestParam(value = "doctor",required = true) String doctor){
		
@ -280,6 +282,11 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		result.put("videoCount",waitVideoCount+_videoOnlineCount);//视频复诊数量
		result.put("xtCount",0);//协同门诊候诊数量
		
		JSONObject resultPick = prescriptionService.findWaitingRoomOutpatientNumberByDoctor(doctor);
		result.put("imgPickCount",resultPick.getIntValue("twCount"));
		result.put("videoPickCount",resultPick.getIntValue("spCount"));
		result.put("xtPickCount",resultPick.getIntValue("xtCount"));
		
		
		return success("请求成功",result);
	}
@ -297,13 +304,17 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "type",required = true) Integer type,
			@ApiParam(name = "status", value = "咨询状态:0全部,1候诊中,2就诊中,3结束")
			@RequestParam(value = "status",required = true) Integer status,
			@ApiParam(name = "start_time", value = "开始时间 YYYY-MM-DD HH:MM:SS")
			@RequestParam(value = "start_time",required = false) String start_time,
			@ApiParam(name = "end_time", value = "结束时间 YYYY-MM-DD HH:MM:SS")
			@RequestParam(value = "end_time",required = false) String end_time,
			@ApiParam(name = "page", value = "第几页")
			@RequestParam(value = "page",required = false) int page,
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize
	)throws Exception{
		JSONArray array = new JSONArray();
		List<ConsultVO> data = imService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title);
		List<ConsultVO> data = imService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time);
		
		if (data != null) {
			for (ConsultVO consult : data) {
@ -351,7 +362,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			}
		}
		
		Long total = imService.countConsultRecordByDoctor(doctor, id,type,status,title);
		Long total = imService.countConsultRecordByDoctor(doctor, id,type,status,title,start_time,end_time);
		
		JSONObject result = new JSONObject();
		result.put("total",total);
@ -363,10 +374,27 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.testSendPrescriptionIM)
	@ApiOperation(value = "测试发送处方消息", notes = "测试发送处方消息")
	public Envelop testSendPrescriptionIM()throws Exception{
		imService.pushPrescriptionImMessage(null);
		return success("请求成功");
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.generalDoctorWaitingNumber)
	@ApiOperation(value = "全科医生等候协同门诊,排队数量", notes = "全科医生等候协同门诊,排队数量")
	public Envelop generalDoctorWaitingNumber(
			@ApiParam(name = "outpatientid", value = "就诊记录CODE")
			@RequestParam(value = "outpatientid",required = true) String outpatientid){
		JSONObject result = new JSONObject();
		result.put("waitingNumber",1);
		return success("请求成功",result);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.findWaitingRoomOutpatientNumberByDoctor)
	@ApiOperation(value = "查询医生所有可抢单的数量", notes = "查询医生所有可抢单的数量")
	public Envelop findWaitingRoomOutpatientNumberByDoctor(
			@ApiParam(name = "doctor", value = "医生CODE",defaultValue = "1cd15ffe6b3a11e69f7c005056850d66")
			@RequestParam(value = "doctor",required = true) String doctor){
		return success("请求成功",prescriptionService.findWaitingRoomOutpatientNumberByDoctor(doctor));
	}
	
	
}