BMS-HOSxP Community

HOSxP => Report Exchange => ข้อความที่เริ่มโดย: jaynak ที่ ตุลาคม 21, 2010, 16:32:48 PM

หัวข้อ: เข้ามาดูรายงานให้หน่อยครับ เรื่องวันที่ที่หยุดให้ยา
เริ่มหัวข้อโดย: jaynak ที่ ตุลาคม 21, 2010, 16:32:48 PM
ตามรูปคืออยากจะได้วันสุดท้ายที่ให้ยากับคนไข้อะครับ ต้องเขียนคำสั่งอย่างไรครับ

procedure GlobalOnDestroy;
begin
   GetDateRangeDialog(date1,date2);
   ds1:=FormatDateTime('yyyy-mm-dd',date1);
   ds2:=FormatDateTime('yyyy-mm-dd',date2);
   
   drug:=  getpickuplist('select concat(name," ",strength," ",units) as drugname from drugitems order by drugname');
   drug1:=  getsqlstringdata('select icode from drugitems where concat(name," ",strength," ",units) = "'+drug+'"');
 
 changereportsql('select op.hn,op.an,an.regdate,an.dchdate,i.name,concat(pt.pname,pt.fname,"  ",pt.lname)as ptname,op.rxdate,sum(op.qty) as total '+
' from opitemrece op '+
' left outer join patient pt on pt.hn=op.hn '+
' left outer join an_stat an on an.an=op.an '+
' left outer join icd101 i on i.code in (pdx,dx0,dx1,dx2,dx3,dx4,dx5) '+
' left outer join drugitems did on did.icode=op.icode '+
' where an.regdate between "'+ds1+'" and "'+ds2+'" '+
' and op.qty not like "0%" '+
' and op.an is not null '+
' and op.icode ="'+drug1+'" '+
' group by op.hn,op.an '+
' order by an.regdate ');
end;
หัวข้อ: Re: เข้ามาดูรายงานให้หน่อยครับ เรื่องวันที่ที่หยุดให้ยา
เริ่มหัวข้อโดย: udomchok ที่ ตุลาคม 21, 2010, 18:01:24 PM
ลองศึกษาจาก SQL นี้ครับ
select min(rxdate) as first_date, max(rxdate) as last_date from opitemrece where an=530011490 and icode=1900051
หัวข้อ: Re: เข้ามาดูรายงานให้หน่อยครับ เรื่องวันที่ที่หยุดให้ยา
เริ่มหัวข้อโดย: udomchok ที่ ตุลาคม 21, 2010, 18:22:18 PM
หรือใช้การดึงข้อมูลจากตาราง medplan_ipd ครับ
หัวข้อ: Re: เข้ามาดูรายงานให้หน่อยครับ เรื่องวันที่ที่หยุดให้ยา
เริ่มหัวข้อโดย: golf_win ที่ ตุลาคม 21, 2010, 19:00:53 PM
ส่งรายงานขึ้นมาด้วยครับ ::) ::)
หัวข้อ: Re: เข้ามาดูรายงานให้หน่อยครับ เรื่องวันที่ที่หยุดให้ยา
เริ่มหัวข้อโดย: jaynak ที่ ตุลาคม 22, 2010, 09:23:13 AM
อันนี้ตัวรายงานครับ
หัวข้อ: Re: เข้ามาดูรายงานให้หน่อยครับ เรื่องวันที่ที่หยุดให้ยา
เริ่มหัวข้อโดย: jaynak ที่ ตุลาคม 22, 2010, 13:50:58 PM
ได้ละครับ ขอบคุณมากๆครับ
แต่สงสัยอยู่อย่างนึง คนไข้บางคนทำไมไม่มี pdx(โรคที่วินิจฉัย) อะครับ
หัวข้อ: Re: เข้ามาดูรายงานให้หน่อยครับ เรื่องวันที่ที่หยุดให้ยา
เริ่มหัวข้อโดย: udomchok ที่ ตุลาคม 22, 2010, 16:39:43 PM
กด Thanks เพื่อเป็นการขอบคุณด้วยครับ  ;D ;D ;D