Bladeren bron

医生首页数量问题修复

huangwenjie 5 jaren geleden
bovenliggende
commit
96b534dec8

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

@ -3285,11 +3285,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    
    /**
     * 复诊图文咨询人数,视频咨询人数, 专家咨询未完成
     * 复诊视频咨询人数, 协同门诊人数
     * @param doctor
     * @param outpatient_type 1复诊 2协同
     * @return
     */
    public Long doctorIndexConsultCount(String doctor) {
    public Long doctorIndexConsultCount(String doctor,String outpatient_type) {
    
    
        String sql ="SELECT " +
@ -3304,9 +3305,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "AND room.outpatient_id=outpatient.id " +
                "AND consult.relation_code=outpatient.id " +
                "AND consult.status = 0 " +
                "AND room.doctor='"+doctor+"' " +
                "AND room.consult_type= 2";
    
                "AND outpatient_type.doctor='"+outpatient_type+"'" +
                "AND room.doctor='"+doctor+"' ";
        if("1".equals(outpatient_type)){
            sql = sql + " AND room.consult_type= 2 ";
        }else if("2".equals(outpatient_type)){
        }else{}
        
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
    
        Long videoOnlineCount = 0l;
@ -3388,24 +3393,28 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    
    /**
     * 获取候诊居民数量
     * 根据类型获取候诊居民数量
     * @param doctor
     * @param outpatient_type 1复诊  2协同
     * @param type 1图文 2视频
     * @return
     */
    public Long getWaitVideoCount(String doctor) {
    public Long getWaitVideoCount(String doctor,String type,String outpatient_type) {
        String sql ="SELECT " +
                "count(room.outpatient_id) AS total " +
                "FROM " +
                "wlyy_hospital_waiting_room room," +
                "base_patient patient," +
                "wlyy_outpatient outpatient " +
                "wlyy_outpatient outpatient," +
                "base_patient patient " +
                "WHERE " +
                "room.patient_id=patient.id " +
                "AND room.outpatient_id=outpatient.id " +
                "AND outpatient.status = 0 " +
                "AND room.doctor='"+doctor+"' " +
                "AND room.reservation_time is not null AND  room.reservation_time >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' " +
                "AND room.consult_type= 2 ";
                "AND outpatient.status in (0,1) " +
                "AND outpatient.doctor='"+doctor+"' " +
                "AND outpatient.register_date is not null AND  room.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' " +
                "AND outpatient.outpatient_type= '"+outpatient_type+"' ";
        if("1".equals(outpatient_type)){
            sql =  sql + " AND outpatient.type= '"+type+"' ";
        }
    
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
    

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

@ -471,36 +471,38 @@ 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){
		
		//专家咨询
		Integer zjCount = imService.sessionCountByType(doctor,1,0);
		
		//复诊咨询
		Integer imgCount = imService.sessionCountByType(doctor,9,0);
		
		//正在进行中的视频复诊
		Long _videoOnlineCount = prescriptionService.doctorIndexConsultCount(doctor);
		Integer videoCount = _videoOnlineCount.intValue();
		
		//获取候诊居民数量(包含进行中的)
		Long _waitVideoCount = prescriptionService.getWaitVideoCount(doctor);
		Integer waitVideoCount = _waitVideoCount.intValue();
		
		JSONObject result = new JSONObject();
		result.put("zjCount",zjCount);
		
		imgCount = imgCount - videoCount;
		if(imgCount <=0){
			imgCount = 0;
		}
		
		result.put("zjCount",zjCount);//专家咨询数量
		result.put("imgCount",imgCount);//图文复诊数量
		result.put("videoCount",waitVideoCount+_videoOnlineCount);//视频复诊数量
		result.put("xtCount",0);//协同门诊候诊数量
//		//专家咨询
//		Integer zjCount = imService.sessionCountByType(doctor,1,0);
//
//		//复诊咨询
//		Integer imgCount = imService.sessionCountByType(doctor,9,0);
//
//		//正在进行中的视频复诊
//		Long _videoOnlineCount = prescriptionService.doctorIndexConsultCount(doctor);
//		Integer videoCount = _videoOnlineCount.intValue();
//
//		//获取候诊居民数量(包含进行中的)
//		Long _waitVideoCount = prescriptionService.getWaitVideoCount(doctor);
//		Integer waitVideoCount = _waitVideoCount.intValue();
//
//
//		result.put("zjCount",zjCount);
//
//		imgCount = imgCount - videoCount;
//		if(imgCount <=0){
//			imgCount = 0;
//		}
//
//		result.put("zjCount",zjCount);//专家咨询数量
//		result.put("imgCount",imgCount);//图文复诊数量
//		result.put("videoCount",waitVideoCount+_videoOnlineCount);//视频复诊数量
//		result.put("xtCount",0);//协同门诊候诊数量
		
//		JSONObject resultPick = prescriptionService.findWaitingRoomOutpatientNumberByDoctor(doctor);
//		result.put("imgPickCount",resultPick.getIntValue("twCount"));
@ -525,36 +527,14 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorReviewConsultCount)
	@ApiOperation(value = "医生端:图文复诊、视频复诊咨询数量", notes = "医生端:图文复诊、视频复诊咨询数量")
	@ApiOperation(value = "医生端:图文复诊、视频复诊咨询数量、协同门诊候诊数量", notes = "医生端:图文复诊、视频复诊咨询数量、协同门诊候诊数量")
	public Envelop doctorReviewConsultCount(@ApiParam(name = "doctor", value = "医生CODE")
	                                            @RequestParam(value = "doctor",required = true) String doctor){
		
		logger.info("action:doctorReviewConsultCount--start:"+DateUtil.dateToStrLong(new Date()));
		
		//复诊咨询
		Integer imgCount = imService.sessionCountByType(doctor,9,0);
		logger.info("action:doctorReviewConsultCount--imgCount:"+DateUtil.dateToStrLong(new Date()));
		
		//正在进行中的视频复诊
		Long _videoOnlineCount = prescriptionService.doctorIndexConsultCount(doctor);
		Integer videoCount = _videoOnlineCount.intValue();
		logger.info("action:doctorReviewConsultCount--videoCount:"+DateUtil.dateToStrLong(new Date()));
		
		//获取候诊居民数量(包含进行中的)
		Long _waitVideoCount = prescriptionService.getWaitVideoCount(doctor);
		
		logger.info("action:doctorReviewConsultCount--waitVideoCount:"+DateUtil.dateToStrLong(new Date()));
		Integer waitVideoCount = _waitVideoCount.intValue();
		
		JSONObject result = new JSONObject();
		
		imgCount = imgCount - videoCount;
		if(imgCount <=0){
			imgCount = 0;
		}
		result.put("imgCount",imgCount);//图文复诊数量
		result.put("videoCount",waitVideoCount+_videoOnlineCount);//视频复诊数量
		result.put("xtCount",0);//协同门诊候诊数量
		logger.info("action:doctorReviewConsultCount--start:"+DateUtil.dateToStrLong(new Date()));
		result.put("imgCount",prescriptionService.getWaitVideoCount(doctor,"1","1"));//图文复诊数量
		result.put("videoCount",prescriptionService.getWaitVideoCount(doctor,"2","1"));//视频复诊数量
		result.put("xtCount",prescriptionService.getWaitVideoCount(doctor,"","2"));//协同门诊候诊数量
		logger.info("action:doctorReviewConsultCount--end:"+DateUtil.dateToStrLong(new Date()));
		return success("请求成功",result);
	}