📄 naconcentration.pas
字号:
unit NaConcentration;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,AryClass;
type
TFormInputView = class(TForm)
Label1: TLabel;
Label2: TLabel;
EditPDNaDown: TEdit;
Label3: TLabel;
EditPDNaUp: TEdit;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
EditPDStep: TEdit;
Label7: TLabel;
Label8: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label18: TLabel;
EditFirstDepositTime: TEdit;
EditSecondDepositTime: TEdit;
EditThirdDepositTime: TEdit;
EditFourthDepositTime: TEdit;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
BtPreSetDepositTime: TButton;
EditBloodNa: TEdit;
BtSavePreSet: TButton;
Label24: TLabel;
Label25: TLabel;
EditNaIntakeDown: TEdit;
Label26: TLabel;
Label27: TLabel;
EditNaIntakeUp: TEdit;
Label28: TLabel;
BtPreSetNaIntake: TButton;
BtPreSetNaOut: TButton;
Label9: TLabel;
Label10: TLabel;
EditNaOutSweat: TEdit;
Label11: TLabel;
Label12: TLabel;
EditUrineOutV: TEdit;
Label17: TLabel;
Label29: TLabel;
EditNaOutUrine: TEdit;
Label30: TLabel;
Label31: TLabel;
EditUrineOutCon: TEdit;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
Label35: TLabel;
EditBloodGlucose: TEdit;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
EditBloodUrea: TEdit;
Label39: TLabel;
BtPreSetBloodCon: TButton;
Label40: TLabel;
BtPreSetPDCon: TButton;
Label41: TLabel;
BtReset: TButton;
EditPDGluDown: TEdit;
Label42: TLabel;
Label43: TLabel;
Label44: TLabel;
Label45: TLabel;
EditPDGluUp: TEdit;
procedure BtPreSetDepositTimeClick(Sender: TObject);
procedure BtPreSetNaIntakeClick(Sender: TObject);
procedure BtPreSetNaOutClick(Sender: TObject);
procedure BtPreSetBloodConClick(Sender: TObject);
procedure BtPreSetPDConClick(Sender: TObject);
procedure BtSavePreSetClick(Sender: TObject);
procedure BtResetClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormInputView: TFormInputView;
AryDepTime: TIntStaticArray; //存腹时间,4袋
AryNaSIn: TRealDynamicArray; //Na的摄入,步长为InStep递增
InStep:Real;
AryNaOut: TRealStaticArray; //非PD途径Na的排出,依Form中的排列顺序,2个
AryPDNaSOut: TRealDynamicArray; //PD途径Na的排出,步长为1递增
AryBloodCon: TRealStaticArray; //血液中溶质浓度,依Form中的排列顺序,3个
AryPDSNaCon: TRealDynamicArray; //透析液中Na的浓度,步长为PDStep递增
AryPDSGlucoseCon: TRealDynamicArray; //透析液中葡萄糖的浓度,步长为PDStep递增
PDStep:Real;
NumNaIn: Integer; //各动态数组的元素个数
NumNaOut: Integer;
NumPDNaC: Integer;
NumPDGlusC: Integer;
k: Integer; //数组指针
implementation
uses ListNaData;
{$R *.dfm}
function TransToInt(X:real):Integer; //实数取整的函数,得到整型值
var
Y:Integer;
begin
for Y:=0 to 1000 do
if (X>=Y) and (X<(Y+1))
then
Result:=Y;
end;
procedure TFormInputView.BtPreSetDepositTimeClick(Sender: TObject);
begin
EditFirstDepositTime.Text:='240';
EditSecondDepositTime.Text:='240';
EditThirdDepositTime.Text:='240';
EditFourthDepositTime.Text:='540';
end;
procedure TFormInputView.BtPreSetNaIntakeClick(Sender: TObject);
begin
EditNaIntakeDown.Text:='6';
EditNaIntakeUp.Text:='12';
end;
procedure TFormInputView.BtPreSetNaOutClick(Sender: TObject);
begin
EditNaOutSweat.Text:='0';
EditUrineOutV.Text:='0';
EditUrineOutCon.Text:='0';
EditNaOutUrine.Text:=FloatToStr((StrToFloat(EditUrineOutV.Text)*StrToFloat(EditUrineOutCon.Text))*58.5/1000);
end;
procedure TFormInputView.BtPreSetBloodConClick(Sender: TObject);
begin
EditBloodNa.Text:='136.5';
EditBloodGlucose.Text:='6.3';
EditBloodUrea.Text:='20.7';
end;
procedure TFormInputView.BtPreSetPDConClick(Sender: TObject);
begin
EditPDNaDown.Text:='100';
EditPDNaUp.Text:='137';
EditPDStep.Text:='1';
EditPDGluDown.Text:='100';
EditPDGluUp.Text:='150';
end;
procedure TFormInputView.BtSavePreSetClick(Sender: TObject); //给各数组及变量赋值
begin
AryDepTime[0]:=StrToInt(EditFirstDepositTime.Text);
AryDepTime[1]:=StrToInt(EditSecondDepositTime.Text);
AryDepTime[2]:=StrToInt(EditThirdDepositTime.Text);
AryDepTime[3]:=StrToInt(EditFourthDepositTime.Text);
InStep:=1;
NumNaIn:=TransToInt((StrToFloat(EditNaIntakeup.Text)-StrToFloat(EditNaIntakeDown.Text))/InStep)+1;
AryNaSIn[0]:=StrToFloat(EditNaIntakeDown.Text);
k:=1;
for k:=1 to (NumNaIn-1) do
begin
AryNaSIn[k]:=AryNaSIn[k-1]+InStep;
end;
AryNaOut[0]:=StrToFloat(EditNaOutSweat.Text);
AryNaOut[1]:=StrToFloat(EditUrineOutV.Text);
AryNaOut[2]:=StrToFloat(EditUrineOutCon.Text);
AryNaOut[3]:=AryNaOut[1]*AryNaOut[2]*58.5/1000;
EditNaOutUrine.Text:=FloatToStr(AryNaOut[3]);
AryBloodCon[0]:=StrToFloat(EditBloodNa.Text)/1000;
AryBloodCon[1]:=StrToFloat(EditBloodGlucose.Text)/1000;
AryBloodCon[2]:=StrToFloat(EditBloodUrea.Text)/1000;
PDStep:=StrToFloat(EditPDStep.Text);
NumPDNaC:=TransToInt((StrToFloat(EditPDNaUp.Text)-StrToFloat(EditPDNaDown.Text))/PDStep)+1;
AryPDSNaCon[0]:=StrToFloat(EditPDNaDown.Text)/1000;
//AryPDSGlucoseCon[0]:=339.56/1000-2*AryPDSNaCon[0];
k:=1;
for k:=1 to (NumPDNaC-1) do
begin
AryPDSNaCon[k]:=AryPDSNaCon[k-1]+PDStep/1000;
//AryPDSGlucoseCon[k]:=StrToFloat(EditPDGluStaCon.Text)/1000;
//AryPDSGlucoseCon[k]:=339.56/1000-2*AryPDSNaCon[k];
end;
NumPDGlusC:=TransToInt((StrToFloat(EditPDGluUp.Text)-StrToFloat(EditPDGluDown.Text))/PDStep)+1;
AryPDSGlucoseCon[0]:=StrToFloat(EditPDGluDown.Text)/1000;
k:=1;
for k:=1 to (NumPDGlusC-1) do
begin
AryPDSGlucoseCon[k]:=AryPDSGlucoseCon[k-1]+PDStep/1000;
end;
If ((AryDepTime[0]+AryDepTime[1]+AryDepTime[2]+AryDepTime[3])=1260)
then
FormNaList.Show
else
begin
messagedlg('请核对:存腹总时间应为1260分钟即21小时',mtError,[mbok],0)
end;
end;
procedure TFormInputView.BtResetClick(Sender: TObject);
begin
EditFirstDepositTime.Text:='240';
EditSecondDepositTime.Text:='240';
EditThirdDepositTime.Text:='240';
EditFourthDepositTime.Text:='540';
EditNaIntakeDown.Text:='6';
EditNaIntakeUp.Text:='12';
EditNaOutSweat.Text:='0';
EditUrineOutV.Text:='0';
EditUrineOutCon.Text:='0';
EditNaOutUrine.Text:=FloatToStr((StrToFloat(EditUrineOutV.Text)*StrToFloat(EditUrineOutCon.Text))*58.5/1000);
EditBloodNa.Text:='136.5';
EditBloodGlucose.Text:='6.3';
EditBloodUrea.Text:='20.7';
EditPDNaDown.Text:='100';
EditPDNaUp.Text:='137';
EditPDStep.Text:='1';
EditPDGluDown.Text:='100';
EditPDGluUp.Text:='150';
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -