BMS-HOSxP Community

HOSxP => แจ้งปัญหา / ขอความช่วยเหลือ => ข้อความที่เริ่มโดย: xycop ที่ มกราคม 28, 2013, 14:56:07 PM

หัวข้อ: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: xycop ที่ มกราคม 28, 2013, 14:56:07 PM
begin

if  DBPipeline['sex']=1 then
     if  DBPipeline['creatinine']<=0.9 then
       Value :=141*exp(-0.411*ln(DBPipeline['creatinine']/0.9))*exp(DBPipeline['age_y']*ln(0.993))
       else
       Value:=141*exp(-1.209*ln(DBPipeline['creatinine']/0.9))*exp(DBPipeline['age_y']*ln(0.993));
if  DBPipeline['sex']=2 then
     if DBPipeline['creatinine']<=0.7 then
         Value:=144*exp(-0.329*ln(DBPipeline['creatinine']/0.7))*exp(DBPipeline['age_y']*ln(0.993))
         else
         Value:=144*exp(-1.209*ln(DBPipeline['creatinine']/0.7))*exp(DBPipeline['age_y']*ln(0.993));
end;
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: xycop ที่ มกราคม 29, 2013, 09:54:02 AM
ดันครับ
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: Terminator2015 ที่ มกราคม 29, 2013, 10:00:36 AM
 ;) ผมว่าตอนนี้ไม่ต้องเขียนคำนวณแล้วนะครับ เพราะ อ.MN บันทึกค่านี้ลงใน opdscreen ฟิวส์ egfr แล้วครับ เป็นสูตร CDK-EPI ตามที่ท่านเขียนนี้ล่ะครับ ถ้าเขียน ผมว่าไปเขียนแยก Stage ดีกว่าครับ  ;D
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: James011 ที่ มกราคม 29, 2013, 10:12:52 AM
begin

if  DBPipeline['sex']=1 then
     if  DBPipeline['creatinine']<=0.9 then
       Value :=141*exp(-0.411*ln(DBPipeline['creatinine']/0.9))*exp(DBPipeline['age_y']*ln(0.993))
       else
       Value:=141*exp(-1.209*ln(DBPipeline['creatinine']/0.9))*exp(DBPipeline['age_y']*ln(0.993));
if  DBPipeline['sex']=2 then
     if DBPipeline['creatinine']<=0.7 then
         Value:=144*exp(-0.329*ln(DBPipeline['creatinine']/0.7))*exp(DBPipeline['age_y']*ln(0.993))
         else
         Value:=144*exp(-1.209*ln(DBPipeline['creatinine']/0.7))*exp(DBPipeline['age_y']*ln(0.993));
end;
     ;D ;D  ตัวหารเป็น  0
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: xycop ที่ มกราคม 30, 2013, 09:26:34 AM
procedure Variable35OnCalc(var Value: Variant);
begin

  if (DBPipeline['egfr']='')  then s := '0' ;
    Value := strtofloat(s);

end;
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: thannawe ที่ มกราคม 30, 2013, 11:47:57 AM
เทพ  ;D :D
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: xycop ที่ มกราคม 30, 2013, 13:53:52 PM
เทพท่านใด ช่วยหน่อย
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: James011 ที่ มกราคม 30, 2013, 14:22:34 PM
procedure Variable35OnCalc(var Value: Variant);
begin

  if (DBPipeline['egfr']='')  then Value:=0 ;

end;

  ลองดูครับ


หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: xycop ที่ มกราคม 31, 2013, 10:32:00 AM
ไม่ผ่านครับมันขึ้นเหมือนเดิม
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: เกื้อกูล ครับ.. ที่ มกราคม 31, 2013, 20:08:56 PM
ไม่ผ่านครับมันขึ้นเหมือนเดิม

เผา  script  แล้วเริ่มใหม่ครับ  ;D ;D
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: pop_hosxp ที่ กุมภาพันธ์ 01, 2013, 08:23:15 AM
แบบนี้ได้ไหมครับ

procedure Variable35OnCalc(var Value: Variant);
begin

  if (DBPipeline['egfr']='')  then s:='0.00';
    Value := strtofloat(s);

end;
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: xycop ที่ กุมภาพันธ์ 01, 2013, 11:28:17 AM
ที่ผมเขียนโค๊ด GFR ขึ้นมาเองเพราะว่า บางรายที่ตรวจ  creatinine มันไม่มีผล egfr เลย ผลต้องเขียนขึ้นมาเองครับ นั่งเทียนลองไปลองมาเกือบทั้งวัน ได้ code ตามนี้ครับ
procedure Variable35OnCalc(var Value: Variant);
begin
  s := DBPipeline['creatinine'];
  if s='0' then
  begin   Value := '-';
  end else
  begin
   if  DBPipeline['sex']=1 then
     if  DBPipeline['creatinine']<=0.9 then
       Value:= 141*exp(-0.411*ln(DBPipeline['creatinine']/0.9))*exp(DBPipeline['age_y']*ln(0.993))
         else
       Value:= 141*exp(-1.209*ln(DBPipeline['creatinine']/0.9))*exp(DBPipeline['age_y']*ln(0.993));
if  DBPipeline['sex']=2 then
     if DBPipeline['creatinine']<=0.7 then
         Value:=144*exp(-0.329*ln(DBPipeline['creatinine']/0.7))*exp(DBPipeline['age_y']*ln(0.993))
         else
         Value:=144*exp(-1.209*ln(DBPipeline['creatinine']/0.7))*exp(DBPipeline['age_y']*ln(0.993));
  end;
end;
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: golf_win ที่ กุมภาพันธ์ 02, 2013, 12:03:30 PM
ผมว่าบางทีที่ไม่มีค่า egfr อาจมาจาก LIS ครับ ลองกด update lablink แล้วตรวจสอบ egfr ในตาราง opdscreen ครับ
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: James011 ที่ กุมภาพันธ์ 02, 2013, 17:35:28 PM
 ;D ;D ;D  วิธีการเขียนป้องกัน Script Error ให้เขียนแบบนี้ครับ
โค๊ด: Delphi
  1.          if  getsqldata('select count(gfr) from opdscreen where vn="xxxxxxx"')>0 then
  2.          begin
  3.            
  4.            ------------------Statement--------------------------------
  5.  
  6.          end;
  7.          
หัวข้อ: Re: เขียน valiable ขึ้น error ต้องแก้ตรงไหนครับ
เริ่มหัวข้อโดย: BBT Hospital ที่ กุมภาพันธ์ 08, 2013, 08:29:55 AM
ลองดูคล้าย ๆ แบบนี้ดูไหมครับ
เพราะว่า Variable 37 นำค่า Last Creatinine ออกมาเป็น String ครับ
 If   DBPipeline['age_y']<18 then
  begin
    if ((Variable37.value)>0.01) and ((Variable37.value)<= 99.99) then
    Value:= (0.41 * DBPipeline['height'])/Variable37.Value;
  end else
  if DBPipeline['sex']='2'  then
  Begin{Female}
     if ((Variable37.value)>0.01) and ((Variable37.value)<= 0.7) then
        Value := (144 * (exp(-0.329*ln((Variable37.value)/0.7)))*exp(DBPipeline['age_y']*ln(0.993))) else
     if ((Variable37.value)>0.7) and (Strtofloat(Variable37.value)< 99.99) then
        Value := (144 * (exp(-1.209*ln((Variable37.value)/0.7)))*exp(DBPipeline['age_y']*ln(0.993)));
  End  {Female}
  else
  Begin{Male}
     if ((Variable37.value)>0.01) and ((Variable37.value)<= 0.9) then
        Value := (141 * (exp(-0.411*ln(Strtofloat(Variable37.value)/0.9)))*exp(DBPipeline['age_y']*ln(0.993))) else
     if ((Variable37.value)>0.9) and ((Variable37.value)< 99.99) then
        Value := (141 * (exp(-1.209*ln((Variable37.value)/0.9)))*exp(DBPipeline['age_y']*ln(0.993))) ;
  End;
ส่วนการกำหนดช่วงเพราะเคยมีการใส่ข้อมูลที่ไม่ใช่ตัวเลขในโปรแกรมทำให้ error ในการคำนวนแล้วข้อมูลไม่ออกได้ครับ