แสดงกระทู้

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - woravet

หน้า: 1 2 [3] 4 5 ... 9
101
ตรวจสอบฟิล์ด death ของ patient ดูว่าเป็น Y หรือไม่
เพราะอาจเกิดจากการ update ข้อมูล
หรือตายนอกสถานพยาบาล


102
ต้องเปิดโปรแกรม HOSxP ด้วย
เพราะบางฟังก์ชันอยู่ในนั้น

104
ต้องกาเพิ่มจุด ติดต่อครับ ต้องไปเพิ่มที่ไหนครับ ขอความช่วยเหลือด้วยครับ

105
คุณลงที่อยู่นอกเขตรึป่าว
ตาราง person_address

106
ลองเอาข้อมูลแต่ละรายที่ว่า error มาดูคับ
เพราะ library โรคของ โปรแกรม TGrp อาจไม่ตรงกัน
*****
- Error Code
1     No Principal Diagnosis
2     Invalid Principal Diagnosis
3     Unacceptable Principal Diagnosis
4     Principal Diagnosis not valid for age
5     Principal Diagnosis not valid for sex
6     Age error
7     Ungroupable due to sex error
8     Ungroupable due to discharge type error
9     Length of stay error
10   Ungroupable due to admission weight error

- Warning Code
1   SDx ใช้ไม่ได้ หรือซ้ำกับ PDx หรือซ้ำกันเอง
2   SDx ไม่เหมาะกับอายุ หรือเป็นรหัสซึ่งเหมาะกับบางช่วงอายุแต่ไม่มีข้อมูลอายุ
4   SDx ไม่เหมาะกับเพศ หรือเป็นรหัสสำหรับเพศใดเพศหนึ่ง แต่ไม่มีข้อมูลเพศ
8   Proc ใช้ไม่ได้ หรือซ้ำกันเอง
16   Proc ไม่เหมาะกับเพศ หรือเป็นรหัสสำหรับเพศใดเพศหนึ่ง แต่ไม่มีข้อมูลเพศ
32   ไม่มีข้อมูลเพศ หรือใช้รหัสนอกเหนือจากที่กำหนด
64   ไม่มีประเภทการจำหน่ายออกจากโรงพยาบาล หรือใช้รหัสนอกเหนือจากที่กำหนด
128   ไม่มีวันที่ และ/หรือ เวลา ที่รับไว้ในรพ. หรือ มีแต่ไม่ถูกต้อง
256   ไม่มีวันที่ และ/หรือ เวลา ที่จำหน่ายออกจากรพ. หรือ มีแต่ไม่ถูกต้อง

107
Report Exchange / Re: รายงาน Refer IN แยก รพช... พอจะมีไหมคับ
« เมื่อ: เมษายน 29, 2013, 11:12:14 AM »
select r.hospcode,h.name,h.chwpart,h.amppart,count(r.vn) cc
from referin r
left join hospcode h on h.hospcode=r.hospcode
where r.refer_date between '2013-1-1' and '2013-1-31'
group by r.hospcode
order by h.chwpart,h.amppart,r.hospcode
*****
ใน web น่าจะมีรายงาน refer อยู่นะ

108
ลองแบบนี้มั๊ย
select a.hospsub,ifnull(h.name,'อื่นๆ') name
,count(distinct a.hn) 'case',count(a.hn) 'visit'

,concat(count(distinct if(a.age_y between 0 and 2,a.hn,null)),'/'
,count(if(a.age_y between 0 and 2,a.hn,null))) age_0_2

,concat(count(distinct if(a.age_y between 3 and 5,a.hn,null)),'/'
,count(if(a.age_y between 3 and 5,a.hn,null))) age_3_5

,concat(count(distinct if(a.age_y between 6 and 12,a.hn,null)),'/'
,count(if(a.age_y between 6 and 12,a.hn,null))) age_6_12

,concat(count(distinct if(a.age_y between 13 and 59,a.hn,null)),'/'
,count(if(a.age_y between 13 and 59,a.hn,null))) age_13_59

,concat(count(distinct if(a.age_y>=60,a.hn,null)),'/'
,count(if(a.age_y>=60,a.hn,null))) age_60_more

from (select d.vn,d.hn,v.age_y,v.aid
,if(v.hospsub='' or v.hospsub is null,(select hospitalcode from opdconfig)
,if(v.hospsub in (select hcode from pcu_child),v.hospsub,'99999')) hospsub
from dtmain d
left join vn_stat v on d.vn=v.vn
where d.vstdate between '2013-1-1' and '2013-1-31') a
left join hospcode h on h.hospcode=a.hospsub
group by a.hospsub


109
Report Exchange / Re: ขอความช่วยเหลือค่ะ
« เมื่อ: เมษายน 24, 2013, 12:06:53 PM »
แบบนี้ได้มั๊ย

110
select a.hn,pt.pname,pt.fname,pt.lname
,a.vstdate,a.clinic,c.name clinicname,a.app_user
,cast(replace(replace(a.note2,char(13),','),char(10),'') as char(100)) Lab
from oapp a
left join patient pt on a.hn=pt.hn
left join clinic c on c.clinic=a.clinic
where a.nextdate between '2013-1-1' and '2013-1-10'
and a.note2 is not null
order by a.hn

111
ให้ set security ของ folder HOSxP ให้เป้น full control

112
Run Report ที่ไหน บน HOSxP หรือ Report Design
ถ้า run ที่ report design ต้องเปิด HOSxP ด้วย
เพราะที่อยู่ ผมใช้ func GetPatientAddress()

113
ลืมแนบไฟล์

115
เป็นแค่คำสั่งเท่านั้น
ถ้าจะสร้าง report ก้อต้องไปกำหนด pararmeter ด้วย
*****
แก้ตรง order by ด้วย
*****
woravet12@hotmail.com

116
แบบนี้ไหวมั๊ย
*****
select a.pdx,b.name
,sum(a.vstdate between '2009-10-1' and '2010-9-30') 'Y2553'
,sum(a.vstdate between '2010-10-1' and '2011-9-30') 'Y2554'
,sum(a.vstdate between '2011-10-1' and '2012-9-30') 'Y2555'
from vn_stat a
left join icd101 b on a.pdx=b.code
where a.vstdate between '2009-10-1' and '2012-9-30'
and a.age_y between 40 and 60
group by a.pdx
order by y2552 desc
limit 50

117
ไม่แสดง preview หน้าขาวๆ ได้มั๊ยคับ

118
เนื่องจากถ้าไม่มีข้อมูล รายงานจะขึ้นกระดาษขาวๆ
ผมอยากได้ว่า ถ้าไม่มีข้อมูล ให้มี popup ขึ้นมา
แล้วออกจากรายงาน

119
ใช้ข้อมูล report ใน report design
ทำไมใช้ recordcount ไม่ได้
*****
หรือมี func นับ record อย่างไรใน rerpot design

120
select a.spclty,s.name,sum(a.sex=1) Male,sum(a.sex=2) FeMale
from an_stat a
left join spclty s on a.spclty=s.spclty
where a.regdate between "2011-10-01" and "2012-09-30"
group by a.spclty

121
อีก 1 รายงาน
*****
ผมไม่ค่อยได้เขียนเป็นรายงาน
ส่วนใหญ่จะทำเป็นคำสั่ง

122
Report Exchange / Re: ขอแบบฟอร์มรายงานสรุปงานเอ็กซเรย์
« เมื่อ: กุมภาพันธ์ 28, 2013, 15:32:53 PM »
select count(distinct a.vn) 'Total'

,count(distinct if(a.depcode='001',a.vn,null)) 'Room_Doctor1'
,count(distinct if(a.depcode='002',a.vn,null)) 'Room_Doctor2'
,count(distinct if(a.depcode='028',a.vn,null)) 'Room_Doctor3'
,count(distinct if(a.depcode='011',a.vn,null)) 'Room_ER'
,count(distinct if(a.depcode='027',a.vn,null)) 'Room_Screen'
,count(distinct if(a.depcode not in ('001','002','028','011','027'),a.vn,null)) 'Room_Other'

,count(distinct if(length(a.vn)>9,a.vn,null)) 'OPD'
,count(distinct if(length(a.vn)=9,a.vn,null)) 'IPD'

,sum(a.film_id=1) 'Film10X12'
,sum(a.film_id=2) 'Film14X14'
,sum(a.film_id=3) 'Film14X1'

,sum(a.film_id=1 and a.damage_id>0) 'Lost10X12'
,sum(a.film_id=2 and a.damage_id>0) 'Lost14X14'
,sum(a.film_id=3 and a.damage_id>0) 'Lost14X17'

,sum(a.damage_id=1) 'Damage1'
,sum(a.damage_id=2) 'Damage2'
,sum(a.damage_id=3) 'Damage3'
,sum(a.damage_id=4) 'Damage4'
,sum(a.damage_id=5) 'Damage5'
,sum(a.damage_id=6) 'Damage6'
,sum(a.damage_id=7) 'Damage7'
,sum(a.damage_id=8) 'Damage8'
,sum(a.damage_id=9) 'Damage9'

from (select x1.xray_order_number no,x1.vn,x1.hn
,if(length(x1.vn)=9,x1.vn,'') 'AN',ifnull(r1.xn,r2.xn) XN
,date(x1.order_date_time) date
,ifnull(rf1.film_id,rf2.film_id) film_id
,ifnull(rf1.damage_id,rf2.damage_id) damage_id
,k.depcode,k.department
from xray_head x1
left join xray_report r1 on x1.vn=r1.vn
left join xray_report r2 on x1.vn=r2.an
left join xray_report_film rf1 on r1.xn=rf1.xn
left join xray_report_film rf2 on r2.xn=rf2.xn
left join kskdepartment k on x1.department_list regexp k.department
where date(x1.order_date_time) between '2013-1-1' and '2013-1-31') a
แบบนี้ได้มั๊ย

123
ลองทดสอบ โปรแกรมเครื่องส่งตรวจ(ลงทะเบียน)ด้วยตนเอง แล้วขึ้น Error

124
select o.icode,concat(d.name,' ',d.strength) drug,d.units
,sum(o.qty) 'Total'
,sum(o.sum_price) 'Sum_Price'
,sum(if(o.vn is not null,o.qty,0)) 'OPD'
,sum(if(o.vn is not null,o.sum_price,0)) 'OPD_Price'
,sum(if(o.an is not null,o.qty,0)) 'IPD'
,sum(if(o.an is not null,o.sum_price,0)) 'IPD_Price'
from opitemrece o
left join drugitems d on d.icode=o.icode
where o.rxdate between '2013-1-1' and '2013-1-31'
and d.name is not null
group by o.icode
order by d.name

125
ของ OPD
select o.main_dep,k.department
,count(distinct o.hn) 'case'
,count(o.hn) 'visit'
,sum(v.income) 'income'
from ovst o
left join vn_stat v on o.vn=v.vn
left join kskdepartment k on k.depcode=o.main_dep
where o.vstdate between '2013-1-1' and '2013-1-31'
group by o.main_dep

ของ IPD ไม่มีแยกแบบ department น่าจะมีแค่ spclty กับ ward

126
การเขียน SQL Script / Re: SQL Query ช่วงอายุ
« เมื่อ: กุมภาพันธ์ 06, 2013, 11:28:40 AM »
select 'ช่วงอายุ 9-12 เดือน' as 'age'
,count(distinct v.hn) 'case'
,count(v.hn) 'visit'
from vn_stat v
where v.vstdate between '2013-1-1' and '2013-1-31'
and concat(lpad(v.age_y,2,'0'),lpad(v.age_m,2,'0'),lpad(v.age_d,2,'0')) between '000900' and '001200'
union
select 'ช่วงอายุ 12-18 เดือน' as 'age'
,count(distinct v.hn) 'case'
,count(v.hn) 'visit'
from vn_stat v
where v.vstdate between '2013-1-1' and '2013-1-31'
and concat(lpad(v.age_y,2,'0'),lpad(v.age_m,2,'0'),lpad(v.age_d,2,'0')) between '010001' and '010600'
union
select 'ช่วงอายุ 18-24 เดือน' as 'age'
,count(distinct v.hn) 'case'
,count(v.hn) 'visit'
from vn_stat v
where v.vstdate between '2013-1-1' and '2013-1-31'
and concat(lpad(v.age_y,2,'0'),lpad(v.age_m,2,'0'),lpad(v.age_d,2,'0')) between '010601' and '020000'
union
select 'ช่วงอายุ 24-48 เดือน' as 'age'
,count(distinct v.hn) 'case'
,count(v.hn) 'visit'
from vn_stat v
where v.vstdate between '2013-1-1' and '2013-1-31'
and concat(lpad(v.age_y,2,'0'),lpad(v.age_m,2,'0'),lpad(v.age_d,2,'0')) between '020001' and '040000'
แบบของคุณ Armds ก้อดีเหมือนกัน



127
ลองตรวจสอบ Ovst ของ HN นี้
ว่ามี vsttime เป็น null มั๊ย
ให้ทำการลบ หรอแก้ไขซะ

128
เนื่องจาก rw=0 ให้คลิ๊กขวาเพื่อทำการ cal DRGs
ก้อแล้วแต่ว่าจะ All หรือ this patient
ถ้า All ควรกำหนดช่วงเวลาให้สั้นๆหน่อย
เดี๋ยวจะอืด จนถึง Error เอา

129
select v.main_pdx,i.name
,count(distinct v.hn) 'cc',count(v.hn) 'visit'
from er_regist er
left join ovst o on o.vn=er.vn
left join vn_stat v on o.vn=v.vn
left join icd101 i on i.code=v.main_pdx
where er.vstdate between '2013-1-1' and '2013-1-31'
and (o.visit_type='O' or dayofweek(er.vstdate) in (1,7)
or er.vstdate in (select holiday_date from holiday))
group by v.main_pdx
order by visit desc,cc desc
limit 30
ระวังคำจำกัดความของคำว่าง นอกเวลาราชการ หมายถึงอะไรกันแน่
ผมใช้ visit_type , dayofweek และ holiday
ลองดูคับ

131
แบบนี้ได้มั๊ย
*****
email/MSN:woravet12@hotmail.com

132
select o.vn
,o.vstdate
,o.pttype,p1.name pttypename
,inc.income_group,inc.name income_name
,sum(if(o.paidst='01',o.sum_price,0)) 'Reim'
,sum(if(o.paidst<>'01',o.sum_price,0)) 'Non_reim'
from opitemrece o
left join income inc on inc.income=o.income
left join pttype p1 on o.pttype=p1.pttype
where o.vn=551225091856
group by o.vn,inc.income_group
เปลี่ยนรหัส paidst เอาหล่ะกัน อาจไม่เหมือนกัน
reim=เบิกได้  non_reim=เบิกไม่ได้

133
ลองแก้ไขดูครับ

134
Report Exchange / Re: ช่วยดูรายงานให้หน่อยครับ
« เมื่อ: ธันวาคม 24, 2012, 15:34:46 PM »
select 'Intime' as type
,count(if((h.holiday_date is null or o.visit_type='I'),o.hn,null)) 'case53'
,count(distinct if((h.holiday_date is null or o.visit_type='I'),o.hn,null)) 'visit53'
from ovst o
left join holiday h on h.holiday_date=o.vstdate
where o.vstdate between '2009-10-1' and '2010-9-30'
union
select 'OutTime' as type
,count(if(not (h.holiday_date is null or o.visit_type='I'),o.hn,null)) 'case53'
,count(distinct if(not (h.holiday_date is null or o.visit_type='I'),o.hn,null)) 'visit53'
from ovst o
left join holiday h on h.holiday_date=o.vstdate
where o.vstdate between '2009-10-1' and '2010-9-30'
union
select 'Total' as type
,count(o.hn) 'case53'
,count(distinct o.hn) 'visit53'
from ovst o
left join holiday h on h.holiday_date=o.vstdate
where o.vstdate between '2009-10-1' and '2010-9-30'

135
แก้เป็นแบบนี้คับ
no:=JD-JD5;
  if no=0 then no:=1 else no:=no+1;
  lstep:=false;
  if no>0 then lstep:=true;
  m:=5;
  lcheck:=True;
  lwork:=False;
  i:=0;
  while not lwork do
    begin
      i:=i+1;
      n:=no;
      nmod:=m mod 2;
      if nmod=1 then _day:=29 else _day:=30;
      if (m=7) and (_index=2) then _day:=_day+1;
      if (no>=0) and (no<=_day) then lwork:=true;
      if not lwork then
        begin
          if lstep then no:=no-_day else no:=no+_day;
          if lstep then m:=m+1 else m:=m-1;
//          showmessage(inttostr(m)+'-'+inttostr(_index)+'-'+booltostr(lcheck)+#13+inttostr(nmod)+'-'+inttostr(_day)+#13+inttostr(n)+'-'+inttostr(no));
          if (m=9) and (_index=1) and (lcheck) then
            begin
              lcheck:=False;
              m:=8;
            end;
          if m<1 then m:=12;
          if m>12 then m:=1;
        end;
      if i>12 then lwork:=true;
    end;
    if no=0 then no:=_day;
    cthaiday:=formatdatetime('dddd',nowdate);
    ram:='';
    if no<16 then ram:='&cent;&Ouml;&eacute;&sup1; '+inttostr(no) else ram:='&aacute;&Atilde;&Aacute; '+inttostr(no-15);
    ram:=ram+' &curren;&egrave;&Oacute;';
    cthaimonth:=inttostr(m) //'&agrave;&acute;&times;&Iacute;&sup1; '+inttostr(m);

136
Report Exchange / Re: ช่วยดูรายงานให้หน่อยครับ
« เมื่อ: ธันวาคม 24, 2012, 15:25:44 PM »
อาจเกิดจากการเรียงลำดับเหตุการณ์ผิด
ดูจาก CalcOrder
*****
ระวังการใช้หน่วยคน หรือการใช้ distinct() ของละเหตุการณ์
อาจไม่ใช่ ผลรวมทั้งหมด

137
select er.vstdate,ifnull(h.day_name,date_format(er.vstdate,'%W')) 'dayname'
,count(er.vn) cc
from er_regist er
left join ovst o on er.vn=o.vn
left join holiday h on h.holiday_date=er.vstdate
where er.vstdate between '2012-1-1' and '2012-1-31'
and (dayofweek(er.vstdate) in (1,7)
or o.visit_type='O'
or h.holiday_date is not null)
group by er.vstdate

138
ลองตรวจสอบตาราง ovst  ว่า HN นี้มี vsttime เป็น null รึป่าว
ถ้ามี ให้ลบ หรือทำการแก้ไข

139
ตารางสังวัตสร 2401-2560

140
ลองตรวจสอบตาราง ovst ,vn_stat ว่า HN นี้มี vsttime เป็น null รึป่าว
ถ้ามี ให้ลบ หรือทำการแก้ไข

141
ตัวอย่าง-ใบรับรองการเกิด
error ตรงคำนวณค่ามาสเกณฑ์(_mas)
ที่ต้อง +25 ไม่รู้เพราะอะไร
คำนวณได้แค่ 2401-2559
หาค่าตารางสังวัตสร (ผมตั้งชื่อว่า sws) ได้แค่นี้

142
ผมทำวันจัทรคติใน report
ได้ผลไม่ตรงกับทำใน Script บน HOSxP
บางคำสั่งใน script ไม่สามารถใช้บน report design ได้

143
Report Exchange / Re: สอบถาม รายงานค่าใช้จ่ายครับ
« เมื่อ: พฤศจิกายน 28, 2012, 15:39:04 PM »
select o.hn,ifnull(o.an,'') AN,concat(p.pname,p.fname," ",p.lname) as ptname
,o.vstdate,ptt.pttype,ptt.name pttypename
,v.income,v.uc_money,v.paid_money,v.remain_money
,if(v.income=v.uc_money+v.paid_money+v.remain_money,'','Error') 'Check'
from ovst o
left outer join vn_stat v on v.vn=o.vn
left outer join patient p on p.hn=v.hn
left outer join pttype ptt on ptt.pttype=v.pttype
where o.vstdate between '2012-10-01' and '2012-10-31'
order by o.hn,o.vn

144
Report Exchange / Re: สอบถาม รูปแบบ DateTime ครับ
« เมื่อ: พฤศจิกายน 23, 2012, 11:59:19 AM »
ก้อใช้ displayformat เลยไม่ได้เหรอ
ก้อเห็นปีเป็น พ.ศ. อยู่แล้ว
d mmmm yyyy hh:nn:ss

145
นอกเรื่อง / Re: ถามการคัดลอกสูตร Excel
« เมื่อ: พฤศจิกายน 19, 2012, 18:08:18 PM »
เอาตัวอย่าง excel มาดูว่าคุณ copy แบบไหน
ขึ้นลง หรือว่า ว้ายขวา
****
=SUMPRODUCT((รายละเอียดความเสี่ยง!$B$3:$B$51=$E$3)*(รายละเอียดความเสี่ยง!$C$3:$C$51=A25))

146
ช่วงเวลาเป็นแบบ datetime
ลองเปลี่ยนช่วงเวลา เป็น date(logtime)=date(now())
*****
ข้อมูลไม่ออกไม่น่าเกี่ยวกับช่วงเวลา
น่าจะเกี่ยวกับ loginname หรือ computer_name ณ ช่วงเวลานั้นรึป่าว?

148
select p.hn,p.pname,p.fname,p.lname,p.sex,p.birthday
,p.addrpart addressno,p.moopart
,p.tmbpart,t1.name tambon
,p.amppart,t2.name ampur
,p.chwpart,t3.name changwat
,min(odx.vstdate) datecome
,max(odx.vstdate) lastvisit
from patient p
left join thaiaddress t1 on t1.addressid=concat(p.chwpart,p.amppart,p.tmbpart)
left join thaiaddress t2 on t2.addressid=concat(p.chwpart,p.amppart,'00')
left join thaiaddress t3 on t3.addressid=concat(p.chwpart,'0000')
left join ovstdiag odx on odx.hn=p.hn
where p.chwpart=62
and p.amppart=10
and odx.icd10='J449'
group by p.hn
order by p.hn

เปลี่ยนรหัสจังหวัด / อำเภอ เอาเองเด้อ

149
select count(distinct hn) 'case',count(distinct vn) 'visit'
from ovstdiag
where vstdate between '2011-10-1' and '2012-9-30'
and (icd10 between 'X60' and 'X6999' or icd10 between 'X84' and 'X8499')

คงประมาณนี้
รายงานโรคจิตเหรอ

150
ลองใช้ cast()
เป็น cast(p.adverse_effect as char(200)) as 'อาการ'
ไม่ควรเกิน 254 ไม่งั้นก้อเป็น Memo เหมือนเดิม

หน้า: 1 2 [3] 4 5 ... 9