ผู้เขียน หัวข้อ: ใบงบหน้าค่ารักษาพยาบาลผู้ป่วยใน hosxp v.49.10.10  (อ่าน 5098 ครั้ง)

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

ออฟไลน์ naj

  • Hero Member
  • *****
  • กระทู้: 2,449
  • Respect: +8
    • ดูรายละเอียด
    • http://www.luangphopern-hospital.com
สืบเนื่องมาจากรายการค่ารักษาพยาบาลของผู้ป่วนใน ส่วนของใบงบหน้าค่ารักษาพยาบาลผู้ป่วยใน  ไม่ตรงกันกลับใน finance sheet(ซึ่งถูกต้องตรงตามจริงแล้ว) บางครั้งยอดเบิ้ล(รพ นครนายกแจ้งมาครับ) และในส่วนที่ รพ หลวงพ่อเปิ่นเองก็พบเช่นเดียวกันแต่จะเป็นจากการกำหนดค่าในตาราง income_group กับincome_report2  กลุ่มค่ารักษาบางตัวไม่เชื่อมกัน ทำให้เวลาเรียกรายงาน ใบงบหน้าค่ารักษาพยาบาลผู้ป่วยใน  มันจะทำให้ยอดค่ารักษาหายไปบางส่วน ต้องกลับมาแก้ในส่วนของ  2 ตารางนี้ใหม่จึงจะใช้งานได้ อยากเรียนถามถึงความสัมพันธ์ที่อ.mn เขียนไว้ใน pascal script ในใบงบหน้าค่ารักษาพยาบาลผู้ป่วยใน ครับเพื่อที่จะได้ให้ รพ อื่นๆที่เจอปัญหานี้ได้นำไปใช้ได้ง่ายขึ้น
ขอบคุณครับ
Yindee And Tan

ออฟไลน์ naj

  • Hero Member
  • *****
  • กระทู้: 2,449
  • Respect: +8
    • ดูรายละเอียด
    • http://www.luangphopern-hospital.com
Re: ใบงบหน้าค่ารักษาพยาบาลผู้ป่วยใน hosxp v.49.10.10
« ตอบกลับ #1 เมื่อ: ตุลาคม 11, 2006, 22:26:38 PM »
0
จากที่สังเกตเพิ่มเติม พบว่าถึงแม้จะมีการเชื่อมกลุ่มค่ารักษาในตาราง income_group กับ income_report2 เอาไว้แล้วแต่กลุ่มค่ารักษาบางตัวก็ไม่แสดงใบงบหน้าค่ารักษาพยาบาลผู้ป่วยใน ถ้ารหัสกลุ่มค่ารักษาใน 2 ตารางนั้นไม่ตรงกัน   ต้องกลับมาแก้ให้เลขที่กลุ่มค่ารักษาตรงกันก่อนจึงจะใช้งานได้ แต่กลุ่มค่ารักษาบางตัวก็แสดงทั้งๆที่ไม่ได้แก้ให้เลขที่กลุ่มค่ารักษาตรงกัน
ตอนนี้ก็ยังสับสน อยู่ครับ :-\
Yindee And Tan

ออฟไลน์ manoi

  • Hero Member
  • *****
  • กระทู้: 8,669
  • Respect: +170
    • ดูรายละเอียด
    • HOSxP Community Center
Re: ใบงบหน้าค่ารักษาพยาบาลผู้ป่วยใน hosxp v.49.10.10
« ตอบกลับ #2 เมื่อ: ตุลาคม 11, 2006, 22:39:45 PM »
0
ส่งคำสั่งเดิมที่ใช้เข้ามาด้วยครับ
HOSxP Project Manager / Cheif Developer / BMS MD

ออฟไลน์ naj

  • Hero Member
  • *****
  • กระทู้: 2,449
  • Respect: +8
    • ดูรายละเอียด
    • http://www.luangphopern-hospital.com
Re: ใบงบหน้าค่ารักษาพยาบาลผู้ป่วยใน hosxp v.49.10.10
« ตอบกลับ #3 เมื่อ: ตุลาคม 12, 2006, 01:52:15 AM »
0
ส่งคำสั่งที่ใช้ครับ ถ้าจะให้อ.mn รวมยอดเงินเบิกได้กับเบิกไม่ได้ไว้ในบรรทัดสุดท้ายได้ไหมครับ
unit MyIPDReport;

function getsqlsubquerydatax(sql:string):string;
begin
  result:='';
  zquery.close;
  zquery.sql.text:=sql;
  zquery.open;
  zquery.first;
    while not zquery.eof do
    begin
       if result='' then result:=''''+zquery.fields[0].asstring+'''' else
       result:=result+','''+zquery.fields[0].asstring+'''';

       zquery.next;
    end;
  zquery.close;
    if result='' then result:='''''';

end;

procedure main;
var d1,d2:tdatetime;
people_distinct_count1 : integer;
people_count1 : integer;
ds1,ds2:string;
pttype_list1 : string;
pttype,pttype_name:string;
hospcode_list:string;
money1:currency;
i:integer;
fan:string;
st1:string;
st2:string;
lo:integer;

begin
   //showmessage('à¡ÕèÂǡѺÃÒ§ҹ'+#13+'Custom IN-Patient Summary');

   // test with an 461402487

   fan := '490000097';
   if preset_value(1)='' then
   begin
     if not inputquery('Please enter Admit Number','AN',fan) then exit;
   end else
   begin
     fan:=preset_value(1);
   end;

   zquery.sql.text:='delete from tempreport where id = "CUSTOM-IPT1" ';
   zquery.execsql;

   if getsqldata('select count(*) as cc from ipt where an="'+fan+'"')=0 then
      raise exception.create('Invalid AN');
     
     
   if getsqldata('select count(*) as cc from income_report2')=0 then
   begin
     zquery.close;
     zquery.sql.text:='INSERT INTO income_report2 (group_id, group_name) VALUES '+
  '  (1,''¤èÒËéͧ/¤èÒÍÒËÒÃ''), '+
  '  (2,''ÍÇÑÂÇÐà·ÕÂÁ/ÍØ»¡Ã³ì㹡ÒúӺѴÃÑ¡ÉÒ''), '+
  '  (3,''ÂÒáÅÐÊÒÃÍÒËÒ÷ҧàÊé¹àÅ×Í´·Õèãªé㹠þ.''), '+
  '  (4,''ÂÒ·Õè¹Óä»ãªéµèÍ·ÕèºéÒ¹''), '+
  '  (5,''àǪÀѳ±ì·ÕèäÁèãªèÂÒ''), '+
  '  (6,''ºÃÔ¡ÒÃâÅËÔµáÅÐÊèǹ»ÃСͺ¢Í§âÅËÔµ''), '+
  '  (7,''µÃǨÇÔ¹Ô¨©Ñ·ҧ෤¹Ô¤¡ÒÃá¾·ÂìáÅоÂÒ¸ÔÇÔ·ÂÒ''), '+
  '  (8,''µÃǨÇÔ¹Ô¨©ÑÂáÅÐÃÑ¡ÉÒ·Ò§ÃѧÊÕÇÔ·ÂÒ''), '+
  '  (9,''µÃǨÇÔ¹Ô¨©ÑÂâ´ÂÇÔ¸Õ¾ÔàÈÉÍ×è¹æ''), '+
  '  (10,''ÍØ»¡Ã³ì¢Í§ãªéáÅÐà¤Ã×èͧÁ×Í·Ò§¡ÒÃá¾·Âì''), '+
  '  (11,''·ÓËѵ¶¡ÒÃáÅкÃÔ¡ÒÃÇÔÊÑ­­Õ''), '+
  '  (12,''¤èÒºÃÔ¡Ò÷ҧ¡ÒþÂÒºÒÅ''), '+
  '  (13,''ºÃÔ¡Ò÷ҧ·Ñ¹µ¡ÃÃÁ''), '+
  '  (14,''ºÃÔ¡Ò÷ҧ¡ÒÂÀÒ¾ºÓºÑ´áÅÐàǪ¡ÃÃÁ¿×鹿Ù''), '+
  '  (15,''ºÃÔ¡Òýѧà¢çÁ/¡ÒúӺѴ¢Í§¼Ùé»ÃСͺâäÈÔÅ»ÐÍ×è¹æ''), '+
  '  (16,''ºÃÔ¡ÒÃÍ×è¹·ÕèäÁèà¡ÕèÂÇ¢éͧ¡Ñº¡ÒÃÃÑ¡ÉÒ'') ';
     zquery.execsql;

   
   end;   


   zquery.sql.text:='delete from tempreport where id = "CUSTOM-IPT1" ';
   zquery.execsql;
   fcds.close;
   fcds.datarequest('select * from tempreport where id = "CUSTOM-IPT1" ');
   fcds.open;

   fcds2.close;

   fcds2.datarequest('select * from an_stat where an= "'+fan+'" ');
   fcds2.open;
   setstatuslabel('Open result : '+inttostr(fcds2.recordcount)+' Records');

   if fcds2.recordcount=0 then
   begin
     showmessage('Invalid AN');
     exit;
   end;
   
   fcds3.close;
   fcds3.datarequest('select r.group_id,r.group_name,sum(h1.rcptamt) as total1,sum(h2.rcptamt) as total2 '+
    ' from income_report2 r '+
    ' left outer join income i on i.income_group=r.group_id '+
    ' left outer join incith h1 on h1.income=i.income and h1.an="'+fan+'" and h1.paidst in ("01","00","02") '+
    ' left outer join incith h2 on h2.income=i.income and h2.an="'+fan+'" and h2.paidst in ("03") '+
    ' group by r.group_id, r.group_name '+
    ' order by r.group_id ');
   fcds3.open;
   fcds3.first;
   while not fcds3.eof do
   begin

   fcds.insert;
   fcds['id']:='CUSTOM-IPT1';
   fcds['reportname']:='CUSTOM-IPT1';

   fcds['name1']:=getsqldata('select concat(pname,fname,"  ",lname) as name from patient where hn="'+
      fcds2['hn']+'"');
   fcds['name2']:=fan;
   fcds['name3']:=fcds2['hn'];
   
 
   // address
     st2:='';
     st1:=vartostr(getsqldata('select addrpart from patient where hn="'+fcds2['hn']+'"'));
     st2:=st1;  // assign address part
     st1:=vartostr(getsqldata('select moopart from patient where hn="'+fcds2['hn']+'"'));
     if st1<>'' then
       st2:=st2+' &Euml;&Aacute;&Ugrave;&egrave; '+st1;
     st1:=vartostr(getsqldata('select road from patient where hn="'+fcds2['hn']+'"'));
     if st1<>'' then
       st2:=st2+' &para;. '+st1;
     st1:=vartostr(getsqldata('select name from thaiaddress where concat(chwpart,amppart,tmbpart)="'+
          fcds2['aid']+'"'));

     st2:=st2+' &micro;.'+st1;


     st1:=vartostr(getsqldata('select name from thaiaddress where concat(chwpart,amppart,tmbpart)="'+
          copy(fcds2['aid'],1,4)+'00"'));

     st2:=st2+' &Iacute;.'+st1;

     st1:=vartostr(getsqldata('select name from thaiaddress where concat(chwpart,amppart,tmbpart)="'+
          copy(fcds2['aid'],1,2)+'0000"'));

     st2:=st2+' &uml;.'+st1;

   fcds['name5']:= st2;

   st1:=vartostr(getsqldata('select name from icd101 where code="'+copy(vartostr(fcds2['pdx']),1,3)+'" '));
   
   fcds['name4']:=vartostr(fcds2['pdx'])+' '+st1;
   
   st1:=vartostr(getsqldata('select name from icd101 where code="'+copy(vartostr(fcds2['dx0']),1,3)+'"'));
   
   fcds['name8']:= vartostr(fcds2['dx0'])+' '+st1;
   

   fcds['name6']:=vartostr(getsqldata('select cid from vn_stat where vn="'+fcds2['vn']+'"'));
   
   st1:=vartostr(getsqldata('select dch_doctor from ipt where an="'+fan+'"'));
   st1:=vartostr(getsqldata('select name from doctor where code="'+st1+'"'));
   
   fcds['name7']:=st1;
   
   st1:=vartostr(getsqldata('select pttype from ipt where an="'+fan+'"'));
   st1:=vartostr(getsqldata('select name from pttype where pttype="'+st1+'"'));
   
   fcds['name7']:=vartostr(fcds['name7'])+'        &Ecirc;&Ocirc;&middot;&cedil;&Ocirc;&iexcl;&Ograve;&Atilde;&Atilde;&Ntilde;&iexcl;&Eacute;&Ograve; '+st1;
   
   
   fcds['num1']:=fcds2['age_y'];
   fcds['num2']:=fcds2['age_m'];
   fcds['num3']:=fcds2['age_d'];
   fcds['num4']:=1;

   fcds['date1']:=fcds2['regdate'];
   fcds['date2']:=fcds2['dchdate'];
  // fcds['date4']:=fcds2['vstdate'];
 
   
   
    try fcds['name9']:=fcds3['group_name']; except end;
    try fcds['mon1']:=fcds3['total1']; except fcds['mon1']:=0; end;
    try fcds['mon2']:=fcds3['total2']; except fcds['mon2']:=0; end;
    try fcds['mon3']:=fcds3['group_id']; except end;
 
     try fcds['mon4']:=fcds2['admdate']; except end;
 
   fcds.post;

    fcds3.next;
   end;
   fcds3.close;


   fcds.datarequest('select * from tempreport where id = "CUSTOM-IPT1" ');
   applyupdate_fcds();

end;

end.
Yindee And Tan