พอดีผมเพิ่งเขียนรายงาน ประกันสังคมเสร็จ ครับ เขียนตามคำสั่งเจ้าหน้าที่เวชน่ะ ครับ รู้สึกว่าจะใช้ส่งประกันสังคมได้ 2 อาทิตย์แล้ว ครับ ไม่มีปัญหาอะไร แต่พอดีว่ามีท่านผู้รู้มาบอกว่าเขียนผิดครับ เลยไม่มั่นใจ ถามไปว่าผิดตรงก็ได้คำตอบที่ไม่ค่อยจะรู้เรื่อง ครับ เลยต้องส่งมาให้อาจารย์ ทั้งหลายช่วยพิจารณาแล้ว ครับ รหัสสิทธิ์ประกันสังคมที่โรงพยาบาลใช้ "05" ครับ แล้วก็มี diag โรคที่สามารถเบิกประกันสังคมได้ ครับ
รบกวนหน่อบน่ะ ครับ
begin
GetDateRangeDialog(d1, d2);
ds1:=formatdatetime('yyyy-mm-dd ',d1);
ds2:=formatdatetime('yyyy-mm-dd ',d2);
ChangeReportSQL('select v.hn,v.vstdate,concat(p.pname," ",p.fname," ",p.lname) as f_name ,v.cid ,d.licenseno ,pdx,dx0,dx1,dx2,dx3 ,inc12 as "drug", '+
'inc01+inc02+inc03+inc04+inc05+inc06+inc07+inc08+inc09+inc10+inc11+inc13+inc14+inc15+inc16 as "other" , inc01+inc02+inc03+inc04+inc05+inc06+inc07+inc08+inc09+inc10+inc11+inc12+inc13+inc14+inc15+inc16 as "sum" '+
'from vn_stat v '+
'left outer join patient p on p.hn=v.hn '+
'left outer join doctor d on d.code = v.dx_doctor '+
'where v.pttype = "05" '+
'and v.vstdate between "'+ds1+'" and "'+ds2+'" '+
'and ( (v.pdx >= "b180" and v.pdx <= "b182") '+
'or (v.dx0 >= "b180" and v.dx0 <= "b182") '+
'or (v.dx1 >= "b180" and v.dx1 <= "b182") '+
'or (v.dx2 >= "b180" and v.dx2 <= "b182") '+
'or (v.dx3 >= "b180" and v.dx3 <= "b182") '+
'or (v.pdx >= "b188" and v.pdx <= "b189") '+
'or (v.dx0 >= "b188" and v.dx0 <= "b189") '+
'or (v.dx1 >= "b188" and v.dx1 <= "b189") '+
'or (v.dx2 >= "b188" and v.dx2 <= "b189") '+
'or (v.dx3 >= "b188" and v.dx3 <= "b189") '+
'or (v.pdx >= "b200" and v.pdx <= "b24") '+
'or (v.dx0 >= "b200" and v.dx0 <= "b24") '+
'or (v.dx1 >= "b200" and v.dx1 <= "b24") '+
'or (v.dx2 >= "b200" and v.dx2 <= "b24") '+
'or (v.dx3 >= "b200" and v.dx3 <= "b24") '+
'or (v.pdx >= "c000" and v.pdx <= "c97") '+
'or (v.dx0 >= "c000" and v.dx0 <= "c97") '+
'or (v.dx1 >= "c000" and v.dx1 <= "c97") '+
'or (v.dx2 >= "c000" and v.dx2 <= "c97") '+
'or (v.dx3 >= "c000" and v.dx3 <= "c97") '+
'or (v.pdx >= "d560" and v.pdx <= "d569") '+
'or (v.dx0 >= "d560" and v.dx0 <= "d569") '+
'or (v.dx1 >= "d560" and v.dx1 <= "d569") '+
'or (v.dx2 >= "d560" and v.dx2 <= "d569") '+
'or (v.dx3 >= "d560" and v.dx3 <= "d569") '+
'or (v.pdx >= "d600" and v.pdx <= "d619") '+
'or (v.dx0 >= "d600" and v.dx0 <= "d619") '+
'or (v.dx1 >= "d600" and v.dx1 <= "d619") '+
'or (v.dx2 >= "d600" and v.dx2 <= "d619") '+
'or (v.dx3 >= "d600" and v.dx3 <= "d619") '+
'or (v.pdx >= "d66" and v.pdx <= "d66") '+
'or (v.dx0 >= "d66" and v.dx0 <= "d66") '+
'or (v.dx1 >= "d66" and v.dx1 <= "d66") '+
'or (v.dx2 >= "d66" and v.dx2 <= "d66") '+
'or (v.dx3 >= "d66" and v.dx3 <= "d66") '+
'or (v.pdx >= "d693" and v.pdx <= "d693") '+
'or (v.dx0 >= "d693" and v.dx0 <= "d693") '+
'or (v.dx1 >= "d693" and v.dx1 <= "d693") '+
'or (v.dx2 >= "d693" and v.dx2 <= "d693") '+
'or (v.dx3 >= "d693" and v.dx3 <= "d693") '+
'or (v.pdx >= "e050" and v.pdx <= "e059") '+
'or (v.dx0 >= "e050" and v.dx0 <= "e059") '+
'or (v.dx1 >= "e050" and v.dx1 <= "e059") '+
'or (v.dx2 >= "e050" and v.dx2 <= "e059") '+
'or (v.dx3 >= "e050" and v.dx3 <= "e059") '+
'or (v.pdx >= "e100" and v.pdx <= "e139") '+
'or (v.dx0 >= "e100" and v.dx0 <= "e139") '+
'or (v.dx1 >= "e100" and v.dx1 <= "e139") '+
'or (v.dx2 >= "e100" and v.dx2 <= "e139") '+
'or (v.dx3 >= "e100" and v.dx3 <= "e139") '+
'or (v.pdx >= "e232" and v.pdx <= "e232") '+
'or (v.dx0 >= "e232" and v.dx0 <= "e232") '+
'or (v.dx1 >= "e232" and v.dx1 <= "e232") '+
'or (v.dx2 >= "e232" and v.dx2 <= "e232") '+
'or (v.dx3 >= "e232" and v.dx3 <= "e232") '+
'or (v.pdx >= "e780" and v.pdx <= "e789") '+
'or (v.dx0 >= "e780" and v.dx0 <= "e789") '+
'or (v.dx1 >= "e780" and v.dx1 <= "e789") '+
'or (v.dx2 >= "e780" and v.dx2 <= "e789") '+
'or (v.dx3 >= "e780" and v.dx3 <= "e789") '+
'or (v.pdx >= "g20" and v.pdx <= "g22") '+
'or (v.dx0 >= "g20" and v.dx0 <= "g22") '+
'or (v.dx1 >= "g20" and v.dx1 <= "g22") '+
'or (v.dx2 >= "g20" and v.dx2 <= "g22") '+
'or (v.dx3 >= "g20" and v.dx3 <= "g22") '+
'or (v.pdx >= "g35" and v.pdx <= "g35") '+
'or (v.dx0 >= "g35" and v.dx0 <= "g35") '+
'or (v.dx1 >= "g35" and v.dx1 <= "g35") '+
'or (v.dx2 >= "g35" and v.dx2 <= "g35") '+
'or (v.dx3 >= "g35" and v.dx3 <= "g35") '+
'or (v.pdx >= "g700" and v.pdx <= "g709") '+
'or (v.dx0 >= "g700" and v.dx0 <= "g709") '+
'or (v.dx1 >= "g700" and v.dx1 <= "g709") '+
'or (v.dx2 >= "g700" and v.dx2 <= "g709") '+
'or (v.dx3 >= "g700" and v.dx3 <= "g709") '+
'or (v.pdx >= "h400" and v.pdx <= "h428") '+
'or (v.dx0 >= "h400" and v.dx0 <= "h428") '+
'or (v.dx1 >= "h400" and v.dx1 <= "h428") '+
'or (v.dx2 >= "h400" and v.dx2 <= "h428") '+
'or (v.dx3 >= "h400" and v.dx3 <= "h428") '+
'or (v.pdx >= "i10" and v.pdx <= "i159") '+
'or (v.dx0 >= "i10" and v.dx0 <= "i159") '+
'or (v.dx1 >= "i10" and v.dx1 <= "i159") '+
'or (v.dx2 >= "i10" and v.dx2 <= "i159") '+
'or (v.dx3 >= "i10" and v.dx3 <= "i159") '+
'or (v.pdx >= "i500" and v.pdx <= "i509") '+
'or (v.dx0 >= "i500" and v.dx0 <= "i509") '+
'or (v.dx1 >= "i500" and v.dx1 <= "i509") '+
'or (v.dx2 >= "i500" and v.dx2 <= "i509") '+
'or (v.dx3 >= "i500" and v.dx3 <= "i509") '+
'or (v.pdx >= "i690" and v.pdx <= "i698") '+
'or (v.dx0 >= "i690" and v.dx0 <= "i698") '+
'or (v.dx1 >= "i690" and v.dx1 <= "i698") '+
'or (v.dx2 >= "i690" and v.dx2 <= "i698") '+
'or (v.dx3 >= "i690" and v.dx3 <= "i698") '+
'or (v.pdx >= "j430" and v.pdx <= "j439") '+
'or (v.dx0 >= "j430" and v.dx0 <= "j439") '+
'or (v.dx1 >= "j430" and v.dx1 <= "j439") '+
'or (v.dx2 >= "j430" and v.dx2 <= "j439") '+
'or (v.dx3 >= "j430" and v.dx3 <= "j439") '+
'or (v.pdx >= "k730" and v.pdx <= "k746") '+
'or (v.dx0 >= "k730" and v.dx0 <= "k746") '+
'or (v.dx1 >= "k730" and v.dx1 <= "k746") '+
'or (v.dx2 >= "k730" and v.dx2 <= "k746") '+
'or (v.dx3 >= "k730" and v.dx3 <= "k746") '+
'or (v.pdx >= "l100" and v.pdx <= "l109") '+
'or (v.dx0 >= "l100" and v.dx0 <= "l109") '+
'or (v.dx1 >= "l100" and v.dx1 <= "l109") '+
'or (v.dx2 >= "l100" and v.dx2 <= "l109") '+
'or (v.dx3 >= "l100" and v.dx3 <= "l109") '+
'or (v.pdx >= "l123" and v.pdx <= "l123") '+
'or (v.dx0 >= "l123" and v.dx0 <= "l123") '+
'or (v.dx1 >= "l123" and v.dx1 <= "l123") '+
'or (v.dx2 >= "l123" and v.dx2 <= "l123") '+
'or (v.dx3 >= "l123" and v.dx3 <= "l123") '+
'or (v.pdx >= "l130" and v.pdx <= "l139") '+
'or (v.dx0 >= "l130" and v.dx0 <= "l139") '+
'or (v.dx1 >= "l130" and v.dx1 <= "l139") '+
'or (v.dx2 >= "l130" and v.dx2 <= "l139") '+
'or (v.dx3 >= "l130" and v.dx3 <= "l139") '+
'or (v.pdx >= "l400" and v.pdx <= "l409") '+
'or (v.dx0 >= "l400" and v.dx0 <= "l409") '+
'or (v.dx1 >= "l400" and v.dx1 <= "l409") '+
'or (v.dx2 >= "l400" and v.dx2 <= "l409") '+
'or (v.dx3 >= "l400" and v.dx3 <= "l409") '+
'or (v.pdx >= "m050" and v.pdx <= "m0699")'+
'or (v.dx0 >= "m050" and v.dx0 <= "m0699")'+
'or (v.dx1 >= "m050" and v.dx1 <= "m0699")'+
'or (v.dx2 >= "m050" and v.dx2 <= "m0699")'+
'or (v.dx3 >= "m050" and v.dx3 <= "m0699")'+
'or (v.pdx >= "m320" and v.pdx <= "m329") '+
'or (v.dx0 >= "m320" and v.dx0 <= "m329") '+
'or (v.dx1 >= "m320" and v.dx1 <= "m329") '+
'or (v.dx2 >= "m320" and v.dx2 <= "m329") '+
'or (v.dx3 >= "m320" and v.dx3 <= "m329") '+
'or (v.pdx >= "n040" and v.pdx <= "n049") '+
'or (v.dx0 >= "n040" and v.dx0 <= "n049") '+
'or (v.dx1 >= "n040" and v.dx1 <= "n049") '+
'or (v.dx2 >= "n040" and v.dx2 <= "n049") '+
'or (v.dx3 >= "n040" and v.dx3 <= "n049") '+
'or (v.pdx >= "n180" and v.pdx <= "n189") '+
'or (v.dx0 >= "n180" and v.dx0 <= "n189") '+
'or (v.dx1 >= "n180" and v.dx1 <= "n189") '+
'or (v.dx2 >= "n180" and v.dx2 <= "n189") '+
'or (v.dx3 >= "n180" and v.dx3 <= "n189") '+
'or (v.pdx >= "n251" and v.pdx <= "n251") '+
'or (v.dx0 >= "n251" and v.dx0 <= "n251") '+
'or (v.dx1 >= "n251" and v.dx1 <= "n251") '+
'or (v.dx2 >= "n251" and v.dx2 <= "n251") '+
'or (v.dx3 >= "n251" and v.dx3 <= "n251")) ')
end ;