procedure TFormnewpatient.EditageExit(Sender: TObject);
var
year,month,day:word;
begin
//处理出生日期
if (strtoint(trim(Editage.Text)) >1) and ((strtoint(trim(Editage.Text)) <99)) then
begin
decodedate(date,year,month,day);
year := Yearof(date);
year := Yearof(date)- (strtoint(trim(Editage.Text)));
month := month;
day :=day;
DTPCSRQ.Date:=strtodate(inttostr(year)+'-'+inttostr(month)+'-'+inttostr(day));
end;
end;
procedure TFormnewpatient.DTPCSRQExit(Sender: TObject);
var
outage :real ;
begin
//处理年龄
outage := YearSpan(Now, DTPCSRQ.Date);
if outage > 99 then
begin
Editage.Text:= '0';
Cmbageunit.Text := '岁';
end
else
if outage > 1 then
begin
Editage.Text:=FloatToStr(trunc(outage));
Cmbageunit.Text := '岁';
end
else
begin
Editage.Text:= '0';
Cmbageunit.Text := '岁';
end;
end;