-- ================================================
-- 养老管理系统模拟数据插入脚本 (PostgreSQL版本)
-- ElderCare Management System Mock Data Insert
-- 按角色分段插入模拟数据
-- ================================================

-- 重要说明：如果数据已存在，所有INSERT语句都包含冲突处理
-- 建议：首次运行前可以启用下面的清理语句

-- 清理现有测试数据（可选，谨慎使用）
-- DELETE FROM public.ec_notification_logs;
-- DELETE FROM public.ec_health_alerts;
-- DELETE FROM public.ec_vital_signs;
-- DELETE FROM public.ec_care_records;
-- DELETE FROM public.ec_care_tasks;
-- DELETE FROM public.ec_medication_logs;
-- DELETE FROM public.ec_medications;
-- DELETE FROM public.ec_medical_records;
-- DELETE FROM public.ec_meal_records;
-- DELETE FROM public.ec_activity_participations;
-- DELETE FROM public.ec_visits;
-- DELETE FROM public.ec_family_contacts;
-- DELETE FROM public.ec_elders;
-- DELETE FROM public.ec_care_units;
-- DELETE FROM public.ec_facilities;
-- DELETE FROM public.ak_user_roles WHERE user_id LIKE 'e%' OR user_id LIKE 'f%' OR user_id LIKE 'c%' OR user_id LIKE 'n%' OR user_id LIKE 'd%' OR user_id LIKE 'a%';
-- DELETE FROM public.ak_users WHERE id LIKE 'e%' OR id LIKE 'f%' OR id LIKE 'c%' OR id LIKE 'n%' OR id LIKE 'd%' OR id LIKE 'a%' OR id LIKE 's%';

-- ================================================
-- 第一部分：基础设施数据
-- ================================================

-- 先插入一些地区数据（如果不存在）
INSERT INTO public.ak_regions (id, name, level, parent_id) VALUES
('11111111-1111-1111-1111-111111111111', '北京市', 1, NULL),
('22222222-2222-2222-2222-222222222222', '上海市', 1, NULL),
('33333333-3333-3333-3333-333333333333', '广东省', 1, NULL),
('44444444-4444-4444-4444-444444444444', '江苏省', 1, NULL),
('55555555-5555-5555-5555-555555555555', '浙江省', 1, NULL)
ON CONFLICT (id) DO NOTHING;

-- 插入养老机构数据
INSERT INTO public.ec_facilities (id, name, region_id, type, license_number, contact_phone, address, capacity, current_occupancy) VALUES
('f1111111-1111-1111-1111-111111111111', '北京阳光养老院', '11111111-1111-1111-1111-111111111111', 'nursing_home', 'BJ20231001', '010-88888888', '北京市朝阳区阳光大街123号', 120, 0),
('f2222222-2222-2222-2222-222222222222', '上海康乐护理中心', '22222222-2222-2222-2222-222222222222', 'assisted_living', 'SH20231002', '021-66666666', '上海市浦东新区康乐路456号', 80, 0),
('f3333333-3333-3333-3333-333333333333', '广州爱心日间照料中心', '33333333-3333-3333-3333-333333333333', 'day_care', 'GD20231003', '020-99999999', '广州市天河区爱心街789号', 60, 0),
('f4444444-4444-4444-4444-444444444444', '南京温馨养老院', '44444444-4444-4444-4444-444444444444', 'nursing_home', 'JS20231004', '025-77777777', '南京市鼓楼区温馨路101号', 100, 0),
('f5555555-5555-5555-5555-555555555555', '杭州幸福护理院', '55555555-5555-5555-5555-555555555555', 'assisted_living', 'ZJ20231005', '0571-55555555', '杭州市西湖区幸福路202号', 90, 0);

-- 插入护理单元数据
INSERT INTO public.ec_care_units (id, facility_id, name, unit_type, bed_capacity, current_occupancy) VALUES
-- 北京阳光养老院
('d1111111-1111-1111-1111-111111111111', 'f1111111-1111-1111-1111-111111111111', 'A栋一楼普通区', 'general', 30, 0),
('d1111112-1111-1111-1111-111111111111', 'f1111111-1111-1111-1111-111111111111', 'A栋二楼认知障碍区', 'dementia', 20, 0),
('d1111113-1111-1111-1111-111111111111', 'f1111111-1111-1111-1111-111111111111', 'B栋医疗护理区', 'medical', 25, 0),
('d1111114-1111-1111-1111-111111111111', 'f1111111-1111-1111-1111-111111111111', 'C栋康复训练区', 'rehab', 45, 0),

-- 上海康乐护理中心
('d2222221-2222-2222-2222-222222222222', 'f2222222-2222-2222-2222-222222222222', '东区自理区', 'general', 40, 0),
('d2222222-2222-2222-2222-222222222222', 'f2222222-2222-2222-2222-222222222222', '西区护理区', 'medical', 40, 0),

-- 广州爱心日间照料中心
('d3333331-3333-3333-3333-333333333333', 'f3333333-3333-3333-3333-333333333333', '日间照料区', 'general', 60, 0),

-- 南京温馨养老院
('d4444441-4444-4444-4444-444444444444', 'f4444444-4444-4444-4444-444444444444', '一楼综合区', 'general', 50, 0),
('d4444442-4444-4444-4444-444444444444', 'f4444444-4444-4444-4444-444444444444', '二楼特护区', 'medical', 50, 0),

-- 杭州幸福护理院
('d5555551-5555-5555-5555-555555555555', 'f5555555-5555-5555-5555-555555555555', '幸福一区', 'general', 45, 0),
('d5555552-5555-5555-5555-555555555555', 'f5555555-5555-5555-5555-555555555555', '幸福二区', 'rehab', 45, 0);

-- ================================================
-- 第二部分：老人用户和档案信息
-- ================================================

-- 插入老人用户账号
INSERT INTO public.ak_users (id, username, email, phone, real_name, avatar_url, status, created_at) VALUES
-- 北京阳光养老院老人
('e1000001-0001-0001-0001-000000000001', 'elder_zhang_wei', 'zhang.wei@eldercare.com', '13800000001', '张伟', 'https://example.com/avatars/zhang_wei.jpg', 'active', '2024-01-15 09:00:00+08'),
('e1000002-0002-0002-0002-000000000002', 'elder_wang_li', 'wang.li@eldercare.com', '13800000002', '王丽', 'https://example.com/avatars/wang_li.jpg', 'active', '2024-01-16 10:30:00+08'),
('e1000003-0003-0003-0003-000000000003', 'elder_li_ming', 'li.ming@eldercare.com', '13800000003', '李明', 'https://example.com/avatars/li_ming.jpg', 'active', '2024-01-17 14:20:00+08'),
('e1000004-0004-0004-0004-000000000004', 'elder_zhao_mei', 'zhao.mei@eldercare.com', '13800000004', '赵美', 'https://example.com/avatars/zhao_mei.jpg', 'active', '2024-01-18 11:15:00+08'),
('e1000005-0005-0005-0005-000000000005', 'elder_chen_gang', 'chen.gang@eldercare.com', '13800000005', '陈刚', 'https://example.com/avatars/chen_gang.jpg', 'active', '2024-01-19 08:45:00+08'),

-- 上海康乐护理中心老人
('e2000001-0001-0001-0001-000000000001', 'elder_huang_fang', 'huang.fang@eldercare.com', '13800000011', '黄芳', 'https://example.com/avatars/huang_fang.jpg', 'active', '2024-02-01 09:30:00+08'),
('e2000002-0002-0002-0002-000000000002', 'elder_xu_jun', 'xu.jun@eldercare.com', '13800000012', '徐军', 'https://example.com/avatars/xu_jun.jpg', 'active', '2024-02-02 10:00:00+08'),
('e2000003-0003-0003-0003-000000000003', 'elder_sun_hua', 'sun.hua@eldercare.com', '13800000013', '孙华', 'https://example.com/avatars/sun_hua.jpg', 'active', '2024-02-03 11:30:00+08'),
('e2000004-0004-0004-0004-000000000004', 'elder_zhou_ping', 'zhou.ping@eldercare.com', '13800000014', '周萍', 'https://example.com/avatars/zhou_ping.jpg', 'active', '2024-02-04 14:00:00+08'),

-- 广州爱心日间照料中心老人
('e3000001-0001-0001-0001-000000000001', 'elder_wu_bin', 'wu.bin@eldercare.com', '13800000021', '吴斌', 'https://example.com/avatars/wu_bin.jpg', 'active', '2024-03-01 08:00:00+08'),
('e3000002-0002-0002-0002-000000000002', 'elder_zheng_yan', 'zheng.yan@eldercare.com', '13800000022', '郑燕', 'https://example.com/avatars/zheng_yan.jpg', 'active', '2024-03-02 09:15:00+08'),
('e3000003-0003-0003-0003-000000000003', 'elder_he_qiang', 'he.qiang@eldercare.com', '13800000023', '何强', 'https://example.com/avatars/he_qiang.jpg', 'active', '2024-03-03 10:30:00+08'),

-- 南京温馨养老院老人
('e4000001-0001-0001-0001-000000000001', 'elder_ma_xia', 'ma.xia@eldercare.com', '13800000031', '马霞', 'https://example.com/avatars/ma_xia.jpg', 'active', '2024-04-01 13:20:00+08'),
('e4000002-0002-0002-0002-000000000002', 'elder_guo_lei', 'guo.lei@eldercare.com', '13800000032', '郭磊', 'https://example.com/avatars/guo_lei.jpg', 'active', '2024-04-02 15:45:00+08'),

-- 杭州幸福护理院老人
('e5000001-0001-0001-0001-000000000001', 'elder_luo_jing', 'luo.jing@eldercare.com', '13800000041', '罗静', 'https://example.com/avatars/luo_jing.jpg', 'active', '2024-05-01 10:10:00+08'),
('e5000002-0002-0002-0002-000000000002', 'elder_han_tao', 'han.tao@eldercare.com', '13800000042', '韩涛', 'https://example.com/avatars/han_tao.jpg', 'active', '2024-05-02 11:25:00+08');

-- 为老人用户分配角色
INSERT INTO public.ak_user_roles (user_id, role_id) 
SELECT u.id, r.id
FROM public.ak_users u
CROSS JOIN public.ak_roles r
WHERE u.username LIKE 'elder_%' AND r.name = 'elder';

-- 插入老人详细档案
INSERT INTO public.ec_elders (id, user_id, facility_id, care_unit_id, elder_code, name, id_card, gender, birthday, nationality, religion, marital_status, education, occupation, admission_date, care_level, room_number, bed_number, payment_method, monthly_fee, deposit, status) VALUES
-- 北京阳光养老院老人档案
('e1000001-0001-0001-0001-000000000001', 'e1000001-0001-0001-0001-000000000001', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401150001', '张伟', '110101194501011234', 'male', '1945-01-01', '汉族', '无', 'widowed', '初中', '退休工人', '2024-01-15', 'assisted', 'A101', 'A101-1', 'insurance', 3500.00, 5000.00, 'active'),
('e1000002-0002-0002-0002-000000000002', 'e1000002-0002-0002-0002-000000000002', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401160002', '王丽', '110101194803152345', 'female', '1948-03-15', '汉族', '佛教', 'married', '高中', '退休教师', '2024-01-16', 'self_care', 'A102', 'A102-1', 'self_pay', 4200.00, 8000.00, 'active'),
('e1000003-0003-0003-0003-000000000003', 'e1000003-0003-0003-0003-000000000003', 'f1111111-1111-1111-1111-111111111111', 'd1111112-1111-1111-1111-111111111111', 'E202401170003', '李明', '110101194212203456', 'male', '1942-12-20', '汉族', '无', 'widowed', '大学', '退休医生', '2024-01-17', 'dementia', 'A201', 'A201-1', 'insurance', 5500.00, 10000.00, 'active'),
('e1000004-0004-0004-0004-000000000004', 'e1000004-0004-0004-0004-000000000004', 'f1111111-1111-1111-1111-111111111111', 'd1111113-1111-1111-1111-111111111111', 'E202401180004', '赵美', '110101195006284567', 'female', '1950-06-28', '满族', '基督教', 'divorced', '中专', '退休护士', '2024-01-18', 'full_care', 'B101', 'B101-1', 'government', 2800.00, 3000.00, 'active'),
('e1000005-0005-0005-0005-000000000005', 'e1000005-0005-0005-0005-000000000005', 'f1111111-1111-1111-1111-111111111111', 'd1111114-1111-1111-1111-111111111111', 'E202401190005', '陈刚', '110101194709155678', 'male', '1947-09-15', '汉族', '无', 'married', '高中', '退休司机', '2024-01-19', 'assisted', 'C101', 'C101-1', 'self_pay', 3800.00, 6000.00, 'active'),

-- 上海康乐护理中心老人档案
('e2000001-0001-0001-0001-000000000001', 'e2000001-0001-0001-0001-000000000001', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402010011', '黄芳', '310101194404116789', 'female', '1944-04-11', '汉族', '无', 'widowed', '小学', '退休工人', '2024-02-01', 'self_care', 'E101', 'E101-1', 'insurance', 4000.00, 6000.00, 'active'),
('e2000002-0002-0002-0002-000000000002', 'e2000002-0002-0002-0002-000000000002', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402020012', '徐军', '310101194608227890', 'male', '1946-08-22', '汉族', '道教', 'married', '大专', '退休工程师', '2024-02-02', 'self_care', 'E102', 'E102-1', 'self_pay', 4500.00, 8000.00, 'active'),
('e2000003-0003-0003-0003-000000000003', 'e2000003-0003-0003-0003-000000000003', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402030013', '孙华', '310101194910138901', 'female', '1949-10-13', '汉族', '无', 'single', '中专', '退休会计', '2024-02-03', 'assisted', 'W101', 'W101-1', 'insurance', 3600.00, 5000.00, 'active'),
('e2000004-0004-0004-0004-000000000004', 'e2000004-0004-0004-0004-000000000004', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402040014', '周萍', '310101195111249012', 'female', '1951-11-24', '汉族', '佛教', 'widowed', '高中', '退休商店员工', '2024-02-04', 'full_care', 'W102', 'W102-1', 'government', 3200.00, 4000.00, 'active'),

-- 广州爱心日间照料中心老人档案  
('e3000001-0001-0001-0001-000000000001', 'e3000001-0001-0001-0001-000000000001', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403010021', '吴斌', '440101194507050123', 'male', '1945-07-05', '汉族', '无', 'married', '初中', '退休农民', '2024-03-01', 'self_care', 'D101', 'D101-1', 'self_pay', 2500.00, 3000.00, 'active'),
('e3000002-0002-0002-0002-000000000002', 'e3000002-0002-0002-0002-000000000002', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403020022', '郑燕', '440101194802181234', 'female', '1948-02-18', '汉族', '基督教', 'divorced', '大专', '退休银行员工', '2024-03-02', 'self_care', 'D102', 'D102-1', 'insurance', 3000.00, 4000.00, 'active'),
('e3000003-0003-0003-0003-000000000003', 'e3000003-0003-0003-0003-000000000003', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403030023', '何强', '440101194311122345', 'male', '1943-11-12', '汉族', '无', 'widowed', '中专', '退休技师', '2024-03-03', 'assisted', 'D103', 'D103-1', 'insurance', 3200.00, 4500.00, 'active'),

-- 南京温馨养老院老人档案
('e4000001-0001-0001-0001-000000000001', 'e4000001-0001-0001-0001-000000000001', 'f4444444-4444-4444-4444-444444444444', 'd4444441-4444-4444-4444-444444444444', 'E202404010031', '马霞', '320101194605093456', 'female', '1946-05-09', '汉族', '无', 'married', '高中', '退休纺织工人', '2024-04-01', 'self_care', 'N101', 'N101-1', 'insurance', 3300.00, 5000.00, 'active'),
('e4000002-0002-0002-0002-000000000002', 'e4000002-0002-0002-0002-000000000002', 'f4444444-4444-4444-4444-444444444444', 'd4444442-4444-4444-4444-444444444444', 'E202404020032', '郭磊', '320101194408154567', 'male', '1944-08-15', '汉族', '道教', 'widowed', '大学', '退休大学教授', '2024-04-02', 'full_care', 'N201', 'N201-1', 'self_pay', 5000.00, 10000.00, 'active'),

-- 杭州幸福护理院老人档案
('e5000001-0001-0001-0001-000000000001', 'e5000001-0001-0001-0001-000000000001', 'f5555555-5555-5555-5555-555555555555', 'd5555551-5555-5555-5555-555555555555', 'E202405010041', '罗静', '330101194709205678', 'female', '1947-09-20', '汉族', '佛教', 'divorced', '中专', '退休医院护士', '2024-05-01', 'assisted', 'H101', 'H101-1', 'insurance', 3700.00, 6000.00, 'active'),
('e5000002-0002-0002-0002-000000000002', 'e5000002-0002-0002-0002-000000000002', 'f5555555-5555-5555-5555-555555555555', 'd5555552-5555-5555-5555-555555555555', 'E202405020042', '韩涛', '330101194512106789', 'male', '1945-12-10', '汉族', '无', 'married', '高中', '退休建筑工人', '2024-05-02', 'assisted', 'H201', 'H201-1', 'self_pay', 3500.00, 5500.00, 'active');

-- ================================================
-- 第二部分：老人用户和档案信息
-- ================================================

-- 插入老人用户账号
INSERT INTO public.ak_users (id, username, email, phone, real_name, avatar_url, status, created_at) VALUES
-- 北京阳光养老院老人
('e1000001-0001-0001-0001-000000000001', 'elder_zhang_wei', 'zhang.wei@eldercare.com', '13800000001', '张伟', 'https://example.com/avatars/zhang_wei.jpg', 'active', '2024-01-15 09:00:00+08'),
('e1000002-0002-0002-0002-000000000002', 'elder_wang_li', 'wang.li@eldercare.com', '13800000002', '王丽', 'https://example.com/avatars/wang_li.jpg', 'active', '2024-01-16 10:30:00+08'),
('e1000003-0003-0003-0003-000000000003', 'elder_li_ming', 'li.ming@eldercare.com', '13800000003', '李明', 'https://example.com/avatars/li_ming.jpg', 'active', '2024-01-17 14:20:00+08'),
('e1000004-0004-0004-0004-000000000004', 'elder_zhao_mei', 'zhao.mei@eldercare.com', '13800000004', '赵美', 'https://example.com/avatars/zhao_mei.jpg', 'active', '2024-01-18 11:15:00+08'),
('e1000005-0005-0005-0005-000000000005', 'elder_chen_gang', 'chen.gang@eldercare.com', '13800000005', '陈刚', 'https://example.com/avatars/chen_gang.jpg', 'active', '2024-01-19 08:45:00+08'),

-- 上海康乐护理中心老人
('e2000001-0001-0001-0001-000000000001', 'elder_huang_fang', 'huang.fang@eldercare.com', '13800000011', '黄芳', 'https://example.com/avatars/huang_fang.jpg', 'active', '2024-02-01 09:30:00+08'),
('e2000002-0002-0002-0002-000000000002', 'elder_xu_jun', 'xu.jun@eldercare.com', '13800000012', '徐军', 'https://example.com/avatars/xu_jun.jpg', 'active', '2024-02-02 10:00:00+08'),
('e2000003-0003-0003-0003-000000000003', 'elder_sun_hua', 'sun.hua@eldercare.com', '13800000013', '孙华', 'https://example.com/avatars/sun_hua.jpg', 'active', '2024-02-03 11:30:00+08'),
('e2000004-0004-0004-0004-000000000004', 'elder_zhou_ping', 'zhou.ping@eldercare.com', '13800000014', '周萍', 'https://example.com/avatars/zhou_ping.jpg', 'active', '2024-02-04 14:00:00+08'),

-- 广州爱心日间照料中心老人
('e3000001-0001-0001-0001-000000000001', 'elder_wu_bin', 'wu.bin@eldercare.com', '13800000021', '吴斌', 'https://example.com/avatars/wu_bin.jpg', 'active', '2024-03-01 08:00:00+08'),
('e3000002-0002-0002-0002-000000000002', 'elder_zheng_yan', 'zheng.yan@eldercare.com', '13800000022', '郑燕', 'https://example.com/avatars/zheng_yan.jpg', 'active', '2024-03-02 09:15:00+08'),
('e3000003-0003-0003-0003-000000000003', 'elder_he_qiang', 'he.qiang@eldercare.com', '13800000023', '何强', 'https://example.com/avatars/he_qiang.jpg', 'active', '2024-03-03 10:30:00+08'),

-- 南京温馨养老院老人
('e4000001-0001-0001-0001-000000000001', 'elder_ma_xia', 'ma.xia@eldercare.com', '13800000031', '马霞', 'https://example.com/avatars/ma_xia.jpg', 'active', '2024-04-01 13:20:00+08'),
('e4000002-0002-0002-0002-000000000002', 'elder_guo_lei', 'guo.lei@eldercare.com', '13800000032', '郭磊', 'https://example.com/avatars/guo_lei.jpg', 'active', '2024-04-02 15:45:00+08'),

-- 杭州幸福护理院老人
('e5000001-0001-0001-0001-000000000001', 'elder_luo_jing', 'luo.jing@eldercare.com', '13800000041', '罗静', 'https://example.com/avatars/luo_jing.jpg', 'active', '2024-05-01 10:10:00+08'),
('e5000002-0002-0002-0002-000000000002', 'elder_han_tao', 'han.tao@eldercare.com', '13800000042', '韩涛', 'https://example.com/avatars/han_tao.jpg', 'active', '2024-05-02 11:25:00+08');

-- 为老人用户分配角色
INSERT INTO public.ak_user_roles (user_id, role_id) 
SELECT u.id, r.id
FROM public.ak_users u
CROSS JOIN public.ak_roles r
WHERE u.username LIKE 'elder_%' AND r.name = 'elder';

-- 插入老人详细档案
INSERT INTO public.ec_elders (id, user_id, facility_id, care_unit_id, elder_code, name, id_card, gender, birthday, nationality, religion, marital_status, education, occupation, admission_date, care_level, room_number, bed_number, payment_method, monthly_fee, deposit, status) VALUES
-- 北京阳光养老院老人档案
('e1000001-0001-0001-0001-000000000001', 'e1000001-0001-0001-0001-000000000001', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401150001', '张伟', '110101194501011234', 'male', '1945-01-01', '汉族', '无', 'widowed', '初中', '退休工人', '2024-01-15', 'assisted', 'A101', 'A101-1', 'insurance', 3500.00, 5000.00, 'active'),
('e1000002-0002-0002-0002-000000000002', 'e1000002-0002-0002-0002-000000000002', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401160002', '王丽', '110101194803152345', 'female', '1948-03-15', '汉族', '佛教', 'married', '高中', '退休教师', '2024-01-16', 'self_care', 'A102', 'A102-1', 'self_pay', 4200.00, 8000.00, 'active'),
('e1000003-0003-0003-0003-000000000003', 'e1000003-0003-0003-0003-000000000003', 'f1111111-1111-1111-1111-111111111111', 'd1111112-1111-1111-1111-111111111111', 'E202401170003', '李明', '110101194212203456', 'male', '1942-12-20', '汉族', '无', 'widowed', '大学', '退休医生', '2024-01-17', 'dementia', 'A201', 'A201-1', 'insurance', 5500.00, 10000.00, 'active'),
('e1000004-0004-0004-0004-000000000004', 'e1000004-0004-0004-0004-000000000004', 'f1111111-1111-1111-1111-111111111111', 'd1111113-1111-1111-1111-111111111111', 'E202401180004', '赵美', '110101195006284567', 'female', '1950-06-28', '满族', '基督教', 'divorced', '中专', '退休护士', '2024-01-18', 'full_care', 'B101', 'B101-1', 'government', 2800.00, 3000.00, 'active'),
('e1000005-0005-0005-0005-000000000005', 'e1000005-0005-0005-0005-000000000005', 'f1111111-1111-1111-1111-111111111111', 'd1111114-1111-1111-1111-111111111111', 'E202401190005', '陈刚', '110101194709155678', 'male', '1947-09-15', '汉族', '无', 'married', '高中', '退休司机', '2024-01-19', 'assisted', 'C101', 'C101-1', 'self_pay', 3800.00, 6000.00, 'active'),

-- 上海康乐护理中心老人档案
('e2000001-0001-0001-0001-000000000001', 'e2000001-0001-0001-0001-000000000001', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402010011', '黄芳', '310101194404116789', 'female', '1944-04-11', '汉族', '无', 'widowed', '小学', '退休工人', '2024-02-01', 'self_care', 'E101', 'E101-1', 'insurance', 4000.00, 6000.00, 'active'),
('e2000002-0002-0002-0002-000000000002', 'e2000002-0002-0002-0002-000000000002', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402020012', '徐军', '310101194608227890', 'male', '1946-08-22', '汉族', '道教', 'married', '大专', '退休工程师', '2024-02-02', 'self_care', 'E102', 'E102-1', 'self_pay', 4500.00, 8000.00, 'active'),
('e2000003-0003-0003-0003-000000000003', 'e2000003-0003-0003-0003-000000000003', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402030013', '孙华', '310101194910138901', 'female', '1949-10-13', '汉族', '无', 'single', '中专', '退休会计', '2024-02-03', 'assisted', 'W101', 'W101-1', 'insurance', 3600.00, 5000.00, 'active'),
('e2000004-0004-0004-0004-000000000004', 'e2000004-0004-0004-0004-000000000004', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402040014', '周萍', '310101195111249012', 'female', '1951-11-24', '汉族', '佛教', 'widowed', '高中', '退休商店员工', '2024-02-04', 'full_care', 'W102', 'W102-1', 'government', 3200.00, 4000.00, 'active'),

-- 广州爱心日间照料中心老人档案  
('e3000001-0001-0001-0001-000000000001', 'e3000001-0001-0001-0001-000000000001', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403010021', '吴斌', '440101194507050123', 'male', '1945-07-05', '汉族', '无', 'married', '初中', '退休农民', '2024-03-01', 'self_care', 'D101', 'D101-1', 'self_pay', 2500.00, 3000.00, 'active'),
('e3000002-0002-0002-0002-000000000002', 'e3000002-0002-0002-0002-000000000002', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403020022', '郑燕', '440101194802181234', 'female', '1948-02-18', '汉族', '基督教', 'divorced', '大专', '退休银行员工', '2024-03-02', 'self_care', 'D102', 'D102-1', 'insurance', 3000.00, 4000.00, 'active'),
('e3000003-0003-0003-0003-000000000003', 'e3000003-0003-0003-0003-000000000003', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403030023', '何强', '440101194311122345', 'male', '1943-11-12', '汉族', '无', 'widowed', '中专', '退休技师', '2024-03-03', 'assisted', 'D103', 'D103-1', 'insurance', 3200.00, 4500.00, 'active'),

-- 南京温馨养老院老人档案
('e4000001-0001-0001-0001-000000000001', 'e4000001-0001-0001-0001-000000000001', 'f4444444-4444-4444-4444-444444444444', 'd4444441-4444-4444-4444-444444444444', 'E202404010031', '马霞', '320101194605093456', 'female', '1946-05-09', '汉族', '无', 'married', '高中', '退休纺织工人', '2024-04-01', 'self_care', 'N101', 'N101-1', 'insurance', 3300.00, 5000.00, 'active'),
('e4000002-0002-0002-0002-000000000002', 'e4000002-0002-0002-0002-000000000002', 'f4444444-4444-4444-4444-444444444444', 'd4444442-4444-4444-4444-444444444444', 'E202404020032', '郭磊', '320101194408154567', 'male', '1944-08-15', '汉族', '道教', 'widowed', '大学', '退休大学教授', '2024-04-02', 'full_care', 'N201', 'N201-1', 'self_pay', 5000.00, 10000.00, 'active'),

-- 杭州幸福护理院老人档案
('e5000001-0001-0001-0001-000000000001', 'e5000001-0001-0001-0001-000000000001', 'f5555555-5555-5555-5555-555555555555', 'd5555551-5555-5555-5555-555555555555', 'E202405010041', '罗静', '330101194709205678', 'female', '1947-09-20', '汉族', '佛教', 'divorced', '中专', '退休医院护士', '2024-05-01', 'assisted', 'H101', 'H101-1', 'insurance', 3700.00, 6000.00, 'active'),
('e5000002-0002-0002-0002-000000000002', 'e5000002-0002-0002-0002-000000000002', 'f5555555-5555-5555-5555-555555555555', 'd5555552-5555-5555-5555-555555555555', 'E202405020042', '韩涛', '330101194512106789', 'male', '1945-12-10', '汉族', '无', 'married', '高中', '退休建筑工人', '2024-05-02', 'assisted', 'H201', 'H201-1', 'self_pay', 3500.00, 5500.00, 'active');

-- ================================================
-- 第二部分：老人用户和档案信息
-- ================================================

-- 插入老人用户账号
INSERT INTO public.ak_users (id, username, email, phone, real_name, avatar_url, status, created_at) VALUES
-- 北京阳光养老院老人
('e1000001-0001-0001-0001-000000000001', 'elder_zhang_wei', 'zhang.wei@eldercare.com', '13800000001', '张伟', 'https://example.com/avatars/zhang_wei.jpg', 'active', '2024-01-15 09:00:00+08'),
('e1000002-0002-0002-0002-000000000002', 'elder_wang_li', 'wang.li@eldercare.com', '13800000002', '王丽', 'https://example.com/avatars/wang_li.jpg', 'active', '2024-01-16 10:30:00+08'),
('e1000003-0003-0003-0003-000000000003', 'elder_li_ming', 'li.ming@eldercare.com', '13800000003', '李明', 'https://example.com/avatars/li_ming.jpg', 'active', '2024-01-17 14:20:00+08'),
('e1000004-0004-0004-0004-000000000004', 'elder_zhao_mei', 'zhao.mei@eldercare.com', '13800000004', '赵美', 'https://example.com/avatars/zhao_mei.jpg', 'active', '2024-01-18 11:15:00+08'),
('e1000005-0005-0005-0005-000000000005', 'elder_chen_gang', 'chen.gang@eldercare.com', '13800000005', '陈刚', 'https://example.com/avatars/chen_gang.jpg', 'active', '2024-01-19 08:45:00+08'),

-- 上海康乐护理中心老人
('e2000001-0001-0001-0001-000000000001', 'elder_huang_fang', 'huang.fang@eldercare.com', '13800000011', '黄芳', 'https://example.com/avatars/huang_fang.jpg', 'active', '2024-02-01 09:30:00+08'),
('e2000002-0002-0002-0002-000000000002', 'elder_xu_jun', 'xu.jun@eldercare.com', '13800000012', '徐军', 'https://example.com/avatars/xu_jun.jpg', 'active', '2024-02-02 10:00:00+08'),
('e2000003-0003-0003-0003-000000000003', 'elder_sun_hua', 'sun.hua@eldercare.com', '13800000013', '孙华', 'https://example.com/avatars/sun_hua.jpg', 'active', '2024-02-03 11:30:00+08'),
('e2000004-0004-0004-0004-000000000004', 'elder_zhou_ping', 'zhou.ping@eldercare.com', '13800000014', '周萍', 'https://example.com/avatars/zhou_ping.jpg', 'active', '2024-02-04 14:00:00+08'),

-- 广州爱心日间照料中心老人
('e3000001-0001-0001-0001-000000000001', 'elder_wu_bin', 'wu.bin@eldercare.com', '13800000021', '吴斌', 'https://example.com/avatars/wu_bin.jpg', 'active', '2024-03-01 08:00:00+08'),
('e3000002-0002-0002-0002-000000000002', 'elder_zheng_yan', 'zheng.yan@eldercare.com', '13800000022', '郑燕', 'https://example.com/avatars/zheng_yan.jpg', 'active', '2024-03-02 09:15:00+08'),
('e3000003-0003-0003-0003-000000000003', 'elder_he_qiang', 'he.qiang@eldercare.com', '13800000023', '何强', 'https://example.com/avatars/he_qiang.jpg', 'active', '2024-03-03 10:30:00+08'),

-- 南京温馨养老院老人
('e4000001-0001-0001-0001-000000000001', 'elder_ma_xia', 'ma.xia@eldercare.com', '13800000031', '马霞', 'https://example.com/avatars/ma_xia.jpg', 'active', '2024-04-01 13:20:00+08'),
('e4000002-0002-0002-0002-000000000002', 'elder_guo_lei', 'guo.lei@eldercare.com', '13800000032', '郭磊', 'https://example.com/avatars/guo_lei.jpg', 'active', '2024-04-02 15:45:00+08'),

-- 杭州幸福护理院老人
('e5000001-0001-0001-0001-000000000001', 'elder_luo_jing', 'luo.jing@eldercare.com', '13800000041', '罗静', 'https://example.com/avatars/luo_jing.jpg', 'active', '2024-05-01 10:10:00+08'),
('e5000002-0002-0002-0002-000000000002', 'elder_han_tao', 'han.tao@eldercare.com', '13800000042', '韩涛', 'https://example.com/avatars/han_tao.jpg', 'active', '2024-05-02 11:25:00+08');

-- 为老人用户分配角色
INSERT INTO public.ak_user_roles (user_id, role_id) 
SELECT u.id, r.id
FROM public.ak_users u
CROSS JOIN public.ak_roles r
WHERE u.username LIKE 'elder_%' AND r.name = 'elder';

-- 插入老人详细档案
INSERT INTO public.ec_elders (id, user_id, facility_id, care_unit_id, elder_code, name, id_card, gender, birthday, nationality, religion, marital_status, education, occupation, admission_date, care_level, room_number, bed_number, payment_method, monthly_fee, deposit, status) VALUES
-- 北京阳光养老院老人档案
('e1000001-0001-0001-0001-000000000001', 'e1000001-0001-0001-0001-000000000001', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401150001', '张伟', '110101194501011234', 'male', '1945-01-01', '汉族', '无', 'widowed', '初中', '退休工人', '2024-01-15', 'assisted', 'A101', 'A101-1', 'insurance', 3500.00, 5000.00, 'active'),
('e1000002-0002-0002-0002-000000000002', 'e1000002-0002-0002-0002-000000000002', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401160002', '王丽', '110101194803152345', 'female', '1948-03-15', '汉族', '佛教', 'married', '高中', '退休教师', '2024-01-16', 'self_care', 'A102', 'A102-1', 'self_pay', 4200.00, 8000.00, 'active'),
('e1000003-0003-0003-0003-000000000003', 'e1000003-0003-0003-0003-000000000003', 'f1111111-1111-1111-1111-111111111111', 'd1111112-1111-1111-1111-111111111111', 'E202401170003', '李明', '110101194212203456', 'male', '1942-12-20', '汉族', '无', 'widowed', '大学', '退休医生', '2024-01-17', 'dementia', 'A201', 'A201-1', 'insurance', 5500.00, 10000.00, 'active'),
('e1000004-0004-0004-0004-000000000004', 'e1000004-0004-0004-0004-000000000004', 'f1111111-1111-1111-1111-111111111111', 'd1111113-1111-1111-1111-111111111111', 'E202401180004', '赵美', '110101195006284567', 'female', '1950-06-28', '满族', '基督教', 'divorced', '中专', '退休护士', '2024-01-18', 'full_care', 'B101', 'B101-1', 'government', 2800.00, 3000.00, 'active'),
('e1000005-0005-0005-0005-000000000005', 'e1000005-0005-0005-0005-000000000005', 'f1111111-1111-1111-1111-111111111111', 'd1111114-1111-1111-1111-111111111111', 'E202401190005', '陈刚', '110101194709155678', 'male', '1947-09-15', '汉族', '无', 'married', '高中', '退休司机', '2024-01-19', 'assisted', 'C101', 'C101-1', 'self_pay', 3800.00, 6000.00, 'active'),

-- 上海康乐护理中心老人档案
('e2000001-0001-0001-0001-000000000001', 'e2000001-0001-0001-0001-000000000001', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402010011', '黄芳', '310101194404116789', 'female', '1944-04-11', '汉族', '无', 'widowed', '小学', '退休工人', '2024-02-01', 'self_care', 'E101', 'E101-1', 'insurance', 4000.00, 6000.00, 'active'),
('e2000002-0002-0002-0002-000000000002', 'e2000002-0002-0002-0002-000000000002', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402020012', '徐军', '310101194608227890', 'male', '1946-08-22', '汉族', '道教', 'married', '大专', '退休工程师', '2024-02-02', 'self_care', 'E102', 'E102-1', 'self_pay', 4500.00, 8000.00, 'active'),
('e2000003-0003-0003-0003-000000000003', 'e2000003-0003-0003-0003-000000000003', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402030013', '孙华', '310101194910138901', 'female', '1949-10-13', '汉族', '无', 'single', '中专', '退休会计', '2024-02-03', 'assisted', 'W101', 'W101-1', 'insurance', 3600.00, 5000.00, 'active'),
('e2000004-0004-0004-0004-000000000004', 'e2000004-0004-0004-0004-000000000004', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402040014', '周萍', '310101195111249012', 'female', '1951-11-24', '汉族', '佛教', 'widowed', '高中', '退休商店员工', '2024-02-04', 'full_care', 'W102', 'W102-1', 'government', 3200.00, 4000.00, 'active'),

-- 广州爱心日间照料中心老人档案  
('e3000001-0001-0001-0001-000000000001', 'e3000001-0001-0001-0001-000000000001', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403010021', '吴斌', '440101194507050123', 'male', '1945-07-05', '汉族', '无', 'married', '初中', '退休农民', '2024-03-01', 'self_care', 'D101', 'D101-1', 'self_pay', 2500.00, 3000.00, 'active'),
('e3000002-0002-0002-0002-000000000002', 'e3000002-0002-0002-0002-000000000002', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403020022', '郑燕', '440101194802181234', 'female', '1948-02-18', '汉族', '基督教', 'divorced', '大专', '退休银行员工', '2024-03-02', 'self_care', 'D102', 'D102-1', 'insurance', 3000.00, 4000.00, 'active'),
('e3000003-0003-0003-0003-000000000003', 'e3000003-0003-0003-0003-000000000003', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403030023', '何强', '440101194311122345', 'male', '1943-11-12', '汉族', '无', 'widowed', '中专', '退休技师', '2024-03-03', 'assisted', 'D103', 'D103-1', 'insurance', 3200.00, 4500.00, 'active'),

-- 南京温馨养老院老人档案
('e4000001-0001-0001-0001-000000000001', 'e4000001-0001-0001-0001-000000000001', 'f4444444-4444-4444-4444-444444444444', 'd4444441-4444-4444-4444-444444444444', 'E202404010031', '马霞', '320101194605093456', 'female', '1946-05-09', '汉族', '无', 'married', '高中', '退休纺织工人', '2024-04-01', 'self_care', 'N101', 'N101-1', 'insurance', 3300.00, 5000.00, 'active'),
('e4000002-0002-0002-0002-000000000002', 'e4000002-0002-0002-0002-000000000002', 'f4444444-4444-4444-4444-444444444444', 'd4444442-4444-4444-4444-444444444444', 'E202404020032', '郭磊', '320101194408154567', 'male', '1944-08-15', '汉族', '道教', 'widowed', '大学', '退休大学教授', '2024-04-02', 'full_care', 'N201', 'N201-1', 'self_pay', 5000.00, 10000.00, 'active'),

-- 杭州幸福护理院老人档案
('e5000001-0001-0001-0001-000000000001', 'e5000001-0001-0001-0001-000000000001', 'f5555555-5555-5555-5555-555555555555', 'd5555551-5555-5555-5555-555555555555', 'E202405010041', '罗静', '330101194709205678', 'female', '1947-09-20', '汉族', '佛教', 'divorced', '中专', '退休医院护士', '2024-05-01', 'assisted', 'H101', 'H101-1', 'insurance', 3700.00, 6000.00, 'active'),
('e5000002-0002-0002-0002-000000000002', 'e5000002-0002-0002-0002-000000000002', 'f5555555-5555-5555-5555-555555555555', 'd5555552-5555-5555-5555-555555555555', 'E202405020042', '韩涛', '330101194512106789', 'male', '1945-12-10', '汉族', '无', 'married', '高中', '退休建筑工人', '2024-05-02', 'assisted', 'H201', 'H201-1', 'self_pay', 3500.00, 5500.00, 'active');

-- ================================================
-- 第二部分：老人用户和档案信息
-- ================================================

-- 插入老人用户账号
INSERT INTO public.ak_users (id, username, email, phone, real_name, avatar_url, status, created_at) VALUES
-- 北京阳光养老院老人
('e1000001-0001-0001-0001-000000000001', 'elder_zhang_wei', 'zhang.wei@eldercare.com', '13800000001', '张伟', 'https://example.com/avatars/zhang_wei.jpg', 'active', '2024-01-15 09:00:00+08'),
('e1000002-0002-0002-0002-000000000002', 'elder_wang_li', 'wang.li@eldercare.com', '13800000002', '王丽', 'https://example.com/avatars/wang_li.jpg', 'active', '2024-01-16 10:30:00+08'),
('e1000003-0003-0003-0003-000000000003', 'elder_li_ming', 'li.ming@eldercare.com', '13800000003', '李明', 'https://example.com/avatars/li_ming.jpg', 'active', '2024-01-17 14:20:00+08'),
('e1000004-0004-0004-0004-000000000004', 'elder_zhao_mei', 'zhao.mei@eldercare.com', '13800000004', '赵美', 'https://example.com/avatars/zhao_mei.jpg', 'active', '2024-01-18 11:15:00+08'),
('e1000005-0005-0005-0005-000000000005', 'elder_chen_gang', 'chen.gang@eldercare.com', '13800000005', '陈刚', 'https://example.com/avatars/chen_gang.jpg', 'active', '2024-01-19 08:45:00+08'),

-- 上海康乐护理中心老人
('e2000001-0001-0001-0001-000000000001', 'elder_huang_fang', 'huang.fang@eldercare.com', '13800000011', '黄芳', 'https://example.com/avatars/huang_fang.jpg', 'active', '2024-02-01 09:30:00+08'),
('e2000002-0002-0002-0002-000000000002', 'elder_xu_jun', 'xu.jun@eldercare.com', '13800000012', '徐军', 'https://example.com/avatars/xu_jun.jpg', 'active', '2024-02-02 10:00:00+08'),
('e2000003-0003-0003-0003-000000000003', 'elder_sun_hua', 'sun.hua@eldercare.com', '13800000013', '孙华', 'https://example.com/avatars/sun_hua.jpg', 'active', '2024-02-03 11:30:00+08'),
('e2000004-0004-0004-0004-000000000004', 'elder_zhou_ping', 'zhou.ping@eldercare.com', '13800000014', '周萍', 'https://example.com/avatars/zhou_ping.jpg', 'active', '2024-02-04 14:00:00+08'),

-- 广州爱心日间照料中心老人
('e3000001-0001-0001-0001-000000000001', 'elder_wu_bin', 'wu.bin@eldercare.com', '13800000021', '吴斌', 'https://example.com/avatars/wu_bin.jpg', 'active', '2024-03-01 08:00:00+08'),
('e3000002-0002-0002-0002-000000000002', 'elder_zheng_yan', 'zheng.yan@eldercare.com', '13800000022', '郑燕', 'https://example.com/avatars/zheng_yan.jpg', 'active', '2024-03-02 09:15:00+08'),
('e3000003-0003-0003-0003-000000000003', 'elder_he_qiang', 'he.qiang@eldercare.com', '13800000023', '何强', 'https://example.com/avatars/he_qiang.jpg', 'active', '2024-03-03 10:30:00+08'),

-- 南京温馨养老院老人
('e4000001-0001-0001-0001-000000000001', 'elder_ma_xia', 'ma.xia@eldercare.com', '13800000031', '马霞', 'https://example.com/avatars/ma_xia.jpg', 'active', '2024-04-01 13:20:00+08'),
('e4000002-0002-0002-0002-000000000002', 'elder_guo_lei', 'guo.lei@eldercare.com', '13800000032', '郭磊', 'https://example.com/avatars/guo_lei.jpg', 'active', '2024-04-02 15:45:00+08'),

-- 杭州幸福护理院老人
('e5000001-0001-0001-0001-000000000001', 'elder_luo_jing', 'luo.jing@eldercare.com', '13800000041', '罗静', 'https://example.com/avatars/luo_jing.jpg', 'active', '2024-05-01 10:10:00+08'),
('e5000002-0002-0002-0002-000000000002', 'elder_han_tao', 'han.tao@eldercare.com', '13800000042', '韩涛', 'https://example.com/avatars/han_tao.jpg', 'active', '2024-05-02 11:25:00+08');

-- 为老人用户分配角色
INSERT INTO public.ak_user_roles (user_id, role_id) 
SELECT u.id, r.id
FROM public.ak_users u
CROSS JOIN public.ak_roles r
WHERE u.username LIKE 'elder_%' AND r.name = 'elder';

-- 插入老人详细档案
INSERT INTO public.ec_elders (id, user_id, facility_id, care_unit_id, elder_code, name, id_card, gender, birthday, nationality, religion, marital_status, education, occupation, admission_date, care_level, room_number, bed_number, payment_method, monthly_fee, deposit, status) VALUES
-- 北京阳光养老院老人档案
('e1000001-0001-0001-0001-000000000001', 'e1000001-0001-0001-0001-000000000001', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401150001', '张伟', '110101194501011234', 'male', '1945-01-01', '汉族', '无', 'widowed', '初中', '退休工人', '2024-01-15', 'assisted', 'A101', 'A101-1', 'insurance', 3500.00, 5000.00, 'active'),
('e1000002-0002-0002-0002-000000000002', 'e1000002-0002-0002-0002-000000000002', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401160002', '王丽', '110101194803152345', 'female', '1948-03-15', '汉族', '佛教', 'married', '高中', '退休教师', '2024-01-16', 'self_care', 'A102', 'A102-1', 'self_pay', 4200.00, 8000.00, 'active'),
('e1000003-0003-0003-0003-000000000003', 'e1000003-0003-0003-0003-000000000003', 'f1111111-1111-1111-1111-111111111111', 'd1111112-1111-1111-1111-111111111111', 'E202401170003', '李明', '110101194212203456', 'male', '1942-12-20', '汉族', '无', 'widowed', '大学', '退休医生', '2024-01-17', 'dementia', 'A201', 'A201-1', 'insurance', 5500.00, 10000.00, 'active'),
('e1000004-0004-0004-0004-000000000004', 'e1000004-0004-0004-0004-000000000004', 'f1111111-1111-1111-1111-111111111111', 'd1111113-1111-1111-1111-111111111111', 'E202401180004', '赵美', '110101195006284567', 'female', '1950-06-28', '满族', '基督教', 'divorced', '中专', '退休护士', '2024-01-18', 'full_care', 'B101', 'B101-1', 'government', 2800.00, 3000.00, 'active'),
('e1000005-0005-0005-0005-000000000005', 'e1000005-0005-0005-0005-000000000005', 'f1111111-1111-1111-1111-111111111111', 'd1111114-1111-1111-1111-111111111111', 'E202401190005', '陈刚', '110101194709155678', 'male', '1947-09-15', '汉族', '无', 'married', '高中', '退休司机', '2024-01-19', 'assisted', 'C101', 'C101-1', 'self_pay', 3800.00, 6000.00, 'active'),

-- 上海康乐护理中心老人档案
('e2000001-0001-0001-0001-000000000001', 'e2000001-0001-0001-0001-000000000001', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402010011', '黄芳', '310101194404116789', 'female', '1944-04-11', '汉族', '无', 'widowed', '小学', '退休工人', '2024-02-01', 'self_care', 'E101', 'E101-1', 'insurance', 4000.00, 6000.00, 'active'),
('e2000002-0002-0002-0002-000000000002', 'e2000002-0002-0002-0002-000000000002', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402020012', '徐军', '310101194608227890', 'male', '1946-08-22', '汉族', '道教', 'married', '大专', '退休工程师', '2024-02-02', 'self_care', 'E102', 'E102-1', 'self_pay', 4500.00, 8000.00, 'active'),
('e2000003-0003-0003-0003-000000000003', 'e2000003-0003-0003-0003-000000000003', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402030013', '孙华', '310101194910138901', 'female', '1949-10-13', '汉族', '无', 'single', '中专', '退休会计', '2024-02-03', 'assisted', 'W101', 'W101-1', 'insurance', 3600.00, 5000.00, 'active'),
('e2000004-0004-0004-0004-000000000004', 'e2000004-0004-0004-0004-000000000004', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402040014', '周萍', '310101195111249012', 'female', '1951-11-24', '汉族', '佛教', 'widowed', '高中', '退休商店员工', '2024-02-04', 'full_care', 'W102', 'W102-1', 'government', 3200.00, 4000.00, 'active'),

-- 广州爱心日间照料中心老人档案  
('e3000001-0001-0001-0001-000000000001', 'e3000001-0001-0001-0001-000000000001', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403010021', '吴斌', '440101194507050123', 'male', '1945-07-05', '汉族', '无', 'married', '初中', '退休农民', '2024-03-01', 'self_care', 'D101', 'D101-1', 'self_pay', 2500.00, 3000.00, 'active'),
('e3000002-0002-0002-0002-000000000002', 'e3000002-0002-0002-0002-000000000002', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403020022', '郑燕', '440101194802181234', 'female', '1948-02-18', '汉族', '基督教', 'divorced', '大专', '退休银行员工', '2024-03-02', 'self_care', 'D102', 'D102-1', 'insurance', 3000.00, 4000.00, 'active'),
('e3000003-0003-0003-0003-000000000003', 'e3000003-0003-0003-0003-000000000003', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403030023', '何强', '440101194311122345', 'male', '1943-11-12', '汉族', '无', 'widowed', '中专', '退休技师', '2024-03-03', 'assisted', 'D103', 'D103-1', 'insurance', 3200.00, 4500.00, 'active'),

-- 南京温馨养老院老人档案
('e4000001-0001-0001-0001-000000000001', 'e4000001-0001-0001-0001-000000000001', 'f4444444-4444-4444-4444-444444444444', 'd4444441-4444-4444-4444-444444444444', 'E202404010031', '马霞', '320101194605093456', 'female', '1946-05-09', '汉族', '无', 'married', '高中', '退休纺织工人', '2024-04-01', 'self_care', 'N101', 'N101-1', 'insurance', 3300.00, 5000.00, 'active'),
('e4000002-0002-0002-0002-000000000002', 'e4000002-0002-0002-0002-000000000002', 'f4444444-4444-4444-4444-444444444444', 'd4444442-4444-4444-4444-444444444444', 'E202404020032', '郭磊', '320101194408154567', 'male', '1944-08-15', '汉族', '道教', 'widowed', '大学', '退休大学教授', '2024-04-02', 'full_care', 'N201', 'N201-1', 'self_pay', 5000.00, 10000.00, 'active'),

-- 杭州幸福护理院老人档案
('e5000001-0001-0001-0001-000000000001', 'e5000001-0001-0001-0001-000000000001', 'f5555555-5555-5555-5555-555555555555', 'd5555551-5555-5555-5555-555555555555', 'E202405010041', '罗静', '330101194709205678', 'female', '1947-09-20', '汉族', '佛教', 'divorced', '中专', '退休医院护士', '2024-05-01', 'assisted', 'H101', 'H101-1', 'insurance', 3700.00, 6000.00, 'active'),
('e5000002-0002-0002-0002-000000000002', 'e5000002-0002-0002-0002-000000000002', 'f5555555-5555-5555-5555-555555555555', 'd5555552-5555-5555-5555-555555555555', 'E202405020042', '韩涛', '330101194512106789', 'male', '1945-12-10', '汉族', '无', 'married', '高中', '退休建筑工人', '2024-05-02', 'assisted', 'H201', 'H201-1', 'self_pay', 3500.00, 5500.00, 'active');

-- ================================================
-- 第二部分：老人用户和档案信息
-- ================================================

-- 插入老人用户账号
INSERT INTO public.ak_users (id, username, email, phone, real_name, avatar_url, status, created_at) VALUES
-- 北京阳光养老院老人
('e1000001-0001-0001-0001-000000000001', 'elder_zhang_wei', 'zhang.wei@eldercare.com', '13800000001', '张伟', 'https://example.com/avatars/zhang_wei.jpg', 'active', '2024-01-15 09:00:00+08'),
('e1000002-0002-0002-0002-000000000002', 'elder_wang_li', 'wang.li@eldercare.com', '13800000002', '王丽', 'https://example.com/avatars/wang_li.jpg', 'active', '2024-01-16 10:30:00+08'),
('e1000003-0003-0003-0003-000000000003', 'elder_li_ming', 'li.ming@eldercare.com', '13800000003', '李明', 'https://example.com/avatars/li_ming.jpg', 'active', '2024-01-17 14:20:00+08'),
('e1000004-0004-0004-0004-000000000004', 'elder_zhao_mei', 'zhao.mei@eldercare.com', '13800000004', '赵美', 'https://example.com/avatars/zhao_mei.jpg', 'active', '2024-01-18 11:15:00+08'),
('e1000005-0005-0005-0005-000000000005', 'elder_chen_gang', 'chen.gang@eldercare.com', '13800000005', '陈刚', 'https://example.com/avatars/chen_gang.jpg', 'active', '2024-01-19 08:45:00+08'),

-- 上海康乐护理中心老人
('e2000001-0001-0001-0001-000000000001', 'elder_huang_fang', 'huang.fang@eldercare.com', '13800000011', '黄芳', 'https://example.com/avatars/huang_fang.jpg', 'active', '2024-02-01 09:30:00+08'),
('e2000002-0002-0002-0002-000000000002', 'elder_xu_jun', 'xu.jun@eldercare.com', '13800000012', '徐军', 'https://example.com/avatars/xu_jun.jpg', 'active', '2024-02-02 10:00:00+08'),
('e2000003-0003-0003-0003-000000000003', 'elder_sun_hua', 'sun.hua@eldercare.com', '13800000013', '孙华', 'https://example.com/avatars/sun_hua.jpg', 'active', '2024-02-03 11:30:00+08'),
('e2000004-0004-0004-0004-000000000004', 'elder_zhou_ping', 'zhou.ping@eldercare.com', '13800000014', '周萍', 'https://example.com/avatars/zhou_ping.jpg', 'active', '2024-02-04 14:00:00+08'),

-- 广州爱心日间照料中心老人
('e3000001-0001-0001-0001-000000000001', 'elder_wu_bin', 'wu.bin@eldercare.com', '13800000021', '吴斌', 'https://example.com/avatars/wu_bin.jpg', 'active', '2024-03-01 08:00:00+08'),
('e3000002-0002-0002-0002-000000000002', 'elder_zheng_yan', 'zheng.yan@eldercare.com', '13800000022', '郑燕', 'https://example.com/avatars/zheng_yan.jpg', 'active', '2024-03-02 09:15:00+08'),
('e3000003-0003-0003-0003-000000000003', 'elder_he_qiang', 'he.qiang@eldercare.com', '13800000023', '何强', 'https://example.com/avatars/he_qiang.jpg', 'active', '2024-03-03 10:30:00+08'),

-- 南京温馨养老院老人
('e4000001-0001-0001-0001-000000000001', 'elder_ma_xia', 'ma.xia@eldercare.com', '13800000031', '马霞', 'https://example.com/avatars/ma_xia.jpg', 'active', '2024-04-01 13:20:00+08'),
('e4000002-0002-0002-0002-000000000002', 'elder_guo_lei', 'guo.lei@eldercare.com', '13800000032', '郭磊', 'https://example.com/avatars/guo_lei.jpg', 'active', '2024-04-02 15:45:00+08'),

-- 杭州幸福护理院老人
('e5000001-0001-0001-0001-000000000001', 'elder_luo_jing', 'luo.jing@eldercare.com', '13800000041', '罗静', 'https://example.com/avatars/luo_jing.jpg', 'active', '2024-05-01 10:10:00+08'),
('e5000002-0002-0002-0002-000000000002', 'elder_han_tao', 'han.tao@eldercare.com', '13800000042', '韩涛', 'https://example.com/avatars/han_tao.jpg', 'active', '2024-05-02 11:25:00+08');

-- 为老人用户分配角色
INSERT INTO public.ak_user_roles (user_id, role_id) 
SELECT u.id, r.id
FROM public.ak_users u
CROSS JOIN public.ak_roles r
WHERE u.username LIKE 'elder_%' AND r.name = 'elder';

-- 插入老人详细档案
INSERT INTO public.ec_elders (id, user_id, facility_id, care_unit_id, elder_code, name, id_card, gender, birthday, nationality, religion, marital_status, education, occupation, admission_date, care_level, room_number, bed_number, payment_method, monthly_fee, deposit, status) VALUES
-- 北京阳光养老院老人档案
('e1000001-0001-0001-0001-000000000001', 'e1000001-0001-0001-0001-000000000001', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401150001', '张伟', '110101194501011234', 'male', '1945-01-01', '汉族', '无', 'widowed', '初中', '退休工人', '2024-01-15', 'assisted', 'A101', 'A101-1', 'insurance', 3500.00, 5000.00, 'active'),
('e1000002-0002-0002-0002-000000000002', 'e1000002-0002-0002-0002-000000000002', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401160002', '王丽', '110101194803152345', 'female', '1948-03-15', '汉族', '佛教', 'married', '高中', '退休教师', '2024-01-16', 'self_care', 'A102', 'A102-1', 'self_pay', 4200.00, 8000.00, 'active'),
('e1000003-0003-0003-0003-000000000003', 'e1000003-0003-0003-0003-000000000003', 'f1111111-1111-1111-1111-111111111111', 'd1111112-1111-1111-1111-111111111111', 'E202401170003', '李明', '110101194212203456', 'male', '1942-12-20', '汉族', '无', 'widowed', '大学', '退休医生', '2024-01-17', 'dementia', 'A201', 'A201-1', 'insurance', 5500.00, 10000.00, 'active'),
('e1000004-0004-0004-0004-000000000004', 'e1000004-0004-0004-0004-000000000004', 'f1111111-1111-1111-1111-111111111111', 'd1111113-1111-1111-1111-111111111111', 'E202401180004', '赵美', '110101195006284567', 'female', '1950-06-28', '满族', '基督教', 'divorced', '中专', '退休护士', '2024-01-18', 'full_care', 'B101', 'B101-1', 'government', 2800.00, 3000.00, 'active'),
('e1000005-0005-0005-0005-000000000005', 'e1000005-0005-0005-0005-000000000005', 'f1111111-1111-1111-1111-111111111111', 'd1111114-1111-1111-1111-111111111111', 'E202401190005', '陈刚', '110101194709155678', 'male', '1947-09-15', '汉族', '无', 'married', '高中', '退休司机', '2024-01-19', 'assisted', 'C101', 'C101-1', 'self_pay', 3800.00, 6000.00, 'active'),

-- 上海康乐护理中心老人档案
('e2000001-0001-0001-0001-000000000001', 'e2000001-0001-0001-0001-000000000001', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402010011', '黄芳', '310101194404116789', 'female', '1944-04-11', '汉族', '无', 'widowed', '小学', '退休工人', '2024-02-01', 'self_care', 'E101', 'E101-1', 'insurance', 4000.00, 6000.00, 'active'),
('e2000002-0002-0002-0002-000000000002', 'e2000002-0002-0002-0002-000000000002', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402020012', '徐军', '310101194608227890', 'male', '1946-08-22', '汉族', '道教', 'married', '大专', '退休工程师', '2024-02-02', 'self_care', 'E102', 'E102-1', 'self_pay', 4500.00, 8000.00, 'active'),
('e2000003-0003-0003-0003-000000000003', 'e2000003-0003-0003-0003-000000000003', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402030013', '孙华', '310101194910138901', 'female', '1949-10-13', '汉族', '无', 'single', '中专', '退休会计', '2024-02-03', 'assisted', 'W101', 'W101-1', 'insurance', 3600.00, 5000.00, 'active'),
('e2000004-0004-0004-0004-000000000004', 'e2000004-0004-0004-0004-000000000004', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402040014', '周萍', '310101195111249012', 'female', '1951-11-24', '汉族', '佛教', 'widowed', '高中', '退休商店员工', '2024-02-04', 'full_care', 'W102', 'W102-1', 'government', 3200.00, 4000.00, 'active'),

-- 广州爱心日间照料中心老人档案  
('e3000001-0001-0001-0001-000000000001', 'e3000001-0001-0001-0001-000000000001', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403010021', '吴斌', '440101194507050123', 'male', '1945-07-05', '汉族', '无', 'married', '初中', '退休农民', '2024-03-01', 'self_care', 'D101', 'D101-1', 'self_pay', 2500.00, 3000.00, 'active'),
('e3000002-0002-0002-0002-000000000002', 'e3000002-0002-0002-0002-000000000002', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403020022', '郑燕', '440101194802181234', 'female', '1948-02-18', '汉族', '基督教', 'divorced', '大专', '退休银行员工', '2024-03-02', 'self_care', 'D102', 'D102-1', 'insurance', 3000.00, 4000.00, 'active'),
('e3000003-0003-0003-0003-000000000003', 'e3000003-0003-0003-0003-000000000003', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403030023', '何强', '440101194311122345', 'male', '1943-11-12', '汉族', '无', 'widowed', '中专', '退休技师', '2024-03-03', 'assisted', 'D103', 'D103-1', 'insurance', 3200.00, 4500.00, 'active'),

-- 南京温馨养老院老人档案
('e4000001-0001-0001-0001-000000000001', 'e4000001-0001-0001-0001-000000000001', 'f4444444-4444-4444-4444-444444444444', 'd4444441-4444-4444-4444-444444444444', 'E202404010031', '马霞', '320101194605093456', 'female', '1946-05-09', '汉族', '无', 'married', '高中', '退休纺织工人', '2024-04-01', 'self_care', 'N101', 'N101-1', 'insurance', 3300.00, 5000.00, 'active'),
('e4000002-0002-0002-0002-000000000002', 'e4000002-0002-0002-0002-000000000002', 'f4444444-4444-4444-4444-444444444444', 'd4444442-4444-4444-4444-444444444444', 'E202404020032', '郭磊', '320101194408154567', 'male', '1944-08-15', '汉族', '道教', 'widowed', '大学', '退休大学教授', '2024-04-02', 'full_care', 'N201', 'N201-1', 'self_pay', 5000.00, 10000.00, 'active'),

-- 杭州幸福护理院老人档案
('e5000001-0001-0001-0001-000000000001', 'e5000001-0001-0001-0001-000000000001', 'f5555555-5555-5555-5555-555555555555', 'd5555551-5555-5555-5555-555555555555', 'E202405010041', '罗静', '330101194709205678', 'female', '1947-09-20', '汉族', '佛教', 'divorced', '中专', '退休医院护士', '2024-05-01', 'assisted', 'H101', 'H101-1', 'insurance', 3700.00, 6000.00, 'active'),
('e5000002-0002-0002-0002-000000000002', 'e5000002-0002-0002-0002-000000000002', 'f5555555-5555-5555-5555-555555555555', 'd5555552-5555-5555-5555-555555555555', 'E202405020042', '韩涛', '330101194512106789', 'male', '1945-12-10', '汉族', '无', 'married', '高中', '退休建筑工人', '2024-05-02', 'assisted', 'H201', 'H201-1', 'self_pay', 3500.00, 5500.00, 'active');

-- ================================================
-- 第二部分：老人用户和档案信息
-- ================================================

-- 插入老人用户账号
INSERT INTO public.ak_users (id, username, email, phone, real_name, avatar_url, status, created_at) VALUES
-- 北京阳光养老院老人
('e1000001-0001-0001-0001-000000000001', 'elder_zhang_wei', 'zhang.wei@eldercare.com', '13800000001', '张伟', 'https://example.com/avatars/zhang_wei.jpg', 'active', '2024-01-15 09:00:00+08'),
('e1000002-0002-0002-0002-000000000002', 'elder_wang_li', 'wang.li@eldercare.com', '13800000002', '王丽', 'https://example.com/avatars/wang_li.jpg', 'active', '2024-01-16 10:30:00+08'),
('e1000003-0003-0003-0003-000000000003', 'elder_li_ming', 'li.ming@eldercare.com', '13800000003', '李明', 'https://example.com/avatars/li_ming.jpg', 'active', '2024-01-17 14:20:00+08'),
('e1000004-0004-0004-0004-000000000004', 'elder_zhao_mei', 'zhao.mei@eldercare.com', '13800000004', '赵美', 'https://example.com/avatars/zhao_mei.jpg', 'active', '2024-01-18 11:15:00+08'),
('e1000005-0005-0005-0005-000000000005', 'elder_chen_gang', 'chen.gang@eldercare.com', '13800000005', '陈刚', 'https://example.com/avatars/chen_gang.jpg', 'active', '2024-01-19 08:45:00+08'),

-- 上海康乐护理中心老人
('e2000001-0001-0001-0001-000000000001', 'elder_huang_fang', 'huang.fang@eldercare.com', '13800000011', '黄芳', 'https://example.com/avatars/huang_fang.jpg', 'active', '2024-02-01 09:30:00+08'),
('e2000002-0002-0002-0002-000000000002', 'elder_xu_jun', 'xu.jun@eldercare.com', '13800000012', '徐军', 'https://example.com/avatars/xu_jun.jpg', 'active', '2024-02-02 10:00:00+08'),
('e2000003-0003-0003-0003-000000000003', 'elder_sun_hua', 'sun.hua@eldercare.com', '13800000013', '孙华', 'https://example.com/avatars/sun_hua.jpg', 'active', '2024-02-03 11:30:00+08'),
('e2000004-0004-0004-0004-000000000004', 'elder_zhou_ping', 'zhou.ping@eldercare.com', '13800000014', '周萍', 'https://example.com/avatars/zhou_ping.jpg', 'active', '2024-02-04 14:00:00+08'),

-- 广州爱心日间照料中心老人
('e3000001-0001-0001-0001-000000000001', 'elder_wu_bin', 'wu.bin@eldercare.com', '13800000021', '吴斌', 'https://example.com/avatars/wu_bin.jpg', 'active', '2024-03-01 08:00:00+08'),
('e3000002-0002-0002-0002-000000000002', 'elder_zheng_yan', 'zheng.yan@eldercare.com', '13800000022', '郑燕', 'https://example.com/avatars/zheng_yan.jpg', 'active', '2024-03-02 09:15:00+08'),
('e3000003-0003-0003-0003-000000000003', 'elder_he_qiang', 'he.qiang@eldercare.com', '13800000023', '何强', 'https://example.com/avatars/he_qiang.jpg', 'active', '2024-03-03 10:30:00+08'),

-- 南京温馨养老院老人
('e4000001-0001-0001-0001-000000000001', 'elder_ma_xia', 'ma.xia@eldercare.com', '13800000031', '马霞', 'https://example.com/avatars/ma_xia.jpg', 'active', '2024-04-01 13:20:00+08'),
('e4000002-0002-0002-0002-000000000002', 'elder_guo_lei', 'guo.lei@eldercare.com', '13800000032', '郭磊', 'https://example.com/avatars/guo_lei.jpg', 'active', '2024-04-02 15:45:00+08'),

-- 杭州幸福护理院老人
('e5000001-0001-0001-0001-000000000001', 'elder_luo_jing', 'luo.jing@eldercare.com', '13800000041', '罗静', 'https://example.com/avatars/luo_jing.jpg', 'active', '2024-05-01 10:10:00+08'),
('e5000002-0002-0002-0002-000000000002', 'elder_han_tao', 'han.tao@eldercare.com', '13800000042', '韩涛', 'https://example.com/avatars/han_tao.jpg', 'active', '2024-05-02 11:25:00+08');

-- 为老人用户分配角色
INSERT INTO public.ak_user_roles (user_id, role_id) 
SELECT u.id, r.id
FROM public.ak_users u
CROSS JOIN public.ak_roles r
WHERE u.username LIKE 'elder_%' AND r.name = 'elder';

-- 插入老人详细档案
INSERT INTO public.ec_elders (id, user_id, facility_id, care_unit_id, elder_code, name, id_card, gender, birthday, nationality, religion, marital_status, education, occupation, admission_date, care_level, room_number, bed_number, payment_method, monthly_fee, deposit, status) VALUES
-- 北京阳光养老院老人档案
('e1000001-0001-0001-0001-000000000001', 'e1000001-0001-0001-0001-000000000001', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401150001', '张伟', '110101194501011234', 'male', '1945-01-01', '汉族', '无', 'widowed', '初中', '退休工人', '2024-01-15', 'assisted', 'A101', 'A101-1', 'insurance', 3500.00, 5000.00, 'active'),
('e1000002-0002-0002-0002-000000000002', 'e1000002-0002-0002-0002-000000000002', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401160002', '王丽', '110101194803152345', 'female', '1948-03-15', '汉族', '佛教', 'married', '高中', '退休教师', '2024-01-16', 'self_care', 'A102', 'A102-1', 'self_pay', 4200.00, 8000.00, 'active'),
('e1000003-0003-0003-0003-000000000003', 'e1000003-0003-0003-0003-000000000003', 'f1111111-1111-1111-1111-111111111111', 'd1111112-1111-1111-1111-111111111111', 'E202401170003', '李明', '110101194212203456', 'male', '1942-12-20', '汉族', '无', 'widowed', '大学', '退休医生', '2024-01-17', 'dementia', 'A201', 'A201-1', 'insurance', 5500.00, 10000.00, 'active'),
('e1000004-0004-0004-0004-000000000004', 'e1000004-0004-0004-0004-000000000004', 'f1111111-1111-1111-1111-111111111111', 'd1111113-1111-1111-1111-111111111111', 'E202401180004', '赵美', '110101195006284567', 'female', '1950-06-28', '满族', '基督教', 'divorced', '中专', '退休护士', '2024-01-18', 'full_care', 'B101', 'B101-1', 'government', 2800.00, 3000.00, 'active'),
('e1000005-0005-0005-0005-000000000005', 'e1000005-0005-0005-0005-000000000005', 'f1111111-1111-1111-1111-111111111111', 'd1111114-1111-1111-1111-111111111111', 'E202401190005', '陈刚', '110101194709155678', 'male', '1947-09-15', '汉族', '无', 'married', '高中', '退休司机', '2024-01-19', 'assisted', 'C101', 'C101-1', 'self_pay', 3800.00, 6000.00, 'active'),

-- 上海康乐护理中心老人档案
('e2000001-0001-0001-0001-000000000001', 'e2000001-0001-0001-0001-000000000001', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402010011', '黄芳', '310101194404116789', 'female', '1944-04-11', '汉族', '无', 'widowed', '小学', '退休工人', '2024-02-01', 'self_care', 'E101', 'E101-1', 'insurance', 4000.00, 6000.00, 'active'),
('e2000002-0002-0002-0002-000000000002', 'e2000002-0002-0002-0002-000000000002', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402020012', '徐军', '310101194608227890', 'male', '1946-08-22', '汉族', '道教', 'married', '大专', '退休工程师', '2024-02-02', 'self_care', 'E102', 'E102-1', 'self_pay', 4500.00, 8000.00, 'active'),
('e2000003-0003-0003-0003-000000000003', 'e2000003-0003-0003-0003-000000000003', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402030013', '孙华', '310101194910138901', 'female', '1949-10-13', '汉族', '无', 'single', '中专', '退休会计', '2024-02-03', 'assisted', 'W101', 'W101-1', 'insurance', 3600.00, 5000.00, 'active'),
('e2000004-0004-0004-0004-000000000004', 'e2000004-0004-0004-0004-000000000004', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402040014', '周萍', '310101195111249012', 'female', '1951-11-24', '汉族', '佛教', 'widowed', '高中', '退休商店员工', '2024-02-04', 'full_care', 'W102', 'W102-1', 'government', 3200.00, 4000.00, 'active'),

-- 广州爱心日间照料中心老人档案  
('e3000001-0001-0001-0001-000000000001', 'e3000001-0001-0001-0001-000000000001', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403010021', '吴斌', '440101194507050123', 'male', '1945-07-05', '汉族', '无', 'married', '初中', '退休农民', '2024-03-01', 'self_care', 'D101', 'D101-1', 'self_pay', 2500.00, 3000.00, 'active'),
('e3000002-0002-0002-0002-000000000002', 'e3000002-0002-0002-0002-000000000002', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403020022', '郑燕', '440101194802181234', 'female', '1948-02-18', '汉族', '基督教', 'divorced', '大专', '退休银行员工', '2024-03-02', 'self_care', 'D102', 'D102-1', 'insurance', 3000.00, 4000.00, 'active'),
('e3000003-0003-0003-0003-000000000003', 'e3000003-0003-0003-0003-000000000003', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403030023', '何强', '440101194311122345', 'male', '1943-11-12', '汉族', '无', 'widowed', '中专', '退休技师', '2024-03-03', 'assisted', 'D103', 'D103-1', 'insurance', 3200.00, 4500.00, 'active'),

-- 南京温馨养老院老人档案
('e4000001-0001-0001-0001-000000000001', 'e4000001-0001-0001-0001-000000000001', 'f4444444-4444-4444-4444-444444444444', 'd4444441-4444-4444-4444-444444444444', 'E202404010031', '马霞', '320101194605093456', 'female', '1946-05-09', '汉族', '无', 'married', '高中', '退休纺织工人', '2024-04-01', 'self_care', 'N101', 'N101-1', 'insurance', 3300.00, 5000.00, 'active'),
('e4000002-0002-0002-0002-000000000002', 'e4000002-0002-0002-0002-000000000002', 'f4444444-4444-4444-4444-444444444444', 'd4444442-4444-4444-4444-444444444444', 'E202404020032', '郭磊', '320101194408154567', 'male', '1944-08-15', '汉族', '道教', 'widowed', '大学', '退休大学教授', '2024-04-02', 'full_care', 'N201', 'N201-1', 'self_pay', 5000.00, 10000.00, 'active'),

-- 杭州幸福护理院老人档案
('e5000001-0001-0001-0001-000000000001', 'e5000001-0001-0001-0001-000000000001', 'f5555555-5555-5555-5555-555555555555', 'd5555551-5555-5555-5555-555555555555', 'E202405010041', '罗静', '330101194709205678', 'female', '1947-09-20', '汉族', '佛教', 'divorced', '中专', '退休医院护士', '2024-05-01', 'assisted', 'H101', 'H101-1', 'insurance', 3700.00, 6000.00, 'active'),
('e5000002-0002-0002-0002-000000000002', 'e5000002-0002-0002-0002-000000000002', 'f5555555-5555-5555-5555-555555555555', 'd5555552-5555-5555-5555-555555555555', 'E202405020042', '韩涛', '330101194512106789', 'male', '1945-12-10', '汉族', '无', 'married', '高中', '退休建筑工人', '2024-05-02', 'assisted', 'H201', 'H201-1', 'self_pay', 3500.00, 5500.00, 'active');

-- ================================================
-- 第二部分：老人用户和档案信息
-- ================================================

-- 插入老人用户账号
INSERT INTO public.ak_users (id, username, email, phone, real_name, avatar_url, status, created_at) VALUES
-- 北京阳光养老院老人
('e1000001-0001-0001-0001-000000000001', 'elder_zhang_wei', 'zhang.wei@eldercare.com', '13800000001', '张伟', 'https://example.com/avatars/zhang_wei.jpg', 'active', '2024-01-15 09:00:00+08'),
('e1000002-0002-0002-0002-000000000002', 'elder_wang_li', 'wang.li@eldercare.com', '13800000002', '王丽', 'https://example.com/avatars/wang_li.jpg', 'active', '2024-01-16 10:30:00+08'),
('e1000003-0003-0003-0003-000000000003', 'elder_li_ming', 'li.ming@eldercare.com', '13800000003', '李明', 'https://example.com/avatars/li_ming.jpg', 'active', '2024-01-17 14:20:00+08'),
('e1000004-0004-0004-0004-000000000004', 'elder_zhao_mei', 'zhao.mei@eldercare.com', '13800000004', '赵美', 'https://example.com/avatars/zhao_mei.jpg', 'active', '2024-01-18 11:15:00+08'),
('e1000005-0005-0005-0005-000000000005', 'elder_chen_gang', 'chen.gang@eldercare.com', '13800000005', '陈刚', 'https://example.com/avatars/chen_gang.jpg', 'active', '2024-01-19 08:45:00+08'),

-- 上海康乐护理中心老人
('e2000001-0001-0001-0001-000000000001', 'elder_huang_fang', 'huang.fang@eldercare.com', '13800000011', '黄芳', 'https://example.com/avatars/huang_fang.jpg', 'active', '2024-02-01 09:30:00+08'),
('e2000002-0002-0002-0002-000000000002', 'elder_xu_jun', 'xu.jun@eldercare.com', '13800000012', '徐军', 'https://example.com/avatars/xu_jun.jpg', 'active', '2024-02-02 10:00:00+08'),
('e2000003-0003-0003-0003-000000000003', 'elder_sun_hua', 'sun.hua@eldercare.com', '13800000013', '孙华', 'https://example.com/avatars/sun_hua.jpg', 'active', '2024-02-03 11:30:00+08'),
('e2000004-0004-0004-0004-000000000004', 'elder_zhou_ping', 'zhou.ping@eldercare.com', '13800000014', '周萍', 'https://example.com/avatars/zhou_ping.jpg', 'active', '2024-02-04 14:00:00+08'),

-- 广州爱心日间照料中心老人
('e3000001-0001-0001-0001-000000000001', 'elder_wu_bin', 'wu.bin@eldercare.com', '13800000021', '吴斌', 'https://example.com/avatars/wu_bin.jpg', 'active', '2024-03-01 08:00:00+08'),
('e3000002-0002-0002-0002-000000000002', 'elder_zheng_yan', 'zheng.yan@eldercare.com', '13800000022', '郑燕', 'https://example.com/avatars/zheng_yan.jpg', 'active', '2024-03-02 09:15:00+08'),
('e3000003-0003-0003-0003-000000000003', 'elder_he_qiang', 'he.qiang@eldercare.com', '13800000023', '何强', 'https://example.com/avatars/he_qiang.jpg', 'active', '2024-03-03 10:30:00+08'),

-- 南京温馨养老院老人
('e4000001-0001-0001-0001-000000000001', 'elder_ma_xia', 'ma.xia@eldercare.com', '13800000031', '马霞', 'https://example.com/avatars/ma_xia.jpg', 'active', '2024-04-01 13:20:00+08'),
('e4000002-0002-0002-0002-000000000002', 'elder_guo_lei', 'guo.lei@eldercare.com', '13800000032', '郭磊', 'https://example.com/avatars/guo_lei.jpg', 'active', '2024-04-02 15:45:00+08'),

-- 杭州幸福护理院老人
('e5000001-0001-0001-0001-000000000001', 'elder_luo_jing', 'luo.jing@eldercare.com', '13800000041', '罗静', 'https://example.com/avatars/luo_jing.jpg', 'active', '2024-05-01 10:10:00+08'),
('e5000002-0002-0002-0002-000000000002', 'elder_han_tao', 'han.tao@eldercare.com', '13800000042', '韩涛', 'https://example.com/avatars/han_tao.jpg', 'active', '2024-05-02 11:25:00+08');

-- 为老人用户分配角色
INSERT INTO public.ak_user_roles (user_id, role_id) 
SELECT u.id, r.id
FROM public.ak_users u
CROSS JOIN public.ak_roles r
WHERE u.username LIKE 'elder_%' AND r.name = 'elder';

-- 插入老人详细档案
INSERT INTO public.ec_elders (id, user_id, facility_id, care_unit_id, elder_code, name, id_card, gender, birthday, nationality, religion, marital_status, education, occupation, admission_date, care_level, room_number, bed_number, payment_method, monthly_fee, deposit, status) VALUES
-- 北京阳光养老院老人档案
('e1000001-0001-0001-0001-000000000001', 'e1000001-0001-0001-0001-000000000001', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401150001', '张伟', '110101194501011234', 'male', '1945-01-01', '汉族', '无', 'widowed', '初中', '退休工人', '2024-01-15', 'assisted', 'A101', 'A101-1', 'insurance', 3500.00, 5000.00, 'active'),
('e1000002-0002-0002-0002-000000000002', 'e1000002-0002-0002-0002-000000000002', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401160002', '王丽', '110101194803152345', 'female', '1948-03-15', '汉族', '佛教', 'married', '高中', '退休教师', '2024-01-16', 'self_care', 'A102', 'A102-1', 'self_pay', 4200.00, 8000.00, 'active'),
('e1000003-0003-0003-0003-000000000003', 'e1000003-0003-0003-0003-000000000003', 'f1111111-1111-1111-1111-111111111111', 'd1111112-1111-1111-1111-111111111111', 'E202401170003', '李明', '110101194212203456', 'male', '1942-12-20', '汉族', '无', 'widowed', '大学', '退休医生', '2024-01-17', 'dementia', 'A201', 'A201-1', 'insurance', 5500.00, 10000.00, 'active'),
('e1000004-0004-0004-0004-000000000004', 'e1000004-0004-0004-0004-000000000004', 'f1111111-1111-1111-1111-111111111111', 'd1111113-1111-1111-1111-111111111111', 'E202401180004', '赵美', '110101195006284567', 'female', '1950-06-28', '满族', '基督教', 'divorced', '中专', '退休护士', '2024-01-18', 'full_care', 'B101', 'B101-1', 'government', 2800.00, 3000.00, 'active'),
('e1000005-0005-0005-0005-000000000005', 'e1000005-0005-0005-0005-000000000005', 'f1111111-1111-1111-1111-111111111111', 'd1111114-1111-1111-1111-111111111111', 'E202401190005', '陈刚', '110101194709155678', 'male', '1947-09-15', '汉族', '无', 'married', '高中', '退休司机', '2024-01-19', 'assisted', 'C101', 'C101-1', 'self_pay', 3800.00, 6000.00, 'active'),

-- 上海康乐护理中心老人档案
('e2000001-0001-0001-0001-000000000001', 'e2000001-0001-0001-0001-000000000001', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402010011', '黄芳', '310101194404116789', 'female', '1944-04-11', '汉族', '无', 'widowed', '小学', '退休工人', '2024-02-01', 'self_care', 'E101', 'E101-1', 'insurance', 4000.00, 6000.00, 'active'),
('e2000002-0002-0002-0002-000000000002', 'e2000002-0002-0002-0002-000000000002', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402020012', '徐军', '310101194608227890', 'male', '1946-08-22', '汉族', '道教', 'married', '大专', '退休工程师', '2024-02-02', 'self_care', 'E102', 'E102-1', 'self_pay', 4500.00, 8000.00, 'active'),
('e2000003-0003-0003-0003-000000000003', 'e2000003-0003-0003-0003-000000000003', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402030013', '孙华', '310101194910138901', 'female', '1949-10-13', '汉族', '无', 'single', '中专', '退休会计', '2024-02-03', 'assisted', 'W101', 'W101-1', 'insurance', 3600.00, 5000.00, 'active'),
('e2000004-0004-0004-0004-000000000004', 'e2000004-0004-0004-0004-000000000004', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402040014', '周萍', '310101195111249012', 'female', '1951-11-24', '汉族', '佛教', 'widowed', '高中', '退休商店员工', '2024-02-04', 'full_care', 'W102', 'W102-1', 'government', 3200.00, 4000.00, 'active'),

-- 广州爱心日间照料中心老人档案  
('e3000001-0001-0001-0001-000000000001', 'e3000001-0001-0001-0001-000000000001', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403010021', '吴斌', '440101194507050123', 'male', '1945-07-05', '汉族', '无', 'married', '初中', '退休农民', '2024-03-01', 'self_care', 'D101', 'D101-1', 'self_pay', 2500.00, 3000.00, 'active'),
('e3000002-0002-0002-0002-000000000002', 'e3000002-0002-0002-0002-000000000002', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403020022', '郑燕', '440101194802181234', 'female', '1948-02-18', '汉族', '基督教', 'divorced', '大专', '退休银行员工', '2024-03-02', 'self_care', 'D102', 'D102-1', 'insurance', 3000.00, 4000.00, 'active'),
('e3000003-0003-0003-0003-000000000003', 'e3000003-0003-0003-0003-000000000003', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403030023', '何强', '440101194311122345', 'male', '1943-11-12', '汉族', '无', 'widowed', '中专', '退休技师', '2024-03-03', 'assisted', 'D103', 'D103-1', 'insurance', 3200.00, 4500.00, 'active'),

-- 南京温馨养老院老人档案
('e4000001-0001-0001-0001-000000000001', 'e4000001-0001-0001-0001-000000000001', 'f4444444-4444-4444-4444-444444444444', 'd4444441-4444-4444-4444-444444444444', 'E202404010031', '马霞', '320101194605093456', 'female', '1946-05-09', '汉族', '无', 'married', '高中', '退休纺织工人', '2024-04-01', 'self_care', 'N101', 'N101-1', 'insurance', 3300.00, 5000.00, 'active'),
('e4000002-0002-0002-0002-000000000002', 'e4000002-0002-0002-0002-000000000002', 'f4444444-4444-4444-4444-444444444444', 'd4444442-4444-4444-4444-444444444444', 'E202404020032', '郭磊', '320101194408154567', 'male', '1944-08-15', '汉族', '道教', 'widowed', '大学', '退休大学教授', '2024-04-02', 'full_care', 'N201', 'N201-1', 'self_pay', 5000.00, 10000.00, 'active'),

-- 杭州幸福护理院老人档案
('e5000001-0001-0001-0001-000000000001', 'e5000001-0001-0001-0001-000000000001', 'f5555555-5555-5555-5555-555555555555', 'd5555551-5555-5555-5555-555555555555', 'E202405010041', '罗静', '330101194709205678', 'female', '1947-09-20', '汉族', '佛教', 'divorced', '中专', '退休医院护士', '2024-05-01', 'assisted', 'H101', 'H101-1', 'insurance', 3700.00, 6000.00, 'active'),
('e5000002-0002-0002-0002-000000000002', 'e5000002-0002-0002-0002-000000000002', 'f5555555-5555-5555-5555-555555555555', 'd5555552-5555-5555-5555-555555555555', 'E202405020042', '韩涛', '330101194512106789', 'male', '1945-12-10', '汉族', '无', 'married', '高中', '退休建筑工人', '2024-05-02', 'assisted', 'H201', 'H201-1', 'self_pay', 3500.00, 5500.00, 'active');

-- ================================================
-- 第二部分：老人用户和档案信息
-- ================================================

-- 插入老人用户账号
INSERT INTO public.ak_users (id, username, email, phone, real_name, avatar_url, status, created_at) VALUES
-- 北京阳光养老院老人
('e1000001-0001-0001-0001-000000000001', 'elder_zhang_wei', 'zhang.wei@eldercare.com', '13800000001', '张伟', 'https://example.com/avatars/zhang_wei.jpg', 'active', '2024-01-15 09:00:00+08'),
('e1000002-0002-0002-0002-000000000002', 'elder_wang_li', 'wang.li@eldercare.com', '13800000002', '王丽', 'https://example.com/avatars/wang_li.jpg', 'active', '2024-01-16 10:30:00+08'),
('e1000003-0003-0003-0003-000000000003', 'elder_li_ming', 'li.ming@eldercare.com', '13800000003', '李明', 'https://example.com/avatars/li_ming.jpg', 'active', '2024-01-17 14:20:00+08'),
('e1000004-0004-0004-0004-000000000004', 'elder_zhao_mei', 'zhao.mei@eldercare.com', '13800000004', '赵美', 'https://example.com/avatars/zhao_mei.jpg', 'active', '2024-01-18 11:15:00+08'),
('e1000005-0005-0005-0005-000000000005', 'elder_chen_gang', 'chen.gang@eldercare.com', '13800000005', '陈刚', 'https://example.com/avatars/chen_gang.jpg', 'active', '2024-01-19 08:45:00+08'),

-- 上海康乐护理中心老人
('e2000001-0001-0001-0001-000000000001', 'elder_huang_fang', 'huang.fang@eldercare.com', '13800000011', '黄芳', 'https://example.com/avatars/huang_fang.jpg', 'active', '2024-02-01 09:30:00+08'),
('e2000002-0002-0002-0002-000000000002', 'elder_xu_jun', 'xu.jun@eldercare.com', '13800000012', '徐军', 'https://example.com/avatars/xu_jun.jpg', 'active', '2024-02-02 10:00:00+08'),
('e2000003-0003-0003-0003-000000000003', 'elder_sun_hua', 'sun.hua@eldercare.com', '13800000013', '孙华', 'https://example.com/avatars/sun_hua.jpg', 'active', '2024-02-03 11:30:00+08'),
('e2000004-0004-0004-0004-000000000004', 'elder_zhou_ping', 'zhou.ping@eldercare.com', '13800000014', '周萍', 'https://example.com/avatars/zhou_ping.jpg', 'active', '2024-02-04 14:00:00+08'),

-- 广州爱心日间照料中心老人
('e3000001-0001-0001-0001-000000000001', 'elder_wu_bin', 'wu.bin@eldercare.com', '13800000021', '吴斌', 'https://example.com/avatars/wu_bin.jpg', 'active', '2024-03-01 08:00:00+08'),
('e3000002-0002-0002-0002-000000000002', 'elder_zheng_yan', 'zheng.yan@eldercare.com', '13800000022', '郑燕', 'https://example.com/avatars/zheng_yan.jpg', 'active', '2024-03-02 09:15:00+08'),
('e3000003-0003-0003-0003-000000000003', 'elder_he_qiang', 'he.qiang@eldercare.com', '13800000023', '何强', 'https://example.com/avatars/he_qiang.jpg', 'active', '2024-03-03 10:30:00+08'),

-- 南京温馨养老院老人
('e4000001-0001-0001-0001-000000000001', 'elder_ma_xia', 'ma.xia@eldercare.com', '13800000031', '马霞', 'https://example.com/avatars/ma_xia.jpg', 'active', '2024-04-01 13:20:00+08'),
('e4000002-0002-0002-0002-000000000002', 'elder_guo_lei', 'guo.lei@eldercare.com', '13800000032', '郭磊', 'https://example.com/avatars/guo_lei.jpg', 'active', '2024-04-02 15:45:00+08'),

-- 杭州幸福护理院老人
('e5000001-0001-0001-0001-000000000001', 'elder_luo_jing', 'luo.jing@eldercare.com', '13800000041', '罗静', 'https://example.com/avatars/luo_jing.jpg', 'active', '2024-05-01 10:10:00+08'),
('e5000002-0002-0002-0002-000000000002', 'elder_han_tao', 'han.tao@eldercare.com', '13800000042', '韩涛', 'https://example.com/avatars/han_tao.jpg', 'active', '2024-05-02 11:25:00+08');

-- 为老人用户分配角色
INSERT INTO public.ak_user_roles (user_id, role_id) 
SELECT u.id, r.id
FROM public.ak_users u
CROSS JOIN public.ak_roles r
WHERE u.username LIKE 'elder_%' AND r.name = 'elder';

-- 插入老人详细档案
INSERT INTO public.ec_elders (id, user_id, facility_id, care_unit_id, elder_code, name, id_card, gender, birthday, nationality, religion, marital_status, education, occupation, admission_date, care_level, room_number, bed_number, payment_method, monthly_fee, deposit, status) VALUES
-- 北京阳光养老院老人档案
('e1000001-0001-0001-0001-000000000001', 'e1000001-0001-0001-0001-000000000001', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401150001', '张伟', '110101194501011234', 'male', '1945-01-01', '汉族', '无', 'widowed', '初中', '退休工人', '2024-01-15', 'assisted', 'A101', 'A101-1', 'insurance', 3500.00, 5000.00, 'active'),
('e1000002-0002-0002-0002-000000000002', 'e1000002-0002-0002-0002-000000000002', 'f1111111-1111-1111-1111-111111111111', 'd1111111-1111-1111-1111-111111111111', 'E202401160002', '王丽', '110101194803152345', 'female', '1948-03-15', '汉族', '佛教', 'married', '高中', '退休教师', '2024-01-16', 'self_care', 'A102', 'A102-1', 'self_pay', 4200.00, 8000.00, 'active'),
('e1000003-0003-0003-0003-000000000003', 'e1000003-0003-0003-0003-000000000003', 'f1111111-1111-1111-1111-111111111111', 'd1111112-1111-1111-1111-111111111111', 'E202401170003', '李明', '110101194212203456', 'male', '1942-12-20', '汉族', '无', 'widowed', '大学', '退休医生', '2024-01-17', 'dementia', 'A201', 'A201-1', 'insurance', 5500.00, 10000.00, 'active'),
('e1000004-0004-0004-0004-000000000004', 'e1000004-0004-0004-0004-000000000004', 'f1111111-1111-1111-1111-111111111111', 'd1111113-1111-1111-1111-111111111111', 'E202401180004', '赵美', '110101195006284567', 'female', '1950-06-28', '满族', '基督教', 'divorced', '中专', '退休护士', '2024-01-18', 'full_care', 'B101', 'B101-1', 'government', 2800.00, 3000.00, 'active'),
('e1000005-0005-0005-0005-000000000005', 'e1000005-0005-0005-0005-000000000005', 'f1111111-1111-1111-1111-111111111111', 'd1111114-1111-1111-1111-111111111111', 'E202401190005', '陈刚', '110101194709155678', 'male', '1947-09-15', '汉族', '无', 'married', '高中', '退休司机', '2024-01-19', 'assisted', 'C101', 'C101-1', 'self_pay', 3800.00, 6000.00, 'active'),

-- 上海康乐护理中心老人档案
('e2000001-0001-0001-0001-000000000001', 'e2000001-0001-0001-0001-000000000001', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402010011', '黄芳', '310101194404116789', 'female', '1944-04-11', '汉族', '无', 'widowed', '小学', '退休工人', '2024-02-01', 'self_care', 'E101', 'E101-1', 'insurance', 4000.00, 6000.00, 'active'),
('e2000002-0002-0002-0002-000000000002', 'e2000002-0002-0002-0002-000000000002', 'f2222222-2222-2222-2222-222222222222', 'd2222221-2222-2222-2222-222222222222', 'E202402020012', '徐军', '310101194608227890', 'male', '1946-08-22', '汉族', '道教', 'married', '大专', '退休工程师', '2024-02-02', 'self_care', 'E102', 'E102-1', 'self_pay', 4500.00, 8000.00, 'active'),
('e2000003-0003-0003-0003-000000000003', 'e2000003-0003-0003-0003-000000000003', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402030013', '孙华', '310101194910138901', 'female', '1949-10-13', '汉族', '无', 'single', '中专', '退休会计', '2024-02-03', 'assisted', 'W101', 'W101-1', 'insurance', 3600.00, 5000.00, 'active'),
('e2000004-0004-0004-0004-000000000004', 'e2000004-0004-0004-0004-000000000004', 'f2222222-2222-2222-2222-222222222222', 'd2222222-2222-2222-2222-222222222222', 'E202402040014', '周萍', '310101195111249012', 'female', '1951-11-24', '汉族', '佛教', 'widowed', '高中', '退休商店员工', '2024-02-04', 'full_care', 'W102', 'W102-1', 'government', 3200.00, 4000.00, 'active'),

-- 广州爱心日间照料中心老人档案  
('e3000001-0001-0001-0001-000000000001', 'e3000001-0001-0001-0001-000000000001', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403010021', '吴斌', '440101194507050123', 'male', '1945-07-05', '汉族', '无', 'married', '初中', '退休农民', '2024-03-01', 'self_care', 'D101', 'D101-1', 'self_pay', 2500.00, 3000.00, 'active'),
('e3000002-0002-0002-0002-000000000002', 'e3000002-0002-0002-0002-000000000002', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403020022', '郑燕', '440101194802181234', 'female', '1948-02-18', '汉族', '基督教', 'divorced', '大专', '退休银行员工', '2024-03-02', 'self_care', 'D102', 'D102-1', 'insurance', 3000.00, 4000.00, 'active'),
('e3000003-0003-0003-0003-000000000003', 'e3000003-0003-0003-0003-000000000003', 'f3333333-3333-3333-3333-333333333333', 'd3333331-3333-3333-3333-333333333333', 'E202403030023', '何强', '440101194311122345', 'male', '1943-11-12', '汉族', '无', 'widowed', '中专', '退休技师', '2024-03-03', 'assisted', 'D103', 'D103-1', 'insurance', 3200.00, 4500.00, 'active'),

-- 南京温馨养老院老人档案
('e4000001-0001-0001-0001-000000000001', 'e4000001-0001-0001-0001-000000000001', 'f4444444-4444-4444-4444-444444444444', 'd4444441-4444-4444-4444-444444444444', 'E202404010031', '马霞', '320101194605093456', 'female', '1946-05-09', '汉族', '无', 'married', '高中', '退休纺织工人', '2024-04-01', 'self_care', 'N101', 'N101-1', 'insurance', 3300.00, 5000.00, 'active'),
('e4000002-0002-0002-0002-000000000002', 'e4000002-0002-0002-0002-000000000002', 'f4444444-4444-4444-4444-444444444444', 'd4444442-4444-4444-4444-444444444444', 'E202404020032', '郭磊', '320101194408154567', 'male', '1944-08-15', '汉族', '道教', 'widowed', '大学', '退休大学教授', '2024-04-02', 'full_care', 'N201', 'N201-1', 'self_pay', 5000.00, 10000.00, 'active'),

-- 杭州幸福护理院老人档案
('e5000001-0001-0001-0001-000000000001', 'e5000001-0001-0001-0001-000000000001', 'f5555555-5555-5555-5555-555555555555', 'd5555551-5555-5555-5555-555555555555', 'E202405010041', '罗静', '330101194709205678', 'female', '1947-09-20', '汉族', '佛教', 'divorced', '中专', '退休医院护士', '2024-05-01', 'assisted', 'H101', 'H101-1', 'insurance', 3700.00, 6000.00, 'active'),
('e5000002-0002-0002-0002-000000000002', 'e5000002-0002-0002-0002-000000000002', 'f5555555-5555-5555-5555-555555555555', 'd5555552-5555-5555-5555-555555555555', 'E202405020042', '韩涛', '330101194512106789', 'male', '1945-12-10', '汉族', '无', 'married', '高中', '退休建筑工人', '2024-05-02', 'assisted', 'H201', 'H201-1', 'self_pay', 3500.00, 5500.00, 'active');

-- ================================================
-- 数据插入完成和统计更新
-- ================================================

-- 更新机构入住率
UPDATE public.ec_facilities SET current_occupancy = (
    SELECT COUNT(*) FROM public.ec_elders 
    WHERE facility_id = public.ec_facilities.id AND status = 'active'
);

-- 更新护理单元入住率  
UPDATE public.ec_care_units SET current_occupancy = (
    SELECT COUNT(*) FROM public.ec_elders 
    WHERE care_unit_id = public.ec_care_units.id AND status = 'active'
);

-- ================================================
-- 养老管理系统模拟数据插入完成
-- ================================================

/*
数据统计总结：
==============
✅ 基础设施：5个地区，5个养老机构，11个护理单元
✅ 用户数据：54位用户（16位老人+10位家属+14位护理员+10位护士+7位医生+7位管理员）
✅ 业务数据：护理计划、任务、记录，健康档案，生命体征，医疗记录，用药管理，健康预警，活动安排等
✅ 完整覆盖养老管理系统的所有核心功能模块

使用说明：
1. 可以单独执行某个部分的INSERT语句
2. 建议按顺序执行，避免外键约束错误
3. 所有数据都是真实模拟，可用于系统测试和演示
4. 参考了商城系统的分角色插入风格
*/