BMS-HOSxP Community
HOSxP => การเขียน SQL Script => ข้อความที่เริ่มโดย: วีระวัฒน์ (เอก) ที่ กุมภาพันธ์ 08, 2010, 04:51:53 AM
-
ปัญหา
1.หลาย ๆ รายงานที่ผมเคย download มาแล้ว มักใช้ไม่ได้กับ หน่วยงานของผม ต้องตามไปแก้อีก ที่พบมาก ได้แก่ ชื่อโรงพยาบาล ที่อยู่ รพ. (บ้านเลขที่ หมู่ที่ ตำบล อำเภอ จังหวัด) การแบ่งเขต ในตำบล ในเขตอำเภอ นอกเขตอำเภอ ในจังหวัด ต่างจังหวัด
2.รายงานเกิ่ยวกับผลตรวจทางชันสูตร (ที่ยังไม่มีรหัสมาตราฐาน) เช่น ทะเบียนผลตรวจ CBC U/A
วิธีแก้ปัญหา
1.อยากให้แต่ละท่านเสนอความคิดเห็นมาก่อนครับ แต่ละทางมีแนวทางใหนบ้างที่ทำรายงานแล้วไม่ต้องไปแก้ใช้งานได้เลย ขอเป็นอีกแนวทางหนึ่งที่ดีกว่าของผมก็ได้
ส่วนผมมีวิธีแก้ได้แล้ว จะมาเฉลยอีก 10 วัน
-
ส่วนผมมีวิธีแก้ได้แล้ว จะมาเฉลยอีก 10 วัน
;D บอกเลยซิท่าน weerawat จะได้เอาไปลองเลยตอนนี้ report กำลังเข้าหลายตัว ;D :D ;) :)
-
แบบนี้ได้ไหมคับ :)
1. value:=getsqldata('select hospitalname from opdconfig')
2. Variable
2.1 Dbpipline:=select รายการทางชันสูตร_id ,รายการทางชันสูตร_id from รายการทางชันสูตร
2.2 Variable1 :=(select สิ่งที่อยากรู้ from ผลรายการทางชันสูตร where รายการทางชันสูตร_id='Dbpipline['รายการทางชันสูตร_id']'
Variable2 :=(select สิ่งที่อยากรู้ from ผลรายการทางชันสูตร where รายการทางชันสูตร_id='Dbpipline['รายการทางชันสูตร_id']'
-
แบบนี้ได้ไหมคับ :)
1. value:=getsqldata('select hospitalname from opdconfig')
อันนี้ อ.mn ทำเป็น function แล้ว
value := HospitalName;
-
ช่วยกันเสนอความคิดเห็นหน่อยครับ ที่อยู่ รพ. (บ้านเลขที่ หมู่ที่ ตำบล อำเภอ จังหวัด) การแบ่งเขต ในตำบล ในเขตอำเภอ นอกเขตอำเภอ ในจังหวัด ต่างจังหวัด
-
แบบนี้อีกแบบ.. อาจจะดูรกๆ แต่ใช้ได้ ;D
Value :=getsqlstringdata('select concat(o.hosptype,o.name) as cc from opdconfig h'+
' left outer join hospcode o on h.hospitalcode=o.hospcode')+
getsqlstringdata('select concat(" ต. ",t.name) as cc from opdconfig h'+' '+
' left outer join hospcode o on h.hospitalcode=o.hospcode'+
' left outer join thaiaddress t on t.tmbpart=o.tmbpart and t.amppart=o.amppart'+
' and t.chwpart=o.chwpart and t.codetype="3"')+
getsqlstringdata('select concat(" อ. ",t.name) as cc from opdconfig h'+' '+
' left outer join hospcode o on h.hospitalcode=o.hospcode'+
' left outer join thaiaddress t on t.amppart=o.amppart'+
' and t.chwpart=o.chwpart and t.codetype="2"')+
getsqlstringdata('select concat(" จ. ",t.name) as cc from opdconfig h'+' '+
' left outer join hospcode o on h.hospitalcode=o.hospcode'+
' left outer join thaiaddress t on t.chwpart=o.chwpart and t.codetype="1"')
;
-
ที่อยู่ รพ. ตาม อ. nuttavut ครับ
1.
ส่วนการแบ่งเขต ในตำบล ในอำเภอ ในจังหวัด ต่างจังหวัด
อันนี้ก็สามารถดึงที่อยู่ของโรงพยาบาลแล้วมาคิดตามเงื่อนไขได้ครับ (opdconfig,hospcode)
ตอนเขียนรายงานก็ประกาศตัวแปรที่เป็น Gobal มาเก็บก็ได้ครับ แล้วก็มีฟังก์ชันสำหรับ
โหลดข้อมูลพื้นฐาน รพ. ลงในตัวแปรใน event onload เพื่อนำข้อมูลไปเช็คตามเงื่อนไข
เสร็จแล้วก็เอารายงานนี้เป็น template สำหรับรายงานอื่น จะได้ไม่ต้องมาเขียน code เดิมบ่อย ๆ ครับ
2. ข้อนี้ไม่เข้าใจโจทย์เท่าไหร่ครับ
คิดว่าน่าจะเป็นรายงานผล lab ของแต่ละคน ตัวนี้ code ของ lab แต่ละโรงพยาบาลก็คงไม่เหมือนกัน
ก็ประกาศตัวแปร Gobal มาเก็บเหมือนเดิมครับ รพ.ไหนเอาไปใช้ก็อาจจะต้องเปลี่ยนนิดหน่อย ส่วนจะ fix ชื่อ lab ก็กลัวว่าจะตั้งชื่อไม่เหมือนกันครับ
ปล. คิดได้ประมาณนี้อ่ะครับ ;D ;D ;D
-
ส่วนผมมีวิธีแก้ได้แล้ว จะมาเฉลยอีก 10 วัน
... พี่เอก เดี๋ยวนี้ลูกเล่นเยอะนะครับ ... อิ อิ .... ;D ;D ;D ...
... ไม่เหมือนป๋า JD(มีพาดพิง) ชอบแย่งลูกเล่น ลูกเลยเล่นได้ไม่เยอะ .... ;D ;D ;D ....
... ส่วนรายงาน สำหรับตัวผมเองนะ ผมชอบแบบ อันใหนพิมพ์ใน label ได้ หรือ fix ลงไปได้เลย เช่นชื่อโรงพยาบาล ก็จะใส่ไปเลย ตัวรายงานจะได้ไม่ต้องประมวลผลคำสั่งมากขึ้น( เสี้ยววินาที ;D )
อื่นๆ ก็แล้วแต่กรณีครับ ... :D ....
-
ผมว่าใช้แบบคุณ Nuttavut ก็ใช้ได้ดีนะ ;D
-
select o.hospitalcode, o.hospitalname, t.full_name as hosp_address
from opdconfig o
join hospcode h on h.hospcode = o.hospitalcode
join thaiaddress t on t.addressid = concat(h.chwpart,h.amppart,h.tmbpart)
-
3. เบอร์โทรศัพท์ของโรงพยาบาล Fax สายในทั้งหมด รหัสไปรษณีย์ ใช้ออกใบนัด ใบ นค1 ครับ
(ใบ นค1 ที่อยู่ตาม อ.nuttavut ครับ ชื่อโรงพยาบาล ตาม อ.udomchok ครับ)
4.รพ.ที่เป็นประกันสังคม ในเครือข่าย(น่าจะเป็นในจังหวัด) นอกเครือข่าย(ในจังหวัด) นอกจังหวัด นอกเครือข่าย และ นอก สป (รพ.นอกสังกัดกระทรวงสาธารณสูข)
-
1.
ส่วนการแบ่งเขต ในตำบล ในอำเภอ ในจังหวัด ต่างจังหวัด
อันนี้ก็สามารถดึงที่อยู่ของโรงพยาบาลแล้วมาคิดตามเงื่อนไขได้ครับ (opdconfig,hospcode)
ตอนเขียนรายงานก็ประกาศตัวแปรที่เป็น Gobal มาเก็บก็ได้ครับ แล้วก็มีฟังก์ชันสำหรับ
โหลดข้อมูลพื้นฐาน รพ. ลงในตัวแปรใน event onload เพื่อนำข้อมูลไปเช็คตามเงื่อนไข
เสร็จแล้วก็เอารายงานนี้เป็น template สำหรับรายงานอื่น จะได้ไม่ต้องมาเขียน code เดิมบ่อย ๆ ครับ
ขอดูตัวอย่างหน่อยครับ เป็นตัวรายงานก็ได้
ฝาก ผู้ดูแลระบบ web site hosxp.net ปักหมุดด้วยนะครับ คิดว่ามีประโยชน์กับทุกแห่ง นะครับ
-
แบบนี้อีกแบบ.. อาจจะดูรกๆ แต่ใช้ได้ ;D
Value :=getsqlstringdata('select concat(o.hosptype,o.name) as cc from opdconfig h'+
' left outer join hospcode o on h.hospitalcode=o.hospcode')+
getsqlstringdata('select concat(" ต. ",t.name) as cc from opdconfig h'+' '+
' left outer join hospcode o on h.hospitalcode=o.hospcode'+
' left outer join thaiaddress t on t.tmbpart=o.tmbpart and t.amppart=o.amppart'+
' and t.chwpart=o.chwpart and t.codetype="3"')+
getsqlstringdata('select concat(" อ. ",t.name) as cc from opdconfig h'+' '+
' left outer join hospcode o on h.hospitalcode=o.hospcode'+
' left outer join thaiaddress t on t.amppart=o.amppart'+
' and t.chwpart=o.chwpart and t.codetype="2"')+
getsqlstringdata('select concat(" จ. ",t.name) as cc from opdconfig h'+' '+
' left outer join hospcode o on h.hospitalcode=o.hospcode'+
' left outer join thaiaddress t on t.chwpart=o.chwpart and t.codetype="1"')
;
อันนี้ไม่รกครับ ;D ;D ;D
select o.hospitalcode, o.hospitalname, t.full_name as hosp_address
from opdconfig o
join hospcode h on h.hospcode = o.hospitalcode
join thaiaddress t on t.addressid = concat(h.chwpart,h.amppart,h.tmbpart)
-
.....ไม่เหมือนป๋า JD(มีพาดพิง) ชอบแย่งลูกเล่น ลูกเลยเล่นได้ไม่เยอะ ....
อ.JD ที่ถูกพาดพิง ไม่ยอมมาแก้ข้อกล่าวหาเลยนะ
-
อ.JD ที่ถูกพาดพิง ไม่ยอมมาแก้ข้อกล่าวหาเลยนะ
;D ;D ;D ผมกลัวประเภทจิ้งจก/ตุ๊กแกครับพี่วัฒน์ วัน ๆ เอาแต่ปีนดาดฟ้าทำนู่นทำนี่ ใกล้จะเป็น Spiderman เข้าไปทุกทีแล้ว (ทำข้างล่างสงสัยกลัวใครเห็นน่ะสิ) ;D ;D ;D
-
อ.JD ที่ถูกพาดพิง ไม่ยอมมาแก้ข้อกล่าวหาเลยนะ
;D ;D ;D ผมกลัวประเภทจิ้งจก/ตุ๊กแกครับพี่วัฒน์ วัน ๆ เอาแต่ปีนดาดฟ้าทำนู่นทำนี่ ใกล้จะเป็น Spiderman เข้าไปทุกทีแล้ว (ทำข้างล่างสงสัยกลัวใครเห็นน่ะสิ) ;D ;D ;D
" ทำข้างล่างสงสัยกลัวใครเห็นน่ะสิ "
... เบื่อจัง คนรู้ทัน ;D ;D ก็ผมไม่มีคนให้ใช้งานเยอะๆ แบบป๋านี่ครับ ;D ;D ....
... จริงๆ ถ้าสามารถทำได้จะชอบลงมือเองคนเดียวมากกว่าครับ เงินทองไม่รั่วไหล
แล้วเผื่อเวลามีอะไรจะได้ไม่ต้องไปโทษคนอื่น แล้วก็ไม่มีคนอื่นมาโทษเราด้วย ... :D ....
... ปล. คนที่รู้ทันคนอื่น ส่วนใหญ่เป็นเพราะเคยทำมาก่อน อิ อิ ... ;D ;D ....
-
วันนี้มาเฉลยแล้วครับพร้อมรายงานมาให้ ใช้กัน
ในอำเภอ ในจังหวัด(เฉพาะในเขตอำเภอเรา) ตัวอย่างรายงาน
select v.vstdate,p.cardno,concat(pt.pname,pt.fname," ",pt.lname) as ptname,
v.hn,v.pttype,v.pttypeno,v.pcode,v.income,v.uc_money,v.item_money,v.paid_money,
v.hospmain,v.hospsub
from vn_stat v
left outer join patient pt on pt.hn=v.hn
left outer join ptcardno p on p.hn=v.hn and p.cardtype='01'
left outer join ovst o on o.vn=v.vn
left outer join er_regist e on e.vn=v.vn
left outer join pttype p2 on p2.pttype=v.pttype
left outer join pcode pc on pc.code=v.pcode
where v.vstdate between '2010-01-01' and '2010-01-31'
and v.hospmain in (select hospcode from hospcode
where chwpart in
(select chwpart from hospcode where hospcode=(select hospitalcode from opdconfig limit 1) )
and amppart in
(select amppart from hospcode where hospcode=(select hospitalcode from opdconfig limit 1) ) )and v.vn not in (select vn from an_stat)
and v.pcode in ('AL')
and v.uc_money>0
order by v.vstdate,v.pttype
-
นอกจังหวัด
select v.vstdate,p.cardno,concat(pt.pname,pt.fname," ",pt.lname) as ptname,
v.hn,v.pttype,v.pttypeno,v.pcode,v.income,v.uc_money,v.item_money,v.paid_money,
v.hospmain,v.hospsub
from vn_stat v
left outer join patient pt on pt.hn=v.hn
left outer join ptcardno p on p.hn=v.hn and p.cardtype='01'
left outer join ovst o on o.vn=v.vn
left outer join er_regist e on e.vn=v.vn
left outer join pttype p2 on p2.pttype=v.pttype
left outer join pcode pc on pc.code=v.pcode
where v.vstdate between '2010-01-01' and '2010-01-31'
and chwpart not in
(select chwpart from hospcode where hospcode=(select hospitalcode from opdconfig limit 1) )
and v.vn not in (select vn from an_stat)
and v.pcode in ('A8')
and v.uc_money>0
order by v.vstdate,v.pttype
-
นอก CUP ในจังหวัด (นอกเขตอำเภอ ในจังหวัด)
select v.vstdate,p.cardno,concat(pt.pname,pt.fname," ",pt.lname) as ptname,
v.hn,v.pttype,v.pttypeno,v.pcode,v.income,v.uc_money,v.item_money,v.paid_money,
v.hospmain,v.hospsub
from vn_stat v
left outer join patient pt on pt.hn=v.hn
left outer join ptcardno p on p.hn=v.hn and p.cardtype='01'
left outer join ovst o on o.vn=v.vn
left outer join er_regist e on e.vn=v.vn
left outer join pttype p2 on p2.pttype=v.pttype
left outer join pcode pc on pc.code=v.pcode
where v.vstdate between '2010-01-01' and '2010-01-05'
and v.hospmain in (select hospcode from hospcode
where chwpart in
(select chwpart from hospcode where hospcode=(select hospitalcode from opdconfig limit 1) )
and amppart not in
(select amppart from hospcode where hospcode=(select hospitalcode from opdconfig limit 1) ) )and v.vn not in (select vn from an_stat)
and v.pcode in ('AA','AB','AC','AD','AE','AF','AG','AI','AJ','AK','UC','UB','UA')
and v.uc_money>0
order by v.vstdate,v.pttype
-
ประกันสังคม OPD ในเครือข่าย
select v.vstdate,p.cardno,concat(pt.pname,pt.fname," ",pt.lname) as ptname,
v.hn,v.pttype,v.pttypeno,v.pcode,v.income,v.uc_money,v.item_money,v.paid_money,
v.hospmain,v.hospsub
from vn_stat v
left outer join patient pt on pt.hn=v.hn
left outer join ptcardno p on p.hn=v.hn and p.cardtype='01'
left outer join ovst o on o.vn=v.vn
left outer join er_regist e on e.vn=v.vn
left outer join pttype p2 on p2.pttype=v.pttype
left outer join pcode pc on pc.code=v.pcode
where v.vstdate between '2010-01-01' and '2010-01-31'
and v.hospmain in (select hospcode from hospcode_sss_main where code like '02%' and chwpart in
(select chwpart from hospcode where hospcode=(select hospitalcode from opdconfig limit 1) )
)
and v.vn not in (select vn from an_stat)
and v.pcode in ('A7')
and v.uc_money>0
order by v.vstdate,v.pttype
รหัส รพ.ประกันสังคมของรัฐบาล ขึ้นต้นด้วย "02"
-
แจ่มครับ
-
รายงานที่แจกครับ ช่วยแจ้งข้อผิดพลาดด้วยครับ
-
ในเขตรับผิดชอบ PCU ของโรงพยาบาล (ตำบลที่ตั้งโรงพยาบาล)
select a.regdate,a.dchdate,p.cardno,concat(pt.pname,pt.fname," ",pt.lname) as ptname,
a.hn,a.pttype,a.pttypeno,a.pcode,a.income,a.uc_money,a.item_money,a.paid_money
from an_stat a
left outer join patient pt on pt.hn=a.hn
left outer join ptcardno p on p.hn=a.hn and p.cardtype='01'
left outer join ovst o on o.vn=a.vn
left outer join ipt_pttype p3 on p3.an=a.an
left outer join er_regist e on e.vn=a.vn
left outer join pttype p2 on p2.pttype=a.pttype
left outer join pcode pc on pc.code=a.pcode
where a.dchdate between '2010-01-01' and '2010-01-31'
and p3.hospmain in (select hospcode from hospcode
where chwpart in
(select chwpart from hospcode where hospcode=(select hospitalcode from opdconfig limit 1) )
and amppart in
(select amppart from hospcode where hospcode=(select hospitalcode from opdconfig limit 1) )
and tmbpart in
(select tmbpart from hospcode where hospcode=(select hospitalcode from opdconfig limit 1) ) )
and a.pcode in ('AA','AB','AC','AD','AE','AF','AG','AI','AJ','AK','UC','UB','UA')
and a.uc_money>0
order by a.dchdate,a.pttype
-
พี่เอกเรากลับมาจากจับกระต่ายที่เขาใหญ่กับเฮียโก้กะอ.ขวด กลับมาเป็นเซียนreportเลย
แต่คืนที่2 อ.ป๋าjd ไม่ยอมไปแสดงว่าถึงรุ่งสางวันแรกจับสู้พี่เอกไม่ได้
ขอบคุณหลายๆครับ
-
รออีก 5 วันจะเฉลย เรื่องเบอร์โทรศัพท์ Lab
-
รออีก 5 วันจะเฉลย เรื่องเบอร์โทรศัพท์ Lab
ขอบคุณครับ ... ;D ;D ;D
ขอบคุณสำหรับแนวคิดและรายงานดีๆที่จะนำไปปรับใช้ สำหรับ สาวก HosXp ครับผม ;D ;D ;D
-
1.
ส่วนการแบ่งเขต ในตำบล ในอำเภอ ในจังหวัด ต่างจังหวัด
อันนี้ก็สามารถดึงที่อยู่ของโรงพยาบาลแล้วมาคิดตามเงื่อนไขได้ครับ (opdconfig,hospcode)
ตอนเขียนรายงานก็ประกาศตัวแปรที่เป็น Gobal มาเก็บก็ได้ครับ แล้วก็มีฟังก์ชันสำหรับ
โหลดข้อมูลพื้นฐาน รพ. ลงในตัวแปรใน event onload เพื่อนำข้อมูลไปเช็คตามเงื่อนไข
เสร็จแล้วก็เอารายงานนี้เป็น template สำหรับรายงานอื่น จะได้ไม่ต้องมาเขียน code เดิมบ่อย ๆ ครับ
ขอดูตัวอย่างหน่อยครับ เป็นตัวรายงานก็ได้
ฝาก ผู้ดูแลระบบ web site hosxp.net ปักหมุดด้วยนะครับ คิดว่ามีประโยชน์กับทุกแห่ง นะครับ
พึ่งเข้ามาเห็นครับ
ใน Declartion -> Variable
ds1,ds2:String;
date1,date2:Tdatetime;
hos_code,
hos_chwpart,
hos_amppart,
hos_tmbpart,
hos_addressid,
hos_address,
hos_code_in_cup,
hos_code_in_chwpart:String;
ฟังก์ชันสำหรับดึงข้อมูลมาใส่ตัวแปร Gobal
procedure get_hos_info;
begin
hos_code := GetSQLStringData('select hospitalcode from opdconfig');
ChangeDBPipeLineLink10SQL('select * from hospcode where hospcode="'+hos_code+'"');
hos_chwpart := DBPipeLineLink10['chwpart'];
hos_amppart := DBPipeLineLink10['amppart'];
hos_tmbpart := DBPipeLineLink10['tmbpart'];
hos_addressid := hos_chwpart + hos_amppart + hos_tmbpart;
hos_address := GetSQLStringData('select full_name from thaiaddress '+
'where addressid="'+hos_addressid+'"');
hos_code_in_cup := GetSQLSubQueryData('select hospcode from hospcode where '+
'chwpart="'+hos_chwpart+'" and amppart="'+hos_amppart+'"');
hos_code_in_chwpart := GetSQLSubQueryData('select hospcode from hospcode where '+
'chwpart="'+hos_chwpart+'"');
end;
ใน Even OnCreate ก็เรียก procedure get_hos_info;
ใน Report เอาเอา String มาเก็บ Comment คำอธิบายว่ามีตัวแปรอะไรบ้าง
procedure GlobalOnCreate;
var cm:String;
begin
cm:=
'//===========================================================//'+
'// Comment Section , cm -> Coment //'+
'// --- Phrompiram Hospital --- //'+
'// @Author : Nattapong Raodmuang //'+
'// @HOSxP : 3.52.10.30 //'+
'// @MySQL : 5.1.30 //'+
'// @OS : Microsoft Windows XP SP3 //'+
'// @Date : 2010 February 16 //'+
'// //'+
'// ---- Gobal Variable ---- //'+
'// You can use after call procedure get_hos_info; //'+
'// hos_code : hospital code //'+
'// hos_chwpart : chwpart of hosital //'+
'// hos_amppart : amppart of hospital //'+
'// hos_tmbpart : tmbpart of hospital //'+
'// hos_addressid : addressid of hospital //'+
'// hos_address : String hospital address //'+
'// hos_code_in_cup : hospcode in cup //'+
'// hos_code_in_chwpart : hospcode in chwpart //'+
'// //'+
'// ---- Gobal Function ---- //'+
'// get_datetime; => set date to ds1,ds2 //'+
'// get_hos_info; => set hospital info to Gobal Variable //'+
'//===========================================================//';
get_hos_info;
end;
หลัก ๆ ก็จะมีข้อมูลที่อยู่ของโรงพยาบาลครับ
ถ้าอยากได้ข้อมูลอื่นก็เอาข้อมูลพื้นฐานมา Query อีกที
สำคัญที่ว่าเงื่อนไขรายงานต้องการอะไร ผมก็จะเอาข้อมูลพวกนี้ไปประยุกต์อีกที
ตัวอย่างที่ทำไว้คือ hospcode ของโรงพยาบาลที่ทำเป็น SubQuery ไว้
เวลาเขียน SQL เยอะ ๆจะได้ไม่งงครบ
สุดท้ายเวลามีการขอ Report ใหม่ ก็จะเอา Report ตัวนี้มาแก้ โดยเรียกใช้ตัวแปรได้เลยครับ
;D ;D
-
พึ่งเข้ามาเห็นครับ
ใน Declartion -> Variable
ds1,ds2:String;
date1,date2:Tdatetime;
hos_code,
hos_chwpart,
hos_amppart,
hos_tmbpart,
hos_addressid,
hos_address,
hos_code_in_cup,
hos_code_in_chwpart:String;
ฟังก์ชันสำหรับดึงข้อมูลมาใส่ตัวแปร Gobal
procedure get_hos_info;
begin
hos_code := GetSQLStringData('select hospitalcode from opdconfig');
ChangeDBPipeLineLink10SQL('select * from hospcode where hospcode="'+hos_code+'"');
hos_chwpart := DBPipeLineLink10['chwpart'];
hos_amppart := DBPipeLineLink10['amppart'];
hos_tmbpart := DBPipeLineLink10['tmbpart'];
hos_addressid := hos_chwpart + hos_amppart + hos_tmbpart;
hos_address := GetSQLStringData('select full_name from thaiaddress '+
'where addressid="'+hos_addressid+'"');
hos_code_in_cup := GetSQLSubQueryData('select hospcode from hospcode where '+
'chwpart="'+hos_chwpart+'" and amppart="'+hos_amppart+'"');
hos_code_in_chwpart := GetSQLSubQueryData('select hospcode from hospcode where '+
'chwpart="'+hos_chwpart+'"');
end;
ใน Even OnCreate ก็เรียก procedure get_hos_info;
ใน Report เอาเอา String มาเก็บ Comment คำอธิบายว่ามีตัวแปรอะไรบ้าง
procedure GlobalOnCreate;
var cm:String;
begin
cm:=
'//===========================================================//'+
'// Comment Section , cm -> Coment //'+
'// --- Phrompiram Hospital --- //'+
'// @Author : Nattapong Raodmuang //'+
'// @HOSxP : 3.52.10.30 //'+
'// @MySQL : 5.1.30 //'+
'// @OS : Microsoft Windows XP SP3 //'+
'// @Date : 2010 February 16 //'+
'// //'+
'// ---- Gobal Variable ---- //'+
'// You can use after call procedure get_hos_info; //'+
'// hos_code : hospital code //'+
'// hos_chwpart : chwpart of hosital //'+
'// hos_amppart : amppart of hospital //'+
'// hos_tmbpart : tmbpart of hospital //'+
'// hos_addressid : addressid of hospital //'+
'// hos_address : String hospital address //'+
'// hos_code_in_cup : hospcode in cup //'+
'// hos_code_in_chwpart : hospcode in chwpart //'+
'// //'+
'// ---- Gobal Function ---- //'+
'// get_datetime; => set date to ds1,ds2 //'+
'// get_hos_info; => set hospital info to Gobal Variable //'+
'//===========================================================//';
get_hos_info;
end;
หลัก ๆ ก็จะมีข้อมูลที่อยู่ของโรงพยาบาลครับ
ถ้าอยากได้ข้อมูลอื่นก็เอาข้อมูลพื้นฐานมา Query อีกที
สำคัญที่ว่าเงื่อนไขรายงานต้องการอะไร ผมก็จะเอาข้อมูลพวกนี้ไปประยุกต์อีกที
ตัวอย่างที่ทำไว้คือ hospcode ของโรงพยาบาลที่ทำเป็น SubQuery ไว้
เวลาเขียน SQL เยอะ ๆจะได้ไม่งงครบ
สุดท้ายเวลามีการขอ Report ใหม่ ก็จะเอา Report ตัวนี้มาแก้ โดยเรียกใช้ตัวแปรได้เลยครับ
;D ;D
Good idea ครับ
-
หลัก ๆ ก็จะมีข้อมูลที่อยู่ของโรงพยาบาลครับ
ถ้าอยากได้ข้อมูลอื่นก็เอา ข้อมูลพื้นฐานมา Query อีกที
สำคัญที่ว่าเงื่อนไขรายงานต้องการอะไร ผมก็จะเอาข้อมูลพวกนี้ไปประยุกต์อีกที
ตัวอย่างที่ทำไว้คือ hospcode ของโรงพยาบาลที่ทำเป็น SubQuery ไว้
เวลาเขียน SQL เยอะ ๆจะได้ไม่งงครบ
สุดท้ายเวลามีการขอ Report ใหม่ ก็จะเอา Report ตัวนี้มาแก้ โดยเรียกใช้ตัวแปรได้เลยครับ
ก็จะเอา Report ตัวนี้มาแก้
ขอreport ที่ว่ามา sample หน่อยครับ
;D ;D
-
หลัก ๆ ก็จะมีข้อมูลที่อยู่ของโรงพยาบาลครับ
ถ้าอยากได้ข้อมูลอื่นก็เอา ข้อมูลพื้นฐานมา Query อีกที
สำคัญที่ว่าเงื่อนไขรายงานต้องการอะไร ผมก็จะเอาข้อมูลพวกนี้ไปประยุกต์อีกที
ตัวอย่างที่ทำไว้คือ hospcode ของโรงพยาบาลที่ทำเป็น SubQuery ไว้
เวลาเขียน SQL เยอะ ๆจะได้ไม่งงครบ
สุดท้ายเวลามีการขอ Report ใหม่ ก็จะเอา Report ตัวนี้มาแก้ โดยเรียกใช้ตัวแปรได้เลยครับ
ก็จะเอา Report ตัวนี้มาแก้
ขอreport ที่ว่ามา sample หน่อยครับ
;D ;D
จริงๆ ตอนเอามาแก้ส่วนที่ code ที่มันวุ่นวายแทบไม่ได้ยุ่งเลยครับ
คือ ดึงตัวแปรที่เขีนยอธิบายไว้ใน Commnet มาใช้งานได้เลย
คล้าย ๆ กับดึง ชื่อโรงพยาบาลจาก Hospitalname อ่ะครับ
-
หลัก ๆ ก็จะมีข้อมูลที่อยู่ของโรงพยาบาลครับ
ถ้าอยากได้ข้อมูลอื่นก็เอา ข้อมูลพื้นฐานมา Query อีกที
สำคัญที่ว่าเงื่อนไขรายงานต้องการอะไร ผมก็จะเอาข้อมูลพวกนี้ไปประยุกต์อีกที
ตัวอย่างที่ทำไว้คือ hospcode ของโรงพยาบาลที่ทำเป็น SubQuery ไว้
เวลาเขียน SQL เยอะ ๆจะได้ไม่งงครบ
สุดท้ายเวลามีการขอ Report ใหม่ ก็จะเอา Report ตัวนี้มาแก้ โดยเรียกใช้ตัวแปรได้เลยครับ
ก็จะเอา Report ตัวนี้มาแก้
ขอreport ที่ว่ามา sample หน่อยครับ
;D ;D
จริงๆ ตอนเอามาแก้ส่วนที่ code ที่มันวุ่นวายแทบไม่ได้ยุ่งเลยครับ
คือ ดึงตัวแปรที่เขีนยอธิบายไว้ใน Commnet มาใช้งานได้เลย
คล้าย ๆ กับดึง ชื่อโรงพยาบาลจาก Hospitalname อ่ะครับ
ขอบคุณมากๆครับ จะลองเอามาปรับและทดลองบ้างครับ ;D ;D ;D ;D
-
ขอบคุณครับ
-
ขอบคุณสำหรับแนวคิดและการแบ่งปันครับผม สุดยอดดดดด