-- 可预约资源视图（预约服务列表）
-- 依赖：biz_tech_resource.expert_rating（见 biz_tech_resource_alter_expert_rating.sql）

CREATE OR REPLACE VIEW `v_appointment_resource` AS
SELECT id, resource_type, resource_name, photo_file_url, affiliated_unit, contact_phone, introduction,
       detail_address, service_start_time, service_end_time, service_area, fee_standard,
       service_weekdays, max_daily_appointments, NULL AS expert_rating,
       sys_user_id, assigned_login_name, publish_time
FROM biz_medical_resource
WHERE del_flag = '0' AND publish_status = 1 AND resource_type IN ('004001', '004003')
UNION ALL
SELECT id, resource_type, resource_name, photo_file_url, affiliated_unit, contact_phone, introduction,
       detail_address, service_start_time, service_end_time, service_area, fee_standard,
       service_weekdays, NULL AS max_daily_appointments, expert_rating,
       sys_user_id, assigned_login_name, publish_time
FROM biz_tech_resource
WHERE del_flag = '0' AND publish_status = 1 AND resource_type = '004005';
