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

Upgrading to version 27

File:
1 edited

Legend:

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

    r456 r830  
    2323    LastFill:  TFMDateTime;
    2424    Location:   String;
     25    Drug:      String;
    2526    //Action:    Integer;
    2627  end;
     
    3031function MedAdminHistory(OrderID: string): TStrings;
    3132function MedStatusGroup(const s: string): Integer;
    32 procedure LoadActiveMedLists(InPtMeds, OutPtMeds, NonVAMeds: TList);
     33procedure LoadActiveMedLists(InPtMeds, OutPtMeds, NonVAMeds: TList; var view: integer);
    3334function GetNewDialog: string;
    3435function PickUpDefault: string;
     
    129130end;
    130131
    131 procedure LoadActiveMedLists(InPtMeds, OutPtMeds, NonVAMeds: TList);
     132function ByStatusThenLocation(Item1, Item2: Pointer): Integer;
     133{ < 0 if Item1 is less and Item2, 0 if they are equal and > 0 if Item1 is greater than Item2 }
     134var
     135  //Status1, Status2: Integer;
     136  loc1, loc2: string;
     137  Med1, Med2: TMedListRec;
     138begin
     139  Med1 := TMedListRec(Item1);
     140  Med2 := TMedListRec(Item2);
     141  loc1 := Med1.Location;
     142  loc2 := Med2.Location;
     143  //Status1 := MedStatusGroup(Med1.Status);
     144  //Status2 := MedStatusGroup(Med2.Status);
     145  if (compareText(Med1.Status,Med2.Status) >0) then Result := 1
     146  else if (compareText(Med1.Status,Med2.Status) <0) then Result := -1
     147  else if ( compareText(loc1,loc2)>0 ) then Result := -1
     148  else if ( compareText(loc1,loc2)<0 ) then Result := 1
     149  else if (compareText(Med1.Drug,Med2.Drug) >0) then Result := 1
     150  else if (compareText(Med1.Drug,Med2.Drug) <0) then Result := -1
     151  //else if Med1.StopDate > Med2.StopDate then Result := -1
     152  //else if Med1.StopDate < Med2.StopDate then Result := 1
     153  //else if Med1.SrvSeq < Med2.SrvSeq then Result := -1
     154  //else if Med1.SrvSeq > Med2.SrvSeq then Result := 1
     155  else Result := 0;
     156end;
     157
     158procedure LoadActiveMedLists(InPtMeds, OutPtMeds, NonVAMeds: TList; var view: integer);
    132159var
    133160  idx, ASeq: Integer;
    134161  x, y: string;
    135   ClinMeds,tmpInPtMeds: TList;
     162  ClinMeds, tmpInPtMeds: TList;
    136163  AMed: TMedListRec;
    137164begin
     
    144171  ClearMedList(OutPtMeds);
    145172  ClearMedList(NonVAMeds);
    146   CallV('ORWPS ACTIVE', [Patient.DFN]);
     173  CallV('ORWPS ACTIVE', [Patient.DFN, User.DUZ, view, True]);
    147174  ASeq := 0;
     175  if (view = 0) and (RPCBrokerV.Results.Count > 0) then
     176    view := StrToIntDef(RPCBrokerV.Results.Strings[0],0);
    148177  with RPCBrokerV do while Results.Count > 0 do
    149178  begin
     
    162191    Inc(ASeq);
    163192    AMed.SrvSeq := ASeq;
    164     if AMed.Inpatient then
     193    if (AMed.Inpatient) then
    165194    begin
    166       if Copy(x,2,2)='CP' then ClinMeds.Add(AMed)
    167       else tmpInPtMeds.Add(AMed);
     195      tmpInPtMeds.Add(AMed);
     196      //if (Copy(x,2,2)='CP') then tmpInPtMeds.Add(AMed);
     197     // if (Copy(x,2,2)='CP') and ((view = 2) or (view = 0)) then ClinMeds.Add(AMed)
     198     // else tmpInPtMeds.Add(AMed);
    168199    end
    169200    else
     
    173204       OutPtMeds.Add(AMed);
    174205  end;
    175   ClinMeds.Sort(ByStatusThenStop);
    176   tmpInPtMeds.Sort(ByStatusThenStop);                           //IMO
    177   InPtMeds.Assign(ClinMeds);
     206 // 12-4 if view <> 1 then ClinMeds.Sort(ByStatusThenStop);
     207 // 12-4 if view = 1 then tmpInPtMeds.Sort(ByStatusThenLocation)
     208 // 12-4 else tmpInPtMeds.Sort(ByStatusThenStop);
     209  //tmpInPtMeds.Sort(ByStatusThenStop);                           //IMO
     210 //12-4 if view <> 1 then InPtMeds.Assign(ClinMeds);
    178211  for idx := 0 to tmpInPtMeds.Count - 1 do
    179212    InPtMeds.Add(TMedListRec(tmpInPtMeds.Items[idx]));
    180   OutPtMeds.Sort(ByStatusThenStop);
    181   NonVAMeds.Sort(ByStatusThenStop);
     213  //if view <> 1 then OutPtMeds.Sort(ByStatusThenStop)
     214  //else OutPtMeds.Sort(ByStatusThenLocation);
     215 //12-4 if view <> 1 then NonVAMeds.Sort(ByStatusThenStop)
     216 //12-4 else NonVAMeds.Sort(ByStatusThenLocation);
    182217  if Assigned(ClinMeds) then FreeAndNil(ClinMeds);
    183218  if Assigned(tmpInPtMeds) then FreeAndNil(tmpInPtMeds);
Note: See TracChangeset for help on using the changeset viewer.