ผู้เขียน หัวข้อ: ขอความช่วยเหลือครับ  (อ่าน 2193 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ bomkeen

  • Sr. Member
  • ****
  • กระทู้: 312
  • Respect: +1
    • ดูรายละเอียด
ขอความช่วยเหลือครับ
« เมื่อ: กันยายน 27, 2011, 13:26:35 PM »
0
พี่ที่ห้องส่งเสริมอยากได้รายงาน (ก็ไม่เชิงรายงานนะครับ แกจะปริ้นประจำวัน)  ดังภาพที่แนบ โดยปริ้นรายละเอียดการได้รับวัคซีนของเด็กที่มารับบริการในวันนั้นๆ ในที่นี้พี่เขาอยากให้รวมทั้ง WBC และ EPI ไว้ในแผ่นเดียวกัน ข้อแม้ที่ทำให้ผมทำไม่ได้คือ ต้องส่งออกเป็น Excel ได้ด้วย ผมเลย งงกับการเขียนคำสั่งรายงานชุดนี้มากครับ รบกวนพี่ๆแนะนำหรือขอตัวอย่างเป็นแนวทางด้วยนะครับ
พีรกาจ พูลสวัสดิ์
นักวิชาการคอมพิวเตอร์(ลูกจ้าง)
รพ.สมเด็จพระสังฆราช(นครหลวง) รพช.30เตียง
จ.พระนครศรีอยุธยา

ออฟไลน์ bomkeen

  • Sr. Member
  • ****
  • กระทู้: 312
  • Respect: +1
    • ดูรายละเอียด
Re: ขอความช่วยเหลือครับ
« ตอบกลับ #1 เมื่อ: กันยายน 27, 2011, 14:56:56 PM »
0
ผมลองร่างๆ มาๆด้ประมาณนี้ครับ

select vn.vstdate as vdate,p.patient_hn as hn,concat(p.pname,p.fname,' ',p.lname) as person_name,concat(pt.addrpart,"  ?. ",pt.moopart," ",ad.full_name) as fullad,
vn.pdx,w1.service_note as wbc_waistline,w1.body_weight as wbc_bw ,w1.height as wbc_h,n.name as wbc_nutrition
,en.body_weight as epi_bw,en.height as epi_h,n1.name as epi_nutrition,
pw.vaccine_bcg_date as bcg,pw.vaccine_hbv1_date as hbv1,
pw.vaccine_hbv2_date as hbv2,pw.vaccine_hbv3_date as hbv3,
pw.vaccine_dtp1_date as dtp1,pw.vaccine_dtp2_date as dtp2,
pw.vaccine_dtp3_date as dtp3,pe.vaccine_dtp4_date as dtp4,
pe.vaccine_dtp5_date as dtp5,pw.vaccine_opv1_date as opv1,
pw.vaccine_opv2_date as opv2,pw.vaccine_opv3_date as opv3,
pe.vaccine_opv4_date as opv4,pe.vaccine_opv5_date as opv5,
pe.vaccine_je1_date as je1,pe.vaccine_je2_date as je2,
pe.vaccine_je3_date as je3,pw.vaccine_mmr_date as mmr

  from vn_stat vn

 left outer join person p on p.patient_hn=vn.hn
 left outer join person_wbc pw on pw.person_id=p.person_id
 left outer join person_epi pe on pe.person_id=p.person_id
 left outer join person_wbc_service w1 on w1.vn=vn.vn
 left outer join nutrition_level n on n.nutrition_level = w1.nutrition_level
 left outer join person_epi_nutrition en on en.person_epi_id=pe.person_epi_id
 left outer join nutrition_level n1 on n1.nutrition_level = en.nutrition_level
 left outer join patient pt on pt.hn=p.patient_hn
left outer join thaiaddress ad on  ad.chwpart=pt.chwpart and ad.amppart=pt.amppart and ad.tmbpart=pt.tmbpart
where vn.vstdate between "2011-09-21" and "2011-09-21" and (pw.vaccine_bcg_date=vn.vstdate or pw.vaccine_hbv1_date=vn.vstdate or
pw.vaccine_hbv2_date=vn.vstdate or pw.vaccine_hbv3_date=vn.vstdate or
pw.vaccine_dtp1_date=vn.vstdate or pw.vaccine_dtp2_date=vn.vstdate or
pw.vaccine_dtp3_date=vn.vstdate or pw.vaccine_opv1_date=vn.vstdate or
pw.vaccine_opv2_date=vn.vstdate or pw.vaccine_opv3_date=vn.vstdate or
pw.vaccine_mmr_date=vn.vstdate  or pe.vaccine_dtp4_date=vn.vstdate or
pe.vaccine_opv4_date=vn.vstdate or pe.vaccine_je1_date=vn.vstdate  or
pe.vaccine_je2_date=vn.vstdate  or pe.vaccine_je3_date=vn.vstdate  or
pe.vaccine_dtp5_date=vn.vstdate or pe.vaccine_opv5_date=vn.vstdate )  order by vn.vstdate
พีรกาจ พูลสวัสดิ์
นักวิชาการคอมพิวเตอร์(ลูกจ้าง)
รพ.สมเด็จพระสังฆราช(นครหลวง) รพช.30เตียง
จ.พระนครศรีอยุธยา