ผู้เขียน หัวข้อ: ตรวจสอบคำสั่งให้หน่อยครับ  (อ่าน 5360 ครั้ง)

0 สมาชิก และ 1 บุคคลทั่วไป กำลังดูหัวข้อนี้

ออฟไลน์ nan_it

  • Hero Member
  • *****
  • กระทู้: 578
  • หัวไม่ให้แต่ใจรัก ( อยากเก่งให้มากกว่านี้ )
  • Respect: 0
    • ดูรายละเอียด
    • ramanhospital
ตรวจสอบคำสั่งให้หน่อยครับ
« เมื่อ: พฤศจิกายน 11, 2010, 10:59:06 AM »
0
ผมเขียนคำสั่งดึงคนไข้ที่เบาหวานอย่างเดียว ไม่ทราบว่าถูกมั้ยครับ แนะนำหน่อยครับ

select  distinct(ov.hn),ov.*
from vn_stat ov ,patient pt ,ovst ovst
where  ov.vn=ovst.vn and pt.hn=ov.hn and ov.vstdate between "2009-10-01" and  "2010-09-30" and ov.hn=pt.hn
 and ( (ov.pdx >= "E10" and ov.pdx <= "E149")
 or (ov.dx0 >= "E10" and ov.dx0 <= "E149" )
 or (ov.dx1 >= "E10" and ov.dx1 <= "E149")
 or (ov.dx2 >= "E10" and ov.dx2 <= "E149")
 or (ov.dx3 >= "E10" and ov.dx3 <= "E149")
 or (ov.dx4 >= "E10" and ov.dx4 <= "E149")
 or (ov.dx5 >= "E10" and ov.dx5 <= "E149")    )
 and ov.dx0 <> "I10"
 and ov.dx1 <> "I10"
 and ov.pdx <> "I10"
 and ov.dx2 <> "I10"
 and ov.dx3 <> "I10"
 and ov.dx4 <> "I10"
 and ov.dx5 <> "I10"
Mr.Anannee Sama ,โรงพยาบาลรามัน อำเภอรามัน จังหวัดยะลา 95140 ( รพ.60 เตียง กำลังจะเป็น รพ.ทั่วไป ครับ)
e-mail : nan_it@hotmail.com
http://www.ramanhospital.com
Server Intel Ram 16 G 
OS CentOS Database Mysql percona xtradb
ขึ้นระบบ กรกฎาคม พ.ศ. 2547
เวอร์ชั่นที่ใช้ 3.54.10.31

ออฟไลน์ nahos

  • Hero Member
  • *****
  • กระทู้: 2,216
  • รพ.นาแห้ว
  • Respect: +7
    • ดูรายละเอียด
    • รพ.นาแห้ว
Re: ตรวจสอบคำสั่งให้หน่อยครับ
« ตอบกลับ #1 เมื่อ: พฤศจิกายน 11, 2010, 16:31:23 PM »
0
อ้างถึง
select distinct(o.icd10),if(o.icd10 between "e10" and "e109" ,"IDM","NIDM") as dmtype,o.hn,count(o.vn) as cntvn ,concat(p.pname,p.fname," ",p.lname) as ptname,p.cid,concat(p.addrpart,"ËÁÙè",p.moopart) as mo,if(t.full_name is null,"äÁ辺·ÕèÍÂÙè",t.full_name) as taddress,min(o.vstdate) as minvst
, (select o1.icd10 from ovstdiag o1 where o.hn=o1.hn and   (o1.icd10="e103" or o1.icd10="e113" or o1.icd10="e123" or o1.icd10="e133" or o1.icd10="e143" ) limit 1)  as DM_with_Ophthalmic
, (select o1.icd10 from ovstdiag o1 where o.hn=o1.hn and   (o1.icd10="e102" or o1.icd10="e112" or o1.icd10="e122" or o1.icd10="e132" or o1.icd10="e142" ) limit 1)  as DM_with_Renel
, (select o1.icd10 from ovstdiag o1 where o.hn=o1.hn and   (o1.icd10="e104" or o1.icd10="e114" or o1.icd10="e124" or o1.icd10="e134" or o1.icd10="e144" ) limit 1)  as DM_with_Neurological
, (select o1.icd10 from ovstdiag o1 where o.hn=o1.hn and   (o1.icd10="e105" or o1.icd10="e115" or o1.icd10="e125" or o1.icd10="e135" or o1.icd10="e145" ) limit 1)  as DM_with_Peripheral
, (select o1.icd10 from ovstdiag o1 where o.hn=o1.hn and   (o1.icd10="e107" or o1.icd10="e117" or o1.icd10="e127" or o1.icd10="e137" or o1.icd10="e147" ) limit 1)  as DM_with_Multiple
, (select o1.icd10 from ovstdiag o1 where o.hn=o1.hn and   (o1.icd10="e108" or o1.icd10="e118" or o1.icd10="e128" or o1.icd10="e138" or o1.icd10="e148" ) limit 1)  as DM_with_Unspecified
, (select o1.icd10 from ovstdiag o1 where o.hn=o1.hn and   (o1.icd10="e106" or o1.icd10="e116" or o1.icd10="e126" or o1.icd10="e136" or o1.icd10="e146" ) limit 1)  as DM_with_Other
 from ovstdiag o
left outer join patient p on p.hn=o.hn
Left Outer Join thaiaddress  t ON t.addressid=concat(p.chwpart,p.amppart,p.tmbpart)
where o.icd10 between "e10" and "e149" group by o.hn
เอามาจากในนี้แหละครับ
ถ้าำคำถามท่านได้คำตอบที่ต้องการจากอาจารย์ท่านใด กรุณากด Thank เบา ๆ ^ ถูกใจกด [applaud] ไม่ชอบใจกด[smite]
>> การโพสต์ขอรายงานที่ดี <<
อ่านซักนิด ถามยังไงให้ได้คำตอบ ? :)
วิธีแสดงตัวว่าเป็นใคร โดย อ.อ๊อด (ให้ข้อมูลว่าเป็นใคร ปฏิบัติงานที่ไหน ใช้ server อะไร OS อะไร HOsxp Vไหน)
ก่อนที่จะตั้งกระทู้ถาม ลองค้นจากกระทู้เก่าดูก่อนไหม จะได้คำตอบเร็วกว่าการรอคำตอบนะ
..........................................................................
เจษ จพ.เภสัชกรรมฯ user@ NAHAEO HOSPITAL LOEI. <br>  Supervise by DANSAI HOSPITAL LOEI. <br>
Start 01/03/2550
=> Server IBM X3200 Ram 6 Gb. OS:Cent OS 6.0  
=> Client 20 client  OS: SP2  => HosXP Version <b>3.56.11.19</b>
-----------------------------
น้ำเต็มแก้ว "การเรียนรู้ไม่มีที่สิ้นสุด"

ออฟไลน์ nan_it

  • Hero Member
  • *****
  • กระทู้: 578
  • หัวไม่ให้แต่ใจรัก ( อยากเก่งให้มากกว่านี้ )
  • Respect: 0
    • ดูรายละเอียด
    • ramanhospital
Re: ตรวจสอบคำสั่งให้หน่อยครับ
« ตอบกลับ #2 เมื่อ: พฤศจิกายน 12, 2010, 14:02:31 PM »
0
ที่ อ. ให้มามันรวมคนไข้ที่เป็น HT ด้วยครับ ที่ผมลองเขียนคือ ทั้ง pdx dx0 dx1 dx2 dx3 dx4 dx5 ต้องเป็นรหัส e10 ถึง e149 ครับ ไม่รวม I10 ถึง I159
Mr.Anannee Sama ,โรงพยาบาลรามัน อำเภอรามัน จังหวัดยะลา 95140 ( รพ.60 เตียง กำลังจะเป็น รพ.ทั่วไป ครับ)
e-mail : nan_it@hotmail.com
http://www.ramanhospital.com
Server Intel Ram 16 G 
OS CentOS Database Mysql percona xtradb
ขึ้นระบบ กรกฎาคม พ.ศ. 2547
เวอร์ชั่นที่ใช้ 3.54.10.31

ออฟไลน์ woravet

  • Sr. Member
  • ****
  • กระทู้: 409
  • Respect: +12
    • ดูรายละเอียด
Re: ตรวจสอบคำสั่งให้หน่อยครับ
« ตอบกลับ #3 เมื่อ: พฤศจิกายน 12, 2010, 15:23:54 PM »
0
select dm.hn,p.pname,p.fname,p.lname,dm.lastdate
from (select o.hn,max(o.vstdate) lastdate
from ovstdiag o
where o.icd10 between 'E10' and 'E1499'
group by o.hn) dm
left join (select o.hn
from ovstdiag o
where o.icd10 between 'I10' and 'I1599'
group by o.hn) ht on dm.hn=ht.hn
left join patient p on dm.hn=p.hn
where ht.hn is null
รพ.บึงสามัคคี จ.กำแพงเพชร
*********************
อ.สุชัยและคณะ ขึ้นระบบ 29 ตค.49(Linux+Fedara 5)
*********************
ปัจจุบัน
HOSxP version 3.53.4.27
Server:Windows XP SP2,MySQL 5
Client ประมาณ 15 เครื่อง

ออฟไลน์ nan_it

  • Hero Member
  • *****
  • กระทู้: 578
  • หัวไม่ให้แต่ใจรัก ( อยากเก่งให้มากกว่านี้ )
  • Respect: 0
    • ดูรายละเอียด
    • ramanhospital
Re: ตรวจสอบคำสั่งให้หน่อยครับ
« ตอบกลับ #4 เมื่อ: พฤศจิกายน 16, 2010, 14:23:57 PM »
0
select dm.hn,p.pname,p.fname,p.lname,dm.lastdate
from (select o.hn,max(o.vstdate) lastdate
from ovstdiag o
where o.icd10 between 'E10' and 'E1499'
group by o.hn) dm
left join (select o.hn
from ovstdiag o
where o.icd10 between 'I10' and 'I1599'
group by o.hn) ht on dm.hn=ht.hn
left join patient p on dm.hn=p.hn
where ht.hn is null

คำสั่งที่ให้มารันไม่ได้ครับ ฟ้อง hos.dm don't exit ครับ
Mr.Anannee Sama ,โรงพยาบาลรามัน อำเภอรามัน จังหวัดยะลา 95140 ( รพ.60 เตียง กำลังจะเป็น รพ.ทั่วไป ครับ)
e-mail : nan_it@hotmail.com
http://www.ramanhospital.com
Server Intel Ram 16 G 
OS CentOS Database Mysql percona xtradb
ขึ้นระบบ กรกฎาคม พ.ศ. 2547
เวอร์ชั่นที่ใช้ 3.54.10.31

ออฟไลน์ ไม่เสียสละ ชัยชนะไม่เกิด

  • Hero Member
  • *****
  • กระทู้: 1,267
  • Project Maneger
  • Respect: +2
    • ดูรายละเอียด
Re: ตรวจสอบคำสั่งให้หน่อยครับ
« ตอบกลับ #5 เมื่อ: พฤศจิกายน 16, 2010, 14:56:30 PM »
0
ถ้าหากว่าเอาจากรหัสโรคก็น่าจะถูกครับเพราะว่าเท่าที่ดูเงื่อนไขคือเอาคนไข้ที่ถูวินิจฉัยว่าเป็นรหัส E
ทุกประเภท Diag ครับ
เพราะเหมือนคำสั่งที่ผมลองเขียนครับ

select * from vn_stat v
left outer join patient p on v.hn=p.hn
left outer join ovst o on v.vn=o.vn
where  v.vstdate between "2009-10-01" and  "2010-09-30"
and   ( (v.pdx between "E10" and  "E149")
 or (v.dx0 between "E10" and  "E149" )
 or (v.dx1 between "E10" and  "E149")
 or (v.dx2 between "E10" and  "E149")
 or (v.dx3 between "E10" and  "E149")
 or (v.dx4 between "E10" and  "E149")
 or (v.dx5 between "E10" and  "E149")    )
  and v.dx0 <> "I10"
 and v.dx1 <> "I10"
 and v.pdx <> "I10"
 and v.dx2 <> "I10"
 and v.dx3 <> "I10"
 and v.dx4 <> "I10"
 and v.dx5 <> "I10"
ทำไม่ได้ หรือไม่ได้ทำ
 Project Maneger
Bangkok Medical Software Co., Ltd.
2, 2nd Floor, Soi Suksawat 33,
Suksawat Road, Radburana 10140
Thailand