Procedure

TfrmProblems.UpdateProblem

Module

fProbs

Last Modified

7/15/2014 3:26:38 PM

Visibility

Public

Owner

TfrmProblems

Declaration

procedure UpdateProblem(const why:char;Line: string;AllProblemsIndex:integer);

Calls Hierarchy


TfrmProblems.UpdateProblem
 ├EditLoad
 ├TProbRec.Create
 │ ├TProbRec.CreateFields
 │ ├TProbRec.LoadField
 │ │ └GetOrigVal
 │ └TProbRec.LoadComments
 │   └TComment.Create
 ├TKeyVal.DHCPtoKeyVal
 ├TEncounter.GetProviderName
 │ └TEncounter.UpdateText
 │   └GetEncounterText
 ├TEncounter.GetVisitCategory
 ├FMNow
 ├TProbRec.SetStatus
 ├TProbRec.SetResDatStr
 │ └TProbRec.SetDateString
 │   └StrToFMDateTime
 ├TProbRec.SetModDatStr
 │ └TProbRec.SetDateString...
 ├ProblemUpdate
 ├TProbRec.GetAltFilerObject
 ├IsActiveICDCode
 │ └IsActiveCode
 ├IsActiveSCTCode
 │ └IsActiveCode
 ├TProbRec.SetCondition
 └ProblemVerify

Called-By Hierarchy


                TfrmProblems.UpdateProblem
           TfrmProblems.lstProbActsClick┘ 
       TfrmProblems.wgProbDataDblClick┤   
             TfrmProblems.lstViewClick┘   
     TfrmProblems.HighlightDuplicate┘     
           TfrmProblems.AddProblem┤       
TfrmProblems.lstProbActsClick...┤ │       
   TfrmProblems.lstProbPickClick┤ │       
TfrmProblems.lstProbPickDblClick┤ │       
TfrmProblems.edProbEntKeyPress┘ │ │       
        TfrmProblems.UMPLLexicon┘ │       
     TfrmdlgProb.bbChangeProbClick┘       

Calls

Name Declaration Comments
TProbRec.Create constructor Create(AList:TstringList); -
TKeyVal.DHCPtoKeyVal procedure DHCPtoKeyVal(DHCPFld:String); -
EditLoad function EditLoad(ProblemIFN: string; ProviderID: int64; ptVAMC: string): TStrings ; -
FMNow function FMNow: TFMDateTime; -
TProbRec.GetAltFilerObject function GetAltFilerObject:TstringList; -
TEncounter.GetProviderName function GetProviderName: string; -
TEncounter.GetVisitCategory function GetVisitCategory: Char; -
IsActiveICDCode function IsActiveICDCode(ACode: string; ADate: TFMDateTime = 0): boolean; -
IsActiveSCTCode function IsActiveSCTCode(ACode: string; ADate: TFMDateTime = 0): boolean; -
ProblemUpdate function ProblemUpdate(AltProbFile: TStringList): TStrings ; -
ProblemVerify function ProblemVerify(ProblemIFN: string): TStrings ; -
TProbRec.SetCondition procedure SetCondition(value:String); -
TProbRec.SetModDatStr procedure SetModDatStr(value:string); -
TProbRec.SetResDatStr procedure SetResDatStr(value:string); -
TProbRec.SetStatus procedure SetStatus(value:String); -

Called-By

Name Declaration Comments
TfrmProblems.lstProbActsClick procedure lstProbActsClick(Sender: TObject); -


Source

1450  procedure TfrmProblems.UpdateProblem(const why:char; Line: string; AllProblemsIndex: integer);
1451  var
1452    Alist: TstringList;
1453    DateOfInterest: TFMDateTime;
1454    SvcCat: Char;
1455    ProblemIFN: string;
1456    sv: string;
1457  begin
1458    alist := TstringList.create;
1459    try
1460      problemIFN := Piece(Line, U, 1);
1461      {get the basic info - could shortcut, but try this for now}
1462      FastAssign(EditLoad(ProblemIFN, pProviderID, PLPt.ptVAMC), AList) ;
1463      probRec := TProbRec.Create(Alist);
1464      probRec.PIFN := problemIFN;
1465      ProbRec.RespProvider.DHCPtoKeyVal(inttostr(Encounter.Provider) + u + Encounter.ProviderName);   {REV - V13}
1466      SvcCat := Encounter.VisitCategory;
1467      if (SvcCat = 'E') or (SvcCat = 'H') then
1468        DateOfInterest := FMNow
1469      else
1470        DateOfInterest := Encounter.DateTime;
1471      Alist.clear;
1472      case why of
1473        'I': begin
1474               ProbRec.status := 'I';
1475               {assume resolution date now with this option. user should do full edit otherwise}
1476               ProbRec.DateResStr := 'T';
1477               Probrec.DateModStr := 'T';
1478               FastAssign(ProblemUpdate(ProbRec.AltFilerObject), AList) ;
1479             end;
1480        'V': begin
1481              if not IsActiveICDCode(ProbRec.Diagnosis.extern, DateOfInterest) then
1482                begin
1483                  InfoBox(TX_INACTIVE_ICODE, TC_INACTIVE_ICODE, MB_ICONWARNING or MB_OK);
1484                  exit;
1485                end
1486              else if (ProbRec.SCTConcept.extern <> '') and not IsActiveSCTCode(ProbRec.SCTConcept.extern, DateOfInterest) then
1487                begin
1488                  InfoBox(TX_INACTIVE_SCODE, TC_INACTIVE_SCODE, MB_ICONWARNING or MB_OK);
1489                  exit;
1490                end;
1491               Probrec.condition := 'P';
1492               Probrec.DateModStr := 'T';
1493               FastAssign(ProblemVerify(ProbRec.PIFN), AList) ;
1494             end;
1495      end;
1496  
1497      if Alist.count<1 then {show error message}
1498        InfoBox('Unable to update record ', 'Information', MB_OK or MB_ICONINFORMATION)
1499      else if Alist[0]<'1' then
1500        InfoBox('Unable to update record: ' + #13#10 + ' ' + Alist[1] + ' (' + Probrec.PIFN + ')',
1501          'Information', MB_OK or MB_ICONINFORMATION)
1502      {show inactivated problem}
1503      else if (why='I') then
1504        begin
1505          if (PlUser.usViewAct='A') then
1506            FProblemsVisible[AllProblemsIndex] := 'N'
1507          else
1508          begin
1509            SetPiece(line, U, 2, 'I');
1510            FAllProblems[AllProblemsIndex] := line;
1511          end;
1512        end
1513      else if (why='V') then {show verified problem}
1514        begin
1515          sv := Piece(Line, U, 2);
1516          SetPiece(line, U, 2, Copy(sv,1,4)); //remove (u)
1517          FAllProblems[AllProblemsIndex] := line;
1518        end;
1519    finally
1520      Changes.RefreshCoverPL := True;
1521      alist.free;
1522      ProbRec.free;
1523      ProbRec := nil;
1524    end;
1525  end;