ผู้เขียน หัวข้อ: จะยกเลิกตัวเลือกสิทธิ์การรักษา  (อ่าน 4004 ครั้ง)

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

ออฟไลน์ Bluebird

  • Hero Member
  • *****
  • กระทู้: 1,062
  • Respect: +2
    • ดูรายละเอียด
    • โรงพยาบาลระแงะ จังหวัดนราธิวาส
จะยกเลิกตัวเลือกสิทธิ์การรักษา
« เมื่อ: พฤศจิกายน 02, 2009, 09:05:08 AM »
0
รายงานผู้ป่วยในที่ถูกจำหน่าย
แต่จะยกเลิก รายการ list สิทธิการรักษา อยากให้ปรากฏทุกสิทธิ  ต้องแก้ไขคำสั่งบรรทัดไหนครับ
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,s1,s2 : integer;
ds1,ds2:string;
pttype_list1 : string;
pttype,pttype_name:string;
hospcode_list:string;
pcode_show:string;
money1,inc_limit:currency;
i:integer;

begin
   //showmessage('เกี่ยวกับรายงาน'+#13+'Custom OPD-NK2');

   //pttype:= getpickuplist('select name from pttype where isuse="Y" order by name');
   //showmessage('use name = '+pttype);
   //if pttype='' then exit;

   //pttype_name:=pttype;

   //pttype:=getsqldata('select pcode from pttype where name="'+pttype+'"');
   //if pttype='UA' then pttype:='UC';
   //if pttype='UB' then pttype:='UC';

   //if pttype='UC' then pttype_name:=getsqlsubquerydata('select name from pttype where pcode in ("UC","UA","UB")') else
   // pttype_name := getsqlsubquerydata('select name from pttype where pcode="'+pttype+'"');

   //showmessage('use pcode = '+pttype);

   if not getdaterange() then exit;
   d1:=date_result1();
   d2:=date_result2();

  // showmessage(formatdatetime('yyyy-mm-dd',d1)+' - '+
   //  formatdatetime('yyyy-mm-dd',d2));

   ds1:=formatdatetime('yyyy-mm-dd',d1);
   ds2:=formatdatetime('yyyy-mm-dd',d2);
   

   //hospcode_list:=getsqlsubquerydata('select distinct hospmain from vn_stat where  vstdate between "'+ds1+'" and "'+ds2+'" '); // pcode = "'+pttype+'" and
   //hospcode_list := getpickuplist('select concat(hospcode,":",hosptype," ",name) as name from hospcode where hospcode in ('+
    // hospcode_list+') ');
   hospcode_list:=getsqlsubquerydata('select pttype from an_stat where  dchdate between "'+ds1+'" and "'+ds2+'" '); // pcode = "'+pttype+'" and
   hospcode_list := getpickuplist('select concat(pttype,":",name) as name from pttype  where pttype in ('+
   hospcode_list+')  ');

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

   fcds2.close;
   //showmessage('use pcode = '+ds1+'" "'+ds1);
   if hospcode_list='' then
   fcds2.datarequest('select * from an_stat left join rcpt_print on an_stat.an=rcpt_print.vn   where dchdate between "'+ds1+'" and "'+ds2+'" group by an_stat.an ') //and pttype_dansai.ipd=1 pcode = "'+pttype+'" and
   else
   fcds2.datarequest('select * from an_stat left join rcpt_print on an_stat.an=rcpt_print.vn   where dchdate between "'+ds1+'" and "'+ds2+'"  '+  //and pttype_dansai.ipd=1 pcode = "'+pttype+'" and
   ' and an_stat.pttype="'+copy(hospcode_list,1,2)+'" group by an_stat.an order by an_stat.pttype '); //hospmain vn
   
   
   //fcds2.datarequest('select * from an_stat left join pttype on an_stat.pttype=pttype.pttype left join pttype_dansai on pttype.fee_code=pttype_dansai.fee_code where dchdate between "'+ds1+'" and "'+ds2+'" '); //and pttype_dansai.ipd=1 and paid_money<>"0.00" pcode = "'+pttype+'" and
   //else
   //fcds2.datarequest('select * from pttype inner join an_stat on pttype.pttype=an_stat.pttype inner join pttype_dansai on pttype.fee_code=pttype_dansai.fee_code where  an_stat.dchdate between "'+ds1+'" and "'+ds2+'" '+  // pcode = "'+pttype+'" and
   //' and hospmain="'+copy(hospcode_list,1,5)+'" order by pttype '); // vn
   fcds2.open;
   setstatuslabel('Open result : '+inttostr(fcds2.recordcount)+' Records');
   fcds2.first;
   i:=0;
   while not fcds2.eof do
   begin
    i:=i+1;
    setprogressbar(i,fcds2.recordcount);
     fcds.insert;
   fcds['id']:='CUSTOM-NK1IPD';
   fcds['reportname']:='CUSTOM-NK1IPD';
   fcds['name']:=fcds2['an'];
   //fcds['name1']:=pttype_name;
   //pcode_show:=getsqldata('select pttype from patient where hn="'+fcds2['hn']+'"');
   //showmessage('คุณใช้ pcode = '+pcode_show);
   fcds['name1']:=getsqldata('select concat(pttype," ",name) as name from pttype where pttype="'+
      fcds2['pttype']+'"');
   
   fcds['name2']:=getsqldata('select concat(pname,fname,"  ",lname) as name from patient where hn="'+
      fcds2['hn']+'"');
   fcds['name3']:=fcds2['hn'];
   fcds['name4']:=fcds2['pttypeno'];
   //fcds['date3']:=fcds2['pttype_expire'];
   fcds['name5']:=fcds2['an'];
   //fcds['name5']:=getsqldata('select concat(name,", ",hosptype) as name from hospcode where hospcode="'+
    // fcds2['hospmain']+'"');
   //fcds['name6']:=fcds2['cid'];
   if fcds2['sex']='1' then
     fcds['name7']:='ช' else
     fcds['name7']:='ญ';
   fcds['num1']:=fcds2['age_y'];
   fcds['name8']:=fcds2['pdx'];
   fcds['name9']:=fcds2['op0']+' '+fcds2['op1'];
   fcds['name10']:=fcds2['admdate'];
   fcds['name']:=getsqldata('select i_refer_number from ovst where vn="'+fcds2['vn']+'"');

   // finance summary

   fcds['mon1']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income in("00","01")');
   //fcds2['inc16'];
   fcds['mon2']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="02" group by income');
   //fcds2['inc08'];
   fcds['mon3']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="03" group by income');
   //fcds2['inc12'];
   fcds['mon4']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="19" group by income');
   //fcds2['inc10'];
   fcds['mon5']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="04" group by income');
   //fcds2['inc03'];
   fcds['mon6']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="05" group by income');
   //fcds2['inc02'];
   fcds['mon7']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="06" group by income');
   //fcds2['inc01'];
   fcds['mon8']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="07" group by income');
   //fcds2['inc04'];
   inc_limit:=getsqldata('select rcptamt from incith where an="'+
      fcds2['an']+'" and paidst="04"');
   fcds['mon9']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="11" group by income');
   //fcds2['inc05'];
   fcds['mon10']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="08" group by income');
   //fcds2['inc09'];
   fcds['mon12']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="10" group by income');
   //fcds2['inc14'];
   fcds['mon13']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="12" group by income');
   //fcds2['inc11'];
   fcds['mon14']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="13" group by income');
   //fcds2['inc13'];
   fcds['mon15']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="14" group by income');
   //fcds2['inc07'];
   fcds['mon16']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="16" group by income');
   //fcds2['inc15'];
   fcds['mon17']:=fcds2['inc17'];
   //getsqldata('select sum(sum_price) from opitemrece where an="'+fcds2['an']+'" and income="17" group by income');
 
   fcds['mon11']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'" and income="09" group by income');
   //fcds2['inc06'];
       //fcds2['inc00']+fcds2['inc18'];
   fcds['mon18']:=getsqldata('select sum(sum_price) as cc from opitemrece where an="'+fcds2['an']+'"')+fcds2['inc17'];
   //fcds2['income'];
   
   
   s1:=getsqldata('select sum(rcptamt) as cc from rcpt_print_detail where vn="'+fcds2['an']+'" and paidst="04"');
   s2:=getsqldata('select bill_amount as cc from rcpt_print where vn="'+fcds2['an']+'" ');
   //s1:=getsqldata('select sum(rcptamt) as cc from rcpt_print_detail where vn="'+fcds2['an']+'" and paidst="04"');
   //s2:=getsqldata('select sum(rcptamt) as cc from rcpt_print_detail where vn="'+fcds2['an']+'" and paidst in("01","03")');
   fcds['mon20']:=s2;
   fcds['mon19']:=s1;
   //fcds['mon20']:=fcds2['rcpt_money'];
   //fcds['mon19']:=inc_limit;
   try
      fcds['date1']:=ds1;
    except
    end;
   try
      fcds['date2']:=ds2;
    except
    end;
   fcds['date4']:=fcds2['dchdate'];
   fcds['name11']:=getsqldata('select deposit_note from finance_deposit where vn="'+fcds2['vn']+'"  ');
   
     fcds2.next;
   end;
    fcds.post;
   fcds.datarequest('select * from tempreport where id = "CUSTOM-NK1IPD" '); 
   applyupdate_fcds();

end;

end.
นักวิชาการคอมพิวเตอร์ โรงพยาบาลระแงะ  จังหวัดนราธิวาส
www.rangaehospital.com

เริ่มใช้งานระบบ 1 ตุลาคม 2550
Server     :  HP Proliant DL180G6 RAM 16Gb. 
Replicate  : DELL PowerEdge 1800   RAM 16 Gb.
MySQL 5.5.31
OS CentOS 5 64bit
HOSxP Version : 3.59.4.27(ตาม Version ที่ออกใหม่ล่าสุด)

ออฟไลน์ SrWooD

  • Hero Member
  • *****
  • กระทู้: 1,024
  • Respect: +1
    • ดูรายละเอียด
Re: จะยกเลิกตัวเลือกสิทธิ์การรักษา
« ตอบกลับ #1 เมื่อ: พฤศจิกายน 02, 2009, 09:48:55 AM »
0
ตอน list ลองเลือกเป็นว่างๆ ดูครับ

 ;D ;D ;D
โรงพยาบาลโพธิ์ทอง จังหวัดอ่างทอง

ออฟไลน์ armds

  • Hero Member
  • *****
  • กระทู้: 1,084
  • armds
  • Respect: +10
    • ดูรายละเอียด
Re: จะยกเลิกตัวเลือกสิทธิ์การรักษา
« ตอบกลับ #2 เมื่อ: พฤศจิกายน 02, 2009, 16:27:56 PM »
0
รายงานนี้ผมเขียนเองครับ  มันจะแสดงสิทธิ  ตามสิทธิของคนไข้ครับ   มีขั้นตอนดังนี้ครับ
คือ 
1.  เลือกช่วงวันที่ก่อน
2.  แล้วเลือกคนไข้ที่  dchdate  ในช่วงวันที่นี้
    hospcode_list:=getsqlsubquerydata('select pttype from an_stat where  dchdate between "'+ds1+'" and "'+ds2+'" ');
3.  เลือกสิทธิ  ที่มีรายชื่อคนไข้  ในช่วงวันทีี่นี้
    hospcode_list := getpickuplist('select concat(pttype,":",name) as name from pttype  where pttype in ('+
   hospcode_list+')  ');
4.  สิทธิก็จะแสดง  เฉพาะ  สิทธิที่คนไข้  dchdate  ในช่วงวันที่นี้เท่านั้น  จะไม่แสดงทุกสิทธิครับ  แต่ให้แสดงทุกสิทธิ  เวลาดึงข้อมูลมาก็จะไม่มีข้อมูลอยู่ดีครับ 
5.  และหากต้องการดึุงข้อมูลทุกสิทธิ  ก็ไม่ต้องระบุ  สิทธิ ครับ  เหมือนที่ท่าน  SrwooD  บอกอะครับ  มันก็จะดึงมาทุกสิทธิเลยครับ
    if hospcode_list='' then
   
โรงพยาบาลสมเด็จพระยุพราชด่านซ้าย จ.เลย
ขนาด 60 เตียง นวก. คอมพิวเตอร์ ขึ้นระบบ ปี 2548
ขอบคุณ อ.ชัยพร อ.สุชัย อ.เดชา อ.doreamon อ.naj อ.ขวด และอ.ในเว็บ hosxp.net ทุกท่าน