BMS-HOSxP Community

HOSxP => Delphi / Pascal => ข้อความที่เริ่มโดย: Khuad ที่ มกราคม 17, 2011, 15:07:35 PM

หัวข้อ: ฝาก script ให้ golf_win ครับ
เริ่มหัวข้อโดย: Khuad ที่ มกราคม 17, 2011, 15:07:35 PM

... ลองทดสอบดูก่อนนะ  พี่ทดสอบดูของพี่แล้วไม่ช้า

    ตรง and depcode in ("008","010","050")  ก็ใส่แผนกของจุด screen

    ตรง form_name = "Lab Checkup (DM)" ก็ใส่ชื่อฟอร์ม lab ที่เราใช้ส่งตรวจ
 
    ...  :D ....


var
  fvn,fcomputername,fdepartment,fhn : string;
  fdate_1,fdate_2,fdate_3 : string;
  DM_HN,HT_HN : string;
  tc : TClientDataset;

begin

  fvn := GetGlobalValue('VN');
  fcomputername := GetGlobalValue('CURRENT_COMPUTER');
  fdepartment := GetGlobalValue('CURRENT_DEPCODE');
  fhn := getsqldata('select hn from ovst where vn = "'+fvn+'" ');

  {==================== Screen ====================}
  if getsqldata('select depcode from kskdepartment where depcode = "'+fdepartment+'" '+
  'and depcode in ("008","010","050") ') = ''+fdepartment+''  then
    begin

        fdate_1 := formatdatetime('yyyy',getsqldata('select curdate()'));

      if getsqldata('select count(vn) as cc from ovst where vn = "'+fvn+'" '+
      'and month(vstdate) in ("10","11","12")') > 0 then
        begin
        fdate_2 := fdate_1+'-10-01" and "'+inttostr(strtoint(fdate_1) + 1)+'-09-30';
        fdate_3 := inttostr(strtoint(fdate_1) + 544);
        end
        else
        begin
        fdate_2 := inttostr(strtoint(fdate_1) - 1)+'-10-01" and "'+fdate_1+'-09-30';
        fdate_3 := inttostr(strtoint(fdate_1) + 543);
        end;

      DM_HN := getsqlsubquerydata('select hn from clinicmember where clinic = "001"');
      HT_HN := getsqlsubquerydata('select hn from clinicmember where clinic = "002"');
  {-------------------------------------------------------------------------------------------}
        if getsqldata('select count(distinct hn) as cc from clinicmember '+
        'where clinic = "001" and hn = "'+fhn+'" ') > 0 then
          begin
            if getsqldata('select count(*) as cc from lab_head '+
            'where report_date between "'+fdate_2+'"  '+
            'and hn = "'+getsqldata('select hn from ovst where vn = "'+fvn+'"')+'" '+
            'and hn in ('+DM_HN+') '+
            'and form_name = "Lab Checkup (DM)" ') > 0 then
            showmessage(' <<< เป็นผู้ป่วยในคลีนิคเบาหวาน  ได้รับการตรวจ Lab_Checkup(DM) ประจำปีงบประมาณ  '+fdate_3+'  นี้แล้ว >>> ')
            else
            showmessage(' <<< เป็นผู้ป่วยในคลีนิคเบาหวาน  ยังไม่เคยได้รับการตรวจ Lab_Checkup(DM) ประจำปีงบประมาณ  '+fdate_3+'  >>> ');
          end;
   {-------------------------------------------------------------------------------------------}
        if getsqldata('select count(*) as cc from ovstdiag where vn = "'+fvn+'" '+
        'and hn not in ('+DM_HN+') '+
        'and (icd10 between "E10" and "E1499")') > 0 then
          begin
            showmessage(' <<< ผู้ป่วยได้รับการ diag ว่าเป็นโรคเบาหวาน  แต่ยังไม่ได้ขึ้นทะเบียนผู้ป่วยคลีนิคเบาหวาน >>> ');
          end;
  {-------------------------------------------------------------------------------------------}
        if getsqldata('select count(*) as cc from ovstdiag where vn = "'+fvn+'" '+
        'and hn not in ('+HT_HN+') '+
        'and (icd10 between "I10" and "I1599")') > 0 then
          begin
            showmessage(' <<< ผู้ป่วยได้รับการ diag ว่าเป็นโรคความดันโลหิตสูง  แต่ยังไม่ได้ขึ้นทะเบียนผู้ป่วยคลีนิคความดันโลหิตสูง >>> ');
          end;

    end;


end;

หัวข้อ: Re: ฝาก script ให้ golf_win ครับ
เริ่มหัวข้อโดย: SrWooD ที่ มกราคม 17, 2011, 16:22:09 PM
ได้ผลอย่างไร แจ้งให้ทราบด้วยครับ จะได้นำไปใช้บ้าง

 ;D ;D ;D
หัวข้อ: Re: ฝาก script ให้ golf_win ครับ
เริ่มหัวข้อโดย: Khuad ที่ มกราคม 17, 2011, 16:25:33 PM
ได้ผลอย่างไร แจ้งให้ทราบด้วยครับ จะได้นำไปใช้บ้าง

 ;D ;D ;D

....  Work     ผมใช้แล้ว 
   
                ตอนนี้ระบบยังไม่ล่ม 55555555  ...  ;D ....
หัวข้อ: Re: ฝาก script ให้ golf_win ครับ
เริ่มหัวข้อโดย: golf_win ที่ มกราคม 17, 2011, 17:54:17 PM
กำลังทดสอบกับ slav ครับ ;) ;)