예제 #1
0
        public async Task <IActionResult> GetAppointmentDoctorAsync([FromQuery] GetAppointmentDoctorRequestDto requestDto)
        {
            DoctorAppointmentBiz doctorAppointmentBiz = new DoctorAppointmentBiz();
            var response = await doctorAppointmentBiz.GetAppointmentDoctorPageListAsync(UserID, requestDto);

            return(Success(response));
        }
예제 #2
0
        /// <summary>
        /// 获取医院下所有医生信息
        /// </summary>
        /// <param name="requestDto"></param>
        /// <returns></returns>
        public async Task <GetAppointmentDoctorPageListResponseDto> GetAppointmentDoctorPageListAsync(string userId, GetAppointmentDoctorRequestDto requestDto)
        {
            var sqlWhere = string.Empty;

            sqlWhere = $" and c.hospital_guid='{requestDto.HspitalGuid}' ";
            if (!string.IsNullOrWhiteSpace(requestDto.OfficeGuid))
            {
                sqlWhere = $"{sqlWhere} and a.office_guid='{requestDto.OfficeGuid}'";
            }
            var sql = $@"SELECT
	                        c.hos_name,
	                        a.doctor_guid,
	                        b.user_name AS DoctorName,
	                        d.config_name AS title,
	                        office_name,
	                        adept_tags,
                            CONCAT(h.base_path,h.relative_path) as picture,
	                        count(DISTINCT f.appointment_guid) as appointment_count,
	                        Max(g.appointment_time) as latest_appointment_date	
                        FROM
	                        t_doctor a
	                        LEFT JOIN t_utility_user b ON a.doctor_guid = b.user_guid
	                        LEFT JOIN t_doctor_hospital c ON a.hospital_guid = c.hospital_guid
	                        LEFT JOIN t_manager_dictionary d ON a.title_guid = d.dic_guid 
                            LEFT JOIN t_consumer_doctor_appointment f on a.doctor_guid=f.doctor_guid
                            LEFT JOIN t_utility_accessory h on a.portrait_guid=h.accessory_guid and h.`enable`=1
	                        LEFT JOIN t_consumer_doctor_appointment g on a.doctor_guid=g.doctor_guid and g.`enable`=1 and g.`status`='Treated' and g.user_guid='{userId}' 
	                        where a.`enable`=1 and a.`status`='approved' {sqlWhere} 
                            GROUP BY 
                            c.hos_name,
	                        a.doctor_guid,
	                        b.user_name,
	                        d.config_name,
	                        office_name,
	                        adept_tags,
                            picture
                            ORDER BY
	                        latest_appointment_date DESC,appointment_count desc"    ;

            if (requestDto.AppointmentDate.HasValue)
            {
                sqlWhere = $"{sqlWhere} and o.schedule_date='{requestDto.AppointmentDate.Value.ToString("yyyy-MM-dd")}'";
                sql      = $@"SELECT
	                        c.hos_name,
	                        a.doctor_guid,
	                        b.user_name AS DoctorName,
	                        d.config_name AS title,
	                        office_name,
	                        adept_tags,
                            CONCAT(h.base_path,h.relative_path) as picture,
	                        count(DISTINCT f.appointment_guid) as appointment_count,
	                        Max(g.appointment_time) as latest_appointment_date	
                        FROM
	                        t_doctor_schedule o INNER JOIN
	                        t_doctor a on o.doctor_guid=a.doctor_guid and o.hospital_guid='{requestDto.HspitalGuid}'
	                        LEFT JOIN t_utility_user b ON a.doctor_guid = b.user_guid
	                        LEFT JOIN t_doctor_hospital c ON a.hospital_guid = c.hospital_guid
	                        LEFT JOIN t_manager_dictionary d ON a.title_guid = d.dic_guid 
                            LEFT JOIN t_consumer_doctor_appointment f on a.doctor_guid=f.doctor_guid
                            LEFT JOIN t_utility_accessory h on a.portrait_guid=h.accessory_guid and h.`enable`=1
	                        LEFT JOIN t_consumer_doctor_appointment g on a.doctor_guid=g.doctor_guid and g.`enable`=1 and g.`status`='Treated' and g.user_guid='{userId}' 
	                        where a.`status`='approved' and a.`enable`=1 {sqlWhere} 
                            GROUP BY 
                            c.hos_name,
	                        a.doctor_guid,
	                        b.user_name,
	                        d.config_name,
	                        office_name,
	                        adept_tags,
                            picture
                            ORDER BY
	                        latest_appointment_date DESC,appointment_count desc"    ;
            }
            return(await MySqlHelper.QueryByPageAsync <GetAppointmentDoctorRequestDto, GetAppointmentDoctorPageListResponseDto, GetAppointmentDoctorItemDto>(sql, requestDto));
        }