Ignore:
Timestamp:
Jul 7, 2010, 4:31:10 PM (14 years ago)
Author:
Kevin Toppenberg
Message:

Upgrade to version 27

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cprs/trunk/CPRS-Chart/Orders/rODLab.pas

    r456 r829  
    2323function  GetLastCollectionTime: string;
    2424procedure GetPatientBBInfo(Dest: TStrings; PatientID: string; Loc: integer);
     25procedure ListForQuickOrders(var AListIEN, ACount: Integer; const DGrpNm: string);
     26procedure SubsetOfQuickOrders(Dest: TStringList; AListIEN, First, Last: Integer);
    2527procedure GetPatientBloodResults(Dest: TStrings; PatientID: string; ATests: TStringList);
    2628procedure GetPatientBloodResultsRaw(Dest: TStrings; PatientID: string; ATests: TStringList);
    2729function  StatAllowed(PatientID: string): boolean;
    2830procedure GetBloodComponents(Dest: TStrings);
     31function  NursAdminSuppress: boolean;
     32function  GetSubtype(TestName: string): string;
     33function  TNSDaysBack: integer;
     34procedure CheckForChangeFromLCtoWCOnAccept(Dest: TStrings; ALocation: integer; AStartDate, ACollType, ASchedule, ADuration: string);
     35procedure CheckForChangeFromLCtoWCOnRelease(Dest: TStrings; ALocation: integer; OrderList: TStringList);
     36function  GetLCtoWCInstructions(Alocation: integer): string;
     37procedure FormatLCtoWCDisplayTextOnAccept(InputList, OutputList: TStrings);
     38procedure FormatLCtoWCDisplayTextOnRelease(InputList, OutputList: TStrings);
     39
     40const
     41  TX0 = 'The following Lab orders will be changed to Ward Collect:';
     42  TX2 = 'Order Date' + #9 +#9 + 'Reason Changed to Ward Collect';
     43  TX5 = 'Please contact the ward staff to insure the specimen is collected.';
     44  TX6 = 'You can print this screen for reference.';
     45  TX_BLANK = '';
    2946
    3047implementation
    3148
    3249uses  rODBase;
    33 (*    fODBase, rODBase, fODLab;*)
    3450
    3551procedure GetBloodComponents(Dest: TStrings);
     
    3854end;
    3955
     56function NursAdminSuppress: boolean;
     57begin
     58  Result := (StrToInt(sCallV('ORWDXVB NURSADMN',[nil])) < 1);
     59end;
     60
    4061function  StatAllowed(PatientID: string): boolean;
    4162begin
     
    5677begin
    5778  tCallV(Dest, 'ORWDXVB GETALL', [PatientID, Loc]);
     79end;
     80
     81function GetSubtype(TestName: string): string;
     82begin
     83  Result := sCallV('ORWDXVB SUBCHK', [TestName]);
     84end;
     85
     86function TNSDaysBack: integer;
     87begin
     88  Result := StrToIntDef(sCallV('ORWDXVB VBTNS', [nil]),3);
     89end;
     90
     91procedure ListForQuickOrders(var AListIEN, ACount: Integer; const DGrpNm: string);
     92begin
     93  CallV('ORWUL QV4DG', [DGrpNm]);
     94  AListIEN := StrToIntDef(Piece(RPCBrokerV.Results[0], U, 1), 0);
     95  ACount   := StrToIntDef(Piece(RPCBrokerV.Results[0], U, 2), 0);
     96end;
     97
     98procedure SubsetOfQuickOrders(Dest: TStringList; AListIEN, First, Last: Integer);
     99var
     100  i: Integer;
     101begin
     102 CallV('ORWUL QVSUB', [AListIEN,'','']);
     103 for i := 0 to RPCBrokerV.Results.Count -1 do
     104   Dest.Add(RPCBrokerV.Results[i]);
    58105end;
    59106
     
    158205end;
    159206
     207procedure CheckForChangeFromLCtoWCOnAccept(Dest: TStrings; ALocation: integer; AStartDate, ACollType, ASchedule, ADuration: string);
     208var
     209  AList: TStringList;
     210begin
     211  AList := TStringList.Create;
     212  try
     213    CallV('ORCDLR2 CHECK ONE LC TO WC', [ALocation, '', AStartDate, ACollType, ASchedule, ADuration]);
     214    FastAssign(RPCBrokerV.Results, AList);
     215    FormatLCtoWCDisplayTextOnAccept(AList, Dest);
     216  finally
     217    AList.Free;
     218  end;
     219end;
     220
     221procedure CheckForChangeFromLCtoWCOnRelease(Dest: TStrings; ALocation: integer; OrderList: TStringList);
     222var
     223  AList: TStringList;
     224begin
     225  AList := TStringList.Create;
     226  try
     227    CallV('ORCDLR2 CHECK ALL LC TO WC', [ALocation, OrderList]);
     228    FastAssign(RPCBrokerV.Results, AList);
     229    FormatLCtoWCDisplayTextOnRelease(AList, Dest);
     230  finally
     231    AList.Free;
     232  end;
     233end;
     234
     235procedure FormatLCtoWCDisplayTextOnAccept(InputList, OutputList: TStrings);
     236var
     237  i: integer;
     238  x: string;
     239begin
     240  OutputList.Clear;
     241  for i := InputList.Count - 1 downto 0 do
     242    if Piece(InputList[i], U, 2) = '1' then InputList.Delete(i);
     243  if InputList.Count > 0 then
     244  begin
     245    SetListFMDateTime('mmm dd, yyyy@hh:nn', TStringList(InputList), U, 1);
     246    with OutputList do
     247    begin
     248      Add(TX0);
     249      Add(TX_BLANK);
     250      Add('Patient :' + #9 + Patient.Name);
     251      Add('SSN     :' + #9 + Patient.SSN);
     252      Add('Location:' + #9 + Encounter.LocationName + CRLF);
     253      for i := 0 to InputList.Count - 1 do
     254        Add(Piece(InputList[i], U, 1) + #9 + Piece(InputList[i], U, 3));
     255      Add(TX_BLANK);
     256      x := GetLCtoWCInstructions(Encounter.Location);
     257      if x = '' then x := TX5;
     258      Add(x);
     259      Add(TX6);
     260    end;
     261  end;
     262end;
     263
     264procedure FormatLCtoWCDisplayTextOnRelease(InputList, OutputList: TStrings);
     265var
     266  i, j, k, Changed: integer;
     267  AList: TStringlist;
     268  x: string;
     269begin
     270  OutputList.Clear;
     271  Changed := StrToIntDef(ExtractDefault(InputList, 'COUNT'), 0);
     272  if Changed > 0 then
     273  begin
     274    AList := TStringList.Create;
     275    try
     276      with OutputList do
     277      begin
     278        Add(TX0);
     279        Add(TX_BLANK);
     280        Add('Patient :' + #9 + Patient.Name);
     281        Add('SSN     :' + #9 + Patient.SSN);
     282        Add('Location:' + #9 + Encounter.LocationName);
     283        for i := 1 to Changed do
     284        begin
     285          Add(TX_BLANK);
     286          AList.Clear;
     287          ExtractText(AList, InputList, 'ORDER_' + IntToStr(i));
     288          Add('Order   :' + #9 + AList[0]);
     289          k := Length(OutputList[Count-1]);
     290          if AList.Count > 1 then
     291            for j := 1 to AList.Count - 1 do
     292            begin
     293              Add(StringOfChar(' ', 9) + #9 + AList[j]);
     294              k := HigherOf(k, Length(OutputList[Count - 1]));
     295            end;
     296          Add(StringOfChar('-', k + 4));
     297          AList.Clear;
     298          ExtractItems(AList, InputList, 'ORDER_' + IntToStr(i));
     299          SetListFMDateTime('mmm dd, yyyy@hh:nn', AList, U, 1);
     300          for j := 0 to AList.Count - 1 do
     301            OutputList.Add(Piece(AList[j], U, 1) + #9 + Piece(AList[j], U, 3));
     302        end;
     303        Add(TX_BLANK);
     304        x := GetLCtoWCInstructions(Encounter.Location);
     305        if x = '' then x := TX5;
     306        Add(x);
     307        Add(TX6);
     308      end;
     309    finally
     310      AList.Free;
     311    end;
     312  end;
     313end;
     314
     315function GetLCtoWCInstructions(Alocation: integer): string;
     316begin
     317  Result := sCallV('ORWDLR33 LC TO WC', [Encounter.Location]);
     318end;
     319
    160320end.
     321
     322
Note: See TracChangeset for help on using the changeset viewer.