BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: vinaisena ที่ มิถุนายน 03, 2011, 14:07:54 PM

หัวข้อ: คำสั่งให้แสดงที่อยู่เต็มรูปแบบ
เริ่มหัวข้อโดย: vinaisena ที่ มิถุนายน 03, 2011, 14:07:54 PM
select pt.*,ov.*
from vn_stat ov ,patient pt ,ovst ovst
where  ov.vn=ovst.vn and pt.hn=ov.hn and ov.vstdate between "2008-10-01" and  "2009-09-30" and ov.hn=pt.hn
 and ov.age_y>= 0
 and ov.age_y<= 200
 and ( (ov.pdx >= "C000" and ov.pdx <= "C979")
 or (ov.dx0 >= "C000" and ov.dx0 <= "C979")
 or (ov.dx1 >= "C000" and ov.dx1 <= "C979")
 or (ov.dx2 >= "C000" and ov.dx2 <= "C979")
 or (ov.dx3 >= "C000" and ov.dx3 <= "C979")
 or (ov.dx4 >= "C000" and ov.dx4 <= "C979")
 or (ov.dx5 >= "C000" and ov.dx5 <= "C979") )
จำคำสั่ง ข้างบน ผมจะ Join อย่างไรให้ แสดงที่อยู่เต็มรูปแบบ แสดง ตำบล อำเภอ จังหวัด จะต้องเขียนคำสั่งอะไรเพิ่มเติมครับ
หัวข้อ: Re: คำสั่งให้แสดงที่อยู่เต็มรูปแบบ
เริ่มหัวข้อโดย: Khuad ที่ มิถุนายน 03, 2011, 14:39:41 PM

... ลองแบบนี้ก็ได้ครับพี่วินัย

select concat(pt.addrpart," ม.",pt.moopart ," ",t.full_name) as full_address,
pt.*,ov.*

from ovst ovst,patient pt,vn_stat ov

left outer join thaiaddress t on ov.aid = t.addressid

where  ov.vstdate between "2011-01-01" and  "2011-01-10"
and ov.vn=ovst.vn and ov.hn=pt.hn
and ov.age_y>= 0 and ov.age_y<= 200
and ( (ov.pdx >= "C000" and ov.pdx <= "C979")


or (ov.dx0 >= "C000" and ov.dx0 <= "C979")
or (ov.dx1 >= "C000" and ov.dx1 <= "C979")
or (ov.dx2 >= "C000" and ov.dx2 <= "C979")
or (ov.dx3 >= "C000" and ov.dx3 <= "C979")
or (ov.dx4 >= "C000" and ov.dx4 <= "C979")
or (ov.dx5 >= "C000" and ov.dx5 <= "C979") )
หัวข้อ: Re: คำสั่งให้แสดงที่อยู่เต็มรูปแบบ
เริ่มหัวข้อโดย: เกื้อกูล ครับ.. ที่ มิถุนายน 03, 2011, 14:42:28 PM
ใช้ variable  GetPatient address ได้ไหม..ครับพี่..ใน ReportDesigner ครับ

begin
  GetPatientAddress(hn);
end;
หัวข้อ: Re: คำสั่งให้แสดงที่อยู่เต็มรูปแบบ
เริ่มหัวข้อโดย: Khuad ที่ มิถุนายน 03, 2011, 14:50:11 PM

... การใช้ GetPatientAddress จะประมวลผลในรายงานได้ช้ากว่าการวางคำสั่งดึงที่อยู่  ไว้ในคำสั่งหลักของรายงานนิดนึงนะครับ
    จะพอเห็นได้ ถ้าในรายงานมีข้อมูลรายชื่อมากๆ หน่อย   แล้วใช้ GetPatientAddress ตามรายชื่อ

    ถ้ารายชื่อน้อยๆ ไม่ค่อยเห็นความแตกต่างครับ เพราะจับไม่ทัน ...  ;D ...
หัวข้อ: Re: คำสั่งให้แสดงที่อยู่เต็มรูปแบบ
เริ่มหัวข้อโดย: Bond_007 ที่ มิถุนายน 03, 2011, 16:30:37 PM
ของผมใช้แบบนี้ครับ ใช้ variable (ปล ผมไม่เก่งรายงานนะครับแต่อยากส่วนร่วมด้วยครับ)
 Value :=    GetPatientAddress(DBPipeline ['hn']);