รอ อ.mn ปรับปรุงให้ครับ
ผมเช็คได้ตามนี้ครับ
เอาไปแก้ขัดไปก่อนครับ
มีอยู่ 3 ไฟล์ที่ฟิวล์ไม่ครบ 11447 = คือรหัสสถานพยาบาลนะครับ
ที่เหลือใช้ได้ครบครับ
คำสั่งส่งออก ของ XXXXX-OPDDiag.csv------------------------------>
SELECT '11447' AS hospcode ,s.health_med_service_id ,
concat(g.health_med_organ_code,"-",t.health_med_operation_type_code,"-",i.health_med_operation_item_code)as operation_code,
d.service_price ,d.health_med_organ_id ,s.health_med_doctor_id ,
health_med_service_operation_time_minute ,'O' ,1
FROM health_med_service s
right outer join health_med_service_operation d
on(s.health_med_service_id=d.health_med_service_id)
left join health_med_operation_item i on d.health_med_operation_item_id= i.health_med_operation_item_id
left join health_med_operation_type t on t.health_med_operation_type_id=i.health_med_operation_type_id
left join health_med_organ g on g.health_med_organ_id=d.health_med_organ_id
where s.health_med_service_type_id=1
and s.service_date between '2010-03-01' and '2010-03-31'
--------------------------
คำสั่งส่งออกของ XXXXX-Doctor.csv -------------------->
SELECT '11447' AS hospcode ,health_med_doctor_id ,pname ,fname ,lname ,
license_number ,health_med_curriculum_id ,health_med_educational_id ,
health_med_institute_type_id ,health_med_institute_id ,health_med_license_type_id ,
health_med_doctor_type_id ,health_med_curriculum_other ,health_med_educational_other ,
health_med_institute_type_other ,space(200) As health_med_institute_type_no_other ,
health_med_institute_other ,space(200) As health_med_curriculum_no_type_other ,
d.cid As cid
FROM health_med_doctor h
left join doctor d on d.licenseno=h.license_number
----------------------------
คำสั่งส่งออกของ XXXXX-Diag.csv -------------------------->
select '11447' As hospcode, h.health_med_provider_id,h.health_med_provider_pname,
h.health_med_provider_fname,h.health_med_provider_lname,h.health_med_provider_license_no,
h.health_med_curriculum_id,h.health_med_educational_id,h.health_med_institute_type_id,
h.health_med_institute_id,h.health_med_license_type_id,h.health_med_provider_type_id,
h.health_med_provider_category_id,
space(100)as h,space(100)as h,space(100)as h,space(100)as h,space(100)as h,space(100)as h,
d.cid from health_med_provider h
left join doctor d on d.licenseno=h.health_med_provider_license_no
--------------------------