BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: naj ที่ ตุลาคม 11, 2007, 14:45:46 PM

หัวข้อ: วันนัดครั้งต่อไป ในทะเบียนคลินิกพิเศษ
เริ่มหัวข้อโดย: naj ที่ ตุลาคม 11, 2007, 14:45:46 PM
คนไข้นัด ช่อง next_app_date  กลายเป็นปึ 1/1/2443  ทั้งๆที่คนไข้วันที่นัดล่วงหน้า เป็นของเดือนถัดไปครับ จำได้ว่า อ.mn เคยแก้ให้แก้ปัญหานี้ให้โดยการใช้ recheck แต่ไม่ทราบว่ามันกลับมาได้งัยครับเป็นกับบางคน
หัวข้อ: Re: วันนัดครั้งต่อไป ในทะเบียนคลินิกพิเศษ
เริ่มหัวข้อโดย: naj ที่ ตุลาคม 13, 2007, 01:25:15 AM
ในที่สุดก็แก้ได้แล้วครับ (ดีใจเล็กๆ)เนื่องจากไม่อยากที่จะแก้ที่ละแถวครับ เลยลองเขียน pascal script  มาแก้เฉพาะคนไข้คลินิกที่มีวันนัดถัดไปเป็น 1/1/2443 มาเป็นวันนัดตามจริงตามข้อมูลในตาราง oapp
หมายเหตุ ไม่แนะนำให้ไปใช้จริงนะครับ ขอใช้ที่โรงพยาบาลผมที่เดียวดีกว่า เนื่องจากเขียนแบบลองผิดลองถูกครับ ไม่มั่นใจว่าจะใช้กับที่อื่นได้ผลหรือเปล่า แต่ที่ผมทดสอบแล้ว ใช้จริงกับ databases ของโรงพยาบาลแล้ว ใช้ได้ครับ แต่คงต้องให้พี่พยาบาล opd ตรวจสอบอีกครั้งหนึ่ง
เลยฝาก อ.mn ช่วยตรวจสอบว่าผมเขียน pascal script ฉบับลูกทุ่งๆพอไหวไหมครับ 8) 8) 8) 8) 8)
โค๊ด: Pascal
  1. PROGRAM YINDEE;
  2. var
  3. tc,tc1:tclientdataset;
  4.  begin
  5.  tc:=tclientdataset.create(nil);
  6.  tc1:=tclientdataset.create(nil);
  7.  tc.data:=hosxp_getdataset('select * from clinicmember where next_app_date="1900-01-01"  order by hn');
  8.  
  9.  while not tc.eof    do
  10.  begin
  11.  tc1.data:=hosxp_getdataset('select nextdate from oapp where hn="'+tc.fieldbyname('hn').asstring+'"  order by oapp_id  desc limit 1');
  12.    tc.edit;
  13.  tc.fieldbyname('next_app_date').asstring:=tc1.fieldbyname('nextdate').asstring;
  14.  tc.post;
  15.  showdebugtext('HN = '+tc.fieldbyname('hn').asstring+'   CLINIC  = '+tc.fieldbyname('clinic').asstring+' >>>>>> '+'  nextdate = '+
  16.  tc1.fieldbyname('nextdate').asstring);
  17.  tc.next;
  18.  
  19.  end;
  20.  if tc.changecount>0 then
  21.  hosxp_updatedelta(tc.delta,'select * from clinicmember where next_app_date="1900-01-01"  order by hn');
  22.  tc1.free;
  23.  tc.free;
  24.  
  25.  showmessage('Process Done');
  26.  
  27.  
  28.  
  29.  end.

แบบที่ 2 ระบุคลินิกเพิ่มเข้าไปใน TC1
โค๊ด: Pascal
  1. PROGRAM YINDEE;
  2. var
  3. tc,tc1:tclientdataset;
  4.  begin
  5.  tc:=tclientdataset.create(nil);
  6.  tc1:=tclientdataset.create(nil);
  7.  tc.data:=hosxp_getdataset('select * from clinicmember where next_app_date="1900-01-01"  order by hn');
  8.  
  9.  while not tc.eof    do
  10.  begin
  11.  tc1.data:=hosxp_getdataset('select nextdate from oapp where hn="'+tc.fieldbyname('hn').asstring+'" and '+
  12.  'clinic="'+tc.fieldbyname('clinic').asstring+'" order by oapp_id  desc limit 1');
  13.    tc.edit;
  14.  tc.fieldbyname('next_app_date').asstring:=tc1.fieldbyname('nextdate').asstring;
  15.  tc.post;
  16.  showdebugtext('HN = '+tc.fieldbyname('hn').asstring+'   CLINIC  = '+tc.fieldbyname('clinic').asstring+' >>>>>> '+'  nextdate = '+
  17.  tc1.fieldbyname('nextdate').asstring);
  18.  tc.next;
  19.  
  20.  end;
  21.  if tc.changecount>0 then
  22.  hosxp_updatedelta(tc.delta,'select * from clinicmember where next_app_date="1900-01-01"  order by hn');
  23.  tc1.free;
  24.  tc.free;
  25.  
  26.  showmessage('Process Done');
  27.  
  28.  
  29.  
  30.  end.
หัวข้อ: Re: วันนัดครั้งต่อไป ในทะเบียนคลินิกพิเศษ
เริ่มหัวข้อโดย: Khuad ที่ ตุลาคม 13, 2007, 08:51:39 AM
 :o :o..อ.นาจ เก่งจัง.. :o :o
หัวข้อ: Re: วันนัดครั้งต่อไป ในทะเบียนคลินิกพิเศษ
เริ่มหัวข้อโดย: doramon ที่ ตุลาคม 13, 2007, 09:07:48 AM
สุดยอด  :o :o :o :o
หัวข้อ: Re: วันนัดครั้งต่อไป ในทะเบียนคลินิกพิเศษ
เริ่มหัวข้อโดย: SrWooD ที่ ตุลาคม 13, 2007, 10:26:55 AM
สุดยอด ลูกทุ่งครับ
หัวข้อ: Re: วันนัดครั้งต่อไป ในทะเบียนคลินิกพิเศษ
เริ่มหัวข้อโดย: doramon ที่ ตุลาคม 13, 2007, 10:32:46 AM
แต่แปลงครับผมดูข้อมูลผมแล้วปกติดีครับระบบนัด
แสดงว่าเกิดจากการใช้ version ต่างๆๆ ในแต่ละห้องแน่นอนครับ