Browse Source

医生首页图文,视频复诊人数

huangwenjie 5 years ago
parent
commit
2e6aa9d60f

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

@ -17,4 +17,6 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    List<WlyyOutpatientDO> findByPatientList(String patient);
    List<WlyyOutpatientDO> findByDoctorAndStatus(String doctor,String status);
    
    List<WlyyOutpatientDO> findByDoctor(String doctor);
}

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

@ -7,6 +7,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
@ -117,6 +118,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private WlyyDoctorClinicRoomDao wlyyDoctorClinicRoomDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    
    @Value("${demo.flag}")
@ -1607,9 +1609,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
               rs.put("hospital",hospitalDOs.get(0));
               BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
               rs.put("winNo",org.getWinNo());
               rs.put("deptName",hospitalDOs.get(0).getDeptName());
            }else{
               rs.put("hospital",null);
               rs.put("winNo",null);
               rs.put("deptName",null);
            }
@ -2375,4 +2379,49 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            }
        }
    }
    
    /**
     * 复诊图文咨询人数,视频咨询人数, 专家咨询未完成
     * @param doctor
     * @return
     */
    public JSONObject doctorIndexConsultCount(String doctor) {
    
        //医生问诊量
        List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByDoctor(doctor);
        
        Integer imgCount = 0;
        
        Integer videoCount = 0;
        
        for(WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOs){
            //1.图文 2.视频
            if("1".equals(wlyyOutpatientDO.getType())){
                imgCount ++;
            }else if("2".equals(wlyyOutpatientDO.getType())){
                videoCount ++;
            }else{
                continue;
            }
        }
    
        String totalSql = "SELECT count(a.id) AS total " +
                "FROM wlyy_consult a,wlyy_consult_team b " +
                "WHERE a.id=b.consult AND b.doctor='"+doctor+"' AND a.type=1 AND b.`status`=0";
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
    
        Long zjCount = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            zjCount = (Long) rstotal.get(0).get("total");
        }
        
        JSONObject result = new JSONObject();
        result.put("imgCount",imgCount);
        result.put("videoCount",videoCount);
        result.put("zjCount",zjCount);
        
        return result;
        
    }
}

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

@ -995,25 +995,25 @@ public class ImService {
		String name = "";
		String returnJson = "";
		//推送给IM文字消息
//		if (endType == 1) {
//			BasePatientDO p = basePatientDao.findById(endOperator);
//			name = p.getName();
//			returnJson = imUtil.sendIM(consultTeam.getPatient(), consultTeam.getDoctor(), "7", name + "结束了本次咨询");
//		} else {
//			BaseDoctorDO d = baseDoctorDao.findById(endOperator);
//			name = d.getName();
//			returnJson = imUtil.sendIM(consultTeam.getDoctor(), consultTeam.getPatient(), "7", name + "结束了本次咨询");
//		}
		if (endType == 1) {
			BasePatientDO p = basePatientDao.findById(endOperator);
			name = p.getName();
			returnJson = imUtil.sendIM(consultTeam.getPatient(), consultTeam.getDoctor(), "7", name + "结束了本次咨询");
		} else {
			BaseDoctorDO d = baseDoctorDao.findById(endOperator);
			name = d.getName();
			returnJson = imUtil.sendIM(consultTeam.getDoctor(), consultTeam.getPatient(), "7", name + "结束了本次咨询");
		}
		
//		if (org.apache.commons.lang3.StringUtils.isEmpty(returnJson)) {
//			throw new RuntimeException("send consult finished IM message failed!");
////			throw new Exception("send consult finished IM message failed");
//		} else {
//			JSONObject jo = JSON.parseObject(returnJson);            //设置消息ID
//			consultTeam.setEndMsgId(jo.getInteger("startId") + "");
//			consultTeam.setEndOperator(endOperator);
//			consultTeam.setEndType(endType);
//		}
		if (org.apache.commons.lang3.StringUtils.isEmpty(returnJson)) {
			throw new RuntimeException("send consult finished IM message failed!");
//			throw new Exception("send consult finished IM message failed");
		} else {
			JSONObject jo = JSON.parseObject(returnJson);            //设置消息ID
			consultTeam.setEndMsgId(jo.getInteger("startId") + "");
			consultTeam.setEndOperator(endOperator);
			consultTeam.setEndType(endType);
		}
		
//		org.json.JSONObject group = talkGroupService.findConsultTalkGroup(consultTeam.getConsult());
//

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

@ -364,6 +364,9 @@ public class BaseHospitalRequestMapping {
        //修改医生咨询在线状态
        public static final String updateDoctorConsultStatus= "updateDoctorConsultStatus";
        
        //复诊图文咨询人数,视频咨询人数
        public static final String doctorIndexConsultCount="doctorIndexConsultCount";
        
    }
    /**

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

@ -146,7 +146,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			return success("操作成功",result);
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.finish)
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.finish)
	@ApiOperation(value = "医生结束咨询", notes = "医生结束咨询")
	public Envelop finish(
			@ApiParam(name = "consult", value = "咨询CODE")
@ -214,4 +214,14 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		imService.updateDoctorConsultStatus(consultStatus,doctor);
		return success("请求成功");
	}
	
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorIndexConsultCount)
	@ApiOperation(value = "复诊图文咨询人数,视频咨询人数", notes = "复诊图文咨询人数,视频咨询人数")
	public Envelop doctorIndexConsultCount(@ApiParam(name = "doctor", value = "医生CODE")
	                                           @RequestParam(value = "doctor",required = true) String doctor){
		return success("请求成功",prescriptionService.doctorIndexConsultCount(doctor));
	}
	
	
}