หาอายุ เป็น “เดือน” ณ วันรับบริการ
select timestampdiff(month,birthdate,’2015-03-02′),p.*
from person p where patient_hn=’000087169′
หาอายุ ณ วันที่รับบริการ เป็นเดือน
*** ในกรณีนี้ คือ วันเกิด=birthdate
วันรับบริการคือ ‘2015-03-02’
หาเดือนทั้งหมดตามวันเกิด
select (timestampdiff(month,p.birthdate,curdate())-(timestampdiff(year,p.birthdate,curdate())*12))+(timestampdiff(year,p.birthdate,curdate())*12)as Y_month,
p.age_y,p.*
from person p where p.cid in (333120003xxxx)
hosxp ข้อมูลผู้ป่วยค้างชำระในเมนูห้องทะเบียนการเงิน ไม่ตรงกับ รายงาน end user report
select r.hn,concat(p.pname,p.fname,’ ‘,p.lname) as ptname, r.*,
o.vstdate,o.vsttime,t.name as pttype_name
from rcpt_arrear r
left outer join ovst o on o.vn=r.vn
left outer join patient p on p.hn=r.hn
left outer join pttype t on t.pttype = o.pttype
where r.arrear_date between ‘2015-09-01’ and ‘2015-09-30’
and r.paid in (‘Y’,’N’)
order by r.arrear_id
hosxp 10 อันดับยาใช้งานเยอะสุด
select count(*),o.icode,d.name
from opitemrece o
left join drugitems d on d.icode=o.icode
where o.vstdate between ‘2014-10-01’ and ‘2015-09-30’ and (o.icode not like ‘30%’)
group by o.icode
order by count(*) desc
limit 10
hosxp 10 อันดับโรค ipd opd ตามช่วงวัน
ผู้ป่วยนอก————————————————————————————————–
select count(*),v.pdx,tname,name
from vn_stat v
left join icd101 i on i.code=v.pdx
where v.vstdate between ‘2014-10-01’ and ‘2015-09-30’
group by v.pdx
order by count(*) desc
limit 10
ผู้ป่วยใน—————————————————————————————————-
select count(*),v.pdx,tname,name
from an_stat v
left join icd101 i on i.code=v.pdx
where v.dchdate between ‘2014-10-01’ and ‘2015-09-30’ and (v.pdx is not null or v.pdx<>”)
group by v.pdx
order by count(*) desc
limit 11
ความเห็นล่าสุด