Changeset 460 for cprs/branches/foia-cprs/CPRS-Chart/BA
- Timestamp:
- Jul 6, 2008, 8:20:14 PM (16 years ago)
- Location:
- cprs/branches/foia-cprs/CPRS-Chart/BA
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/branches/foia-cprs/CPRS-Chart/BA/UBACore.pas
r459 r460 11 11 function rpcGetPersonalDxList(UserDUZ:int64):TStringList; 12 12 function rpcDeleteFromPersonalDxList(UserDUZ:int64; Dest:TStringList):integer; 13 procedure rpcSaveBillingD ata(pBillingData:TStringList);13 procedure rpcSaveBillingDxEntered; // save dx enteries regardless of being mandatory.... 14 14 function rpcNonBillableOrders(pOrderList: TStringList): TStringList; 15 15 function rpcOrderRequiresDx(pList: TStringList):boolean; 16 procedure rpcSetBillingAwareSwitch(encProvider: int64; encLocation: integer);16 procedure rpcSetBillingAwareSwitch(encProvider: int64; pPatientDFN: string); 17 17 procedure rpcGetProviderPatientDaysDx(ProviderIEN: string;PatientIEN: string); 18 18 procedure rpcGetSC4Orders; // returns Eligible Treatment Factors for a given patient 19 procedure rpcSaveBillingDxEntered; // save dx enteries regardless of being mandatory.... 19 20 20 function rpcTreatmentFactorsActive(pOrderID: string):boolean; 21 21 procedure rpcBuildSCIEList(pOrderList: TList); 22 22 function rpcGetUnsignedOrdersBillingData(pOrderList: TStringList):TStringList; 23 function rpcRetrieveBillingData(thisOrderID: string; var thisBAData: string) : boolean;24 23 function rpcRetrieveSelectedOrderInfo(pOrderIDList: TStringList):TStringList; 25 24 function rpcGetTFHintData:TStringList; 26 25 procedure rpcSaveNurseConsultOrder(pOrderRec:TStringList); 27 26 function rpcGetBAMasterSwStatus:boolean; 28 27 procedure rpcSaveCIDCData(pCIDCList: TStringList); 28 function rpcIsPatientInsured(pPatientDFN: string):boolean; 29 30 procedure SaveBillingData(pBillingData:TStringList); 29 31 function OrdersHaveDx(pOrderList:TStringList):boolean; 30 32 procedure SetTreatmentFactors(TFactors: string); … … 32 34 procedure AttachPLTFactorsToDx(var Dest:String;ProblemRec:string); 33 35 procedure BALoadStsFlagsAsIs(StsFlagsIN: string); 34 function BADxEntered:boolean; // This will only be executed if bypass switch is set...36 function BADxEntered:boolean; // main logic to determine if dx has been entered for order that requires dx 35 37 function StripTFactors(FactorsIN: string): string; 36 38 function AddProviderPatientDaysDx(Dest: TStringList; ProviderIEN: string;PatientIEN: string) : TStringList; … … 52 54 function GetConsultFlags(pOrderID:String; pFlagList:TStringList;FlagsAsIs:string):string; 53 55 function SetConsultFlags(pPLFactors: string;pFlagsAsIs: string):string; // return updated flags. 54 procedure GetBAStatus(pProvider:int64; p Location:integer);56 procedure GetBAStatus(pProvider:int64; pPatientDFN: string); 55 57 function IsICD9CodeActive(ACode: string; LexApp: string; ADate:TFMDateTime = 0): boolean; 56 58 function BuildConsultDxRec(ConsultRec: TBAConsultOrderRec): string; 57 59 function ConvertPIMTreatmentFactors(pTFactors:string):string; 58 60 procedure DeleteDCOrdersFromCopiedList(pOrderID:string); 59 //function SetOrderIDConsultDxRequired(pOrderID:String):String; // replace orderid with "R" if consult dx required.60 61 procedure UpdateBAConsultOrderList(pDcOrders: TStringList); 61 62 63 62 function VerifyOrderIdExists(pOrderList: TStringList): TStringList; // removes records without order id 63 function IsCIDCProvider(encProvider:int64):boolean; 64 function ProcessProblemTFactors(pText:String):String; 64 65 65 66 var … … 75 76 76 77 77 function rpcRetrieveBillingData(thisOrderID: string; var thisBAData: string) : boolean; 78 var 79 rpcResult: TStringList; 80 BAOrderExists : boolean; 81 begin 82 Result := false; 83 BAOrderExists := false; 84 rpcResult := TStringList.Create; 85 86 tCallV(rpcResult, 'ORWDBA1 RCVORCI', [thisOrderID]); 87 BAOrderExists := StrToBool(rpcResult[0]); 88 89 if (not BAOrderExists) then 90 //GRAB RETURNED BA DATA HERE 91 Result := true; 92 end; 93 94 procedure rpcSaveBillingData(pBillingData:TStringList); 78 // ----------------- MAIN CIDC DX HAS BEEN ENTERED LOGIC --------------------------- 79 function BADxEntered:boolean; 80 var 81 i: integer; 82 //orderStatus: integer; 83 x: string; 84 passList: TStringList; 85 holdOrderList: TStringList; 86 thisOrderID: string; 87 thisRec: string; 88 begin 89 // Result := TRUE; // caused hint..... 90 holdOrderList := TStringList.Create; 91 holdOrderList.Clear; 92 updatedBAOrderList := TStringList.Create; 93 updatedBAOrderList.Clear; 94 passList := TStringList.Create; 95 passList.Clear; 96 // determine which orders require a dx (lrmp- only) 97 // if NO then continue 98 // if YES, check BADxList for orders with DX enteries. 99 // if ok then create data string pass to M via RPC 100 101 for i := 0 to BAOrderList.Count-1 do 102 begin 103 thisRec := BAOrderList.Strings[i]; 104 thisOrderID := piece(thisRec,';',1) + ';1'; //rebuild orderID pass to M. 105 x := BAOrderList.Strings[i]; 106 //orderStatus := StrToInt(CharAt(Piece(x, ';', 2), 1)); // Order Status 1=OK, 2=DISCONTINUE 107 if IsOrderBillable(thisOrderID) then 108 begin 109 passList.Add(piece(x,';',1)); 110 holdOrderList.Add(x);// place holder for orders that can be signed! 111 end; 112 end; 113 114 BAOrderList.Assign(holdOrderList); //assign signable orders to BAOrderList for further processing 115 holdOrderList.Clear; // CQ5025 116 117 //call with passList determine if LRMP 118 if rpcOrderRequiresDx(passList) then 119 BAOrderList.Assign(updatedBAOrderList); 120 121 // check of all orders dx columns are flagged with N/A..... 122 if UBACore.IsAllOrdersNA(BAOrderList) then 123 begin 124 Result := TRUE; // force true, no record needs DX entry 125 Exit; //to do. clean this up... when time permitts 126 end 127 else 128 begin 129 if OrdersHaveDx(UBAGlobals.BAOrderList) then 130 begin 131 Result := True; // CIDC orders have dx 132 SaveBillingData(UBAGlobals.BAOrderList) ; 133 end 134 else 135 begin 136 Result := FALSE; 137 Exit; 138 end; 139 end; 140 end; 141 142 143 function rpcOrderRequiresDx(pList: TStringList):boolean; 144 var x: string; 145 i,j: integer; 146 returnList, updatedList: TStringList; 147 begin 148 Result := FALSE; // initial set dx NOT required 149 returnList := TStringList.Create; 150 updatedList := TStringList.Create; 151 returnList.Clear; 152 updatedList.Clear; 153 // remove deleted orderid's 154 if UBAGlobals.BADeltedOrders.Count > 0 then 155 begin 156 for i := 0 to UBAGlobals.BADeltedOrders.Count-1 do 157 x := UBAGlobals.BADeltedOrders.Strings[i]; 158 for j := 0 to pList.Count-1 do 159 begin 160 if x = pList.Strings[j] then 161 continue // orderid is removed.. or skipped 162 else 163 updatedList.Add(x); 164 end; 165 end 166 else 167 updatedList.Assign(pList); 168 169 // call returns boolean, orders is billable=1 or nonbillable=0 or discontinued = 0 170 tCallV(returnList,'ORWDBA1 ORPKGTYP',[updatedList]); 171 172 //Remove NON LRMP orders from the mix(when checking for dx entry); 173 // BAOrderList and pList are in sync - order id.... 174 for i := 0 to BAOrderList.Count-1 do 175 begin 176 x:= piece(returnList.Strings[i],'^',1); 177 if x = BILLABLE_ORDER then 178 begin 179 updatedBAOrderList.Add(BAOrderList[i]); 180 Result := TRUE; 181 end; 182 end; 183 end; 184 185 186 // UBAGlobals.NonBillableOrderList must be populated prior to calling this function. 187 // call rpcNonBillableOrders to populate List. 188 function IsOrderBillable(pOrderID: string):boolean ; 189 var 190 i: integer; 191 currOrderID: string; 192 matchOrderID : string; 193 194 begin 195 Result := TRUE; // = Billable 196 currOrderID := PrepOrderID(pOrderID); 197 if Piece(pOrderID,';',2) = DISCONTINUED_ORDER THEN 198 begin 199 Result := FALSE; 200 Exit; 201 end; 202 try 203 for i := 0 to UBAGlobals.NonBillableOrderList.Count -1 do 204 begin 205 matchOrderID := PrepOrderID( (Piece(UBAGlobals.NonBillableOrderList.Strings[i],U,1)) ); 206 if currOrderID = matchOrderID then 207 begin 208 Result := FALSE; //= Non Billable 209 Exit; 210 end; 211 end; 212 except 213 on EListError do 214 begin 215 {$ifdef debug}ShowMessage('EListError in UBACore.IsOrderBillable()');{$endif} 216 raise; 217 end; 218 end; 219 end; 220 221 222 procedure SaveBillingData(pBillingData:TStringList); 95 223 var 96 224 RecsToSave: TStringList; 97 i: integer;98 x: string;99 225 begin 100 226 RecsToSave := TStringList.Create; 101 227 RecsToSave.Clear; 228 102 229 RecsToSave := AttachDxToOrderList(pBillingData); //call with new Biling data, return-code returned 103 // for i := 0 to RecstoSave.Count-1 do 104 // begin 105 // ShowMessage('Data Sent to ORW ' + RecsToSave.Strings[i]); 106 // end; 107 CallV('ORWDBA1 RCVORCI',[RecsToSave]); 108 // if Assigned(UBAGlobals.BAConsultOrdersRequireDx) then UBAGlobals.BAConsultOrdersRequireDx.Clear; 230 rpcSaveCIDCData(RecsToSave); // verify and save billing data 231 109 232 if Assigned(UBAGlobals.BAOrderList) then UBAGlobals.BAOrderList.Clear; // hds00005025 110 233 end; … … 123 246 pList.Add(pOrderID); 124 247 Result := FALSE; 125 248 // call returns boolean, orders is billable=1 or nonbillable=0 or discontinued = 0 126 249 tCallV(rList,'ORWDBA1 ORPKGTYP',[pList]); 127 250 //returns boolean value by OrderID - True = billable … … 158 281 currentOrderString := pOrderList.Strings[i]; 159 282 currentOrderID := piece(pOrderList.Strings[i],';',1)+ ';1'; 283 160 284 GetBADxListForOrder(baseDxRec, currentOrderID); 161 285 FlagsStatsIn := BAFlagsIN; … … 174 298 end; 175 299 176 177 178 300 function rpcAddToPersonalDxList(UserDUZ:int64; DxCodes:TStringList):boolean; 179 //input example ien^code = 12345^306.70180 begin 181 Result := (sCallV('ORWDBA2 ADDPDL', [UserDUZ,DxCodes])= '1');301 //input example ien^code(s) = 12345^306.70^431.22 302 begin 303 Result := (sCallV('ORWDBA2 ADDPDL', [UserDUZ,DxCodes])= '1'); 182 304 end; 183 305 … … 198 320 end; 199 321 200 function rpcOrderRequiresDx(pList: TStringList):boolean;201 var x: string;202 i,j: integer;203 returnList, updatedList: TStringList;204 begin205 // for i := 0 to plist.count-1 do206 // x := plist.strings[i];207 Result := FALSE;208 returnList := TStringList.Create;209 updatedList := TStringList.Create;210 returnList.Clear;211 updatedList.Clear;212 // remove deleted orderid's213 if UBAGlobals.BADeltedOrders.Count > 0 then214 begin215 for i := 0 to UBAGlobals.BADeltedOrders.Count-1 do216 x := UBAGlobals.BADeltedOrders.Strings[i];217 for j := 0 to pList.Count-1 do218 begin219 if x = pList.Strings[j] then220 continue // orderid is removed.. or skipped221 else222 updatedList.Add(x);223 end;224 end225 else226 updatedList.Assign(pList);227 // call returns boolean, orders is billable=1 or nonbillable=0 or discontinued = 0228 tCallV(returnList,'ORWDBA1 ORPKGTYP',[updatedList]);229 //Remove NON LRMP orders from the mix(for checking for dx entry);230 // BAOrderList and pList are in sync - order id....231 for i := 0 to BAOrderList.Count-1 do232 begin233 x:= piece(returnList.Strings[i],'^',1);234 if x = BILLABLE_ORDER then // change to test BA235 begin236 updatedBAOrderList.Add(BAOrderList[i]);237 Result := TRUE;238 end;239 end;240 end;241 322 // returns value used to bypass Billing Aware if needed. 242 323 // turns off visual and functionality 243 procedure rpcSetBillingAwareSwitch(encProvider:int64; encLocation: integer); 244 begin 245 BILLING_AWARE := TRUE; 246 if (encProvider = 0) and not PersonHasKey(encProvider, 'PROVIDER') then 247 BILLING_AWARE := FALSE 248 else 249 begin 250 if (sCallV('ORWDBA1 BASTATUS', [nil]) = '1') then // Master switch is set "ON" 251 BILLING_AWARE := (sCallV('ORWDBA4 GETBAUSR', [encProvider]) = '1') 252 else 253 BILLING_AWARE := FALSE; 254 end; 255 end ; 324 procedure rpcSetBillingAwareSwitch(encProvider:int64; pPatientDFN: string); 325 begin 326 // Is Provider -> Is Master Sw -> Is CIDC SW -> Is Patient Insured 327 BILLING_AWARE := FALSE; 328 // verify user is a provider 329 if (encProvider <> 0) and PersonHasKey(encProvider, 'PROVIDER') then 330 // Master switch is set "ON" 331 if (sCallV('ORWDBA1 BASTATUS', [nil]) = '1') then 332 // User is CIDC Enabled 333 if (sCallV('ORWDBA4 GETBAUSR', [encProvider]) = '1') then 334 begin 335 // Verify Patient is Insured 336 if rpcIsPatientInsured(pPatientDFN) then 337 BILLING_AWARE := TRUE; 338 end; 339 {$ifdef debug}BILLING_AWARE := TRUE;{$endif} 340 end; 341 342 // verify CIDC Master Switch and Provider is CIDC Enabled. 343 // Patient insurance check is bypassed. (hds7564) 344 function IsCIDCProvider(encProvider:int64):boolean; 345 begin 346 Result := False; 347 if rpcGetBAMasterSwStatus then 348 if (encProvider <> 0) and PersonHasKey(encProvider, 'PROVIDER') then 349 Result := True; 350 end; 351 256 352 257 353 function rpcGetBAMasterSwStatus:boolean; 258 354 begin 259 Result := False;260 355 Result := (sCallV('ORWDBA1 BASTATUS', [nil]) = '1'); // Master switch is set "ON" 261 262 263 end; 356 end; 357 264 358 265 359 procedure rpcSaveNurseConsultOrder(pOrderRec:TStringList); 266 360 begin 267 CallV('ORWDBA1 RCVORCI',[pOrderRec]); 268 end; 361 rpcSaveCIDCData(pOrderRec); 362 end; 363 269 364 270 365 procedure rpcSaveBillingDxEntered; // if not mandatory and user enters dx. … … 295 390 baseDxRec := nil; 296 391 baseDxRec := TBADxRecord.Create; 297 InitializeNewDxRec(baseDxRec);298 299 try392 InitializeNewDxRec(baseDxRec); 393 394 try 300 395 for i := 0 to BAOrderList.Count-1 do 301 396 begin … … 305 400 if baseDxRec.FBADxCode <> '' then 306 401 begin 307 402 NewBillingList.Add(currentOrderString +'^'+ baseDxRec.FBADxCode +'^'+ baseDxRec.FBASecDx1+ 308 403 '^'+ baseDxRec.FBASecDx2+'^'+ baseDxRec.FBASecDx3); 309 404 end; 310 405 end; 311 except312 on EListError do313 begin314 {$ifdef debug}ShowMessage('EListError in UBACore.rpcSaveBillingDxEntered()');{$endif}315 raise;406 except 407 on EListError do 408 begin 409 {$ifdef debug}ShowMessage('EListError in UBACore.rpcSaveBillingDxEntered()');{$endif} 410 raise; 316 411 end; 317 412 end; 318 413 319 if NewBillingList.Count > 0 then 320 CallV('ORWDBA1 RCVORCI',[NewBillingList]); //1.3.10 321 414 rpcSaveCIDCData(NewBillingList); 322 415 if Assigned(NewBillingList) then FreeAndNil(NewBillingList); 323 // if Assigned(UBAGlobals.BAConsultOrdersRequireDx) then UBAGlobals.BAConsultOrdersRequireDx.Clear;324 325 416 end; 326 417 end; … … 335 426 336 427 procedure rpcGetProviderPatientDaysDx(ProviderIEN: string;PatientIEN: string); 337 var i:integer; 338 x: string; 428 var 339 429 tmplst: TStringList; 340 430 begin … … 351 441 function rpcGetTFHintData:TStringList; 352 442 begin 353 Result := nil;354 443 tCallv(BATFHints,'ORWDBA3 HINTS', [nil]); 355 444 Result := BATFHints; … … 366 455 rList.Clear; 367 456 NonBillableOrderList.Clear; 368 Result := NonBillableOrderList;369 457 // call returns boolean, orders is billable=1 or nonbillable=0 or discontinued = 0 370 458 tCallV(rList,'ORWDBA1 ORPKGTYP',[pOrderList]); … … 396 484 end; 397 485 // call returns boolean, orders is billable=1 or nonbillable=0 or discontinued = 0 398 tCallV(rList,'ORWDBA1 ORPKGTYP',[OrderIDList]);486 tCallV(rList,'ORWDBA1 ORPKGTYP',[OrderIDList]); 399 487 400 488 for i := 0 to rList.Count-1 do … … 403 491 OrderListSCEI.Add(OrderIDList.Strings[i]); 404 492 end; 493 end; 494 495 procedure rpcSaveCIDCData(pCIDCList: TStringList); 496 var 497 CIDCList :TStringList; 498 begin 499 CIDCList := TStringList.create; 500 CIDCList.Clear; 501 // insure record contain valid orderid 502 if pCIDCList.Count > 0 then 503 begin 504 CIDCList := VerifyOrderIdExists(pCIDCList); 505 if CIDCList.Count > 0 then 506 CallV('ORWDBA1 RCVORCI',[CIDCList]); 507 end; 508 if Assigned(CIDCList) then FreeAndNil(CIDCList); 509 end; 510 511 function rpcIsPatientInsured(pPatientDFN: string):boolean; 512 begin 513 Result := (sCallV('ORWDBA7 ISWITCH',[pPatientDFN]) = '1'); 514 405 515 end; 406 516 … … 433 543 if tempDxRec.FBADxCode = '' then 434 544 begin 435 Result := FALSE;436 Break;545 Result := FALSE; 546 Break; 437 547 end; 438 548 end; … … 452 562 453 563 454 function BADxEntered:boolean;455 var456 i, orderStatus: integer;457 x: string;458 passList: TStringList;459 holdOrderList: TStringList;460 thisOrderID: string;461 thisRec: string;462 begin463 Result := FALSE;464 holdOrderList := TStringList.Create;465 holdOrderList.Clear;466 updatedBAOrderList := TStringList.Create;467 updatedBAOrderList.Clear;468 passList := TStringList.Create;469 passList.Clear;470 // determine which orders require a dx (lrmp- only)471 // if NO then continue472 // if YES, check BADxList for orders with DX enteries.473 // if ok then create data string pass to M via RPC474 475 orderStatus := 0;476 Result := true;477 478 try479 for i := 0 to BAOrderList.Count-1 do480 begin481 thisRec := BAOrderList.Strings[i];482 thisOrderID := piece(thisRec,';',1) + ';1'; //rebuild orderID pass to M.483 484 x := BAOrderList.Strings[i];485 orderStatus := StrToInt(CharAt(Piece(x, ';', 2), 1)); // Order Status 1=OK, 2=DISCONTINUE486 if orderStatus = integer(BAOK2SIGN) then487 begin488 passList.Add(piece(x,';',1));489 holdOrderList.Add(x);// place holder for orders that can be signed!490 end;491 end;492 except493 on EListError do494 begin495 {$ifdef debug}ShowMessage('EListError in UBACore.BADxEntered()');{$endif}496 raise;497 end;498 end;499 500 BAOrderList.Assign(holdOrderList); //assign signable orders to BAOrderList for further processing501 holdOrderList.Clear; // CQ5025502 //call with passList determine if LRMP503 504 if rpcOrderRequiresDx(passList) then505 BAOrderList.Assign(updatedBAOrderList);506 507 if updatedBAOrderList.Count <= 0 then // order list reflecting orders flagged as -508 begin // dx required.509 Result := TRUE; // force true, no record need DX entry510 rpcSaveBillingDxEntered; // save billing data for orders that may have dx enteries511 Exit; //to do. clean this up... when time permitts512 end513 else514 begin515 if OrdersHaveDx(UBAGlobals.BAOrderList) then516 rpcSaveBillingData(UBAGlobals.BAOrderList)517 else518 begin519 Result := FALSE;520 Exit;521 end;522 end;523 end;524 564 525 565 … … 557 597 thisRec.FBASC := Piece(ProblemRec,U,5); 558 598 thisRec.FBASC_YN := Piece(ProblemRec,U,6); 559 thisRec.FBATreatFactors := Piece(ProblemRec,')',1); 560 thisRec.FBATreatFactors := Piece(thisRec.FBATreatFactors,'(',2); 561 599 //HDS8409 600 if StrPos(PChar(ProblemRec),'(') <> nil then 601 thisRec.FBATreatFactors := ProcessProblemTFactors(ProblemRec) 602 else 603 begin 604 thisRec.FBATreatFactors := Piece(ProblemRec,')',1); 605 thisRec.FBATreatFactors := Piece(thisRec.FBATreatFactors,'(',2); 606 end; 607 //HDS8409 562 608 with thisRec do 563 609 begin … … 571 617 TFResults := ( FBADxCode + U + FBADxText ); 572 618 end; 573 619 574 620 Dest := TFResults; 575 621 end; … … 657 703 var strDxCode,strDxName:string; 658 704 begin 659 660 661 662 705 Result := ''; 706 strDxCode := Piece(FactorsIN,U,2); 707 strDxName := Piece(FactorsIN,'(',1); 708 Result := (strDxName + U + strDxCode); 663 709 end; 664 710 … … 684 730 685 731 Result := tmplst; 686 end;687 688 // UBAGlobals.NonBillableOrderList must be populated prior to calling this function.689 // call rpcNonBillableOrders to populate List.690 function IsOrderBillable(pOrderID: string):boolean ;691 var692 i: integer;693 currOrderID: string;694 matchOrderID : string;695 696 begin697 Result := TRUE; // = Billable698 currOrderID := PrepOrderID(pOrderID);699 if Piece(pOrderID,';',2) = DISCONTINUED_ORDER THEN700 begin701 Result := FALSE;702 Exit;703 end;704 try705 for i := 0 to UBAGlobals.NonBillableOrderList.Count -1 do706 begin707 matchOrderID := PrepOrderID( (Piece(UBAGlobals.NonBillableOrderList.Strings[i],U,1)) );708 if currOrderID = matchOrderID then709 Result := FALSE //= Non Billable710 end;711 except712 on EListError do713 begin714 {$ifdef debug}ShowMessage('EListError in UBACore.IsOrderBillable()');{$endif}715 raise;716 end;717 end;718 732 end; 719 733 … … 748 762 // this change may have an impact on response time?????? 749 763 // change from save orders with dx to save all. 06/24/04 750 // / if not clear treatment factors for order is non cidc764 // / if not clear treatment factors for order is non cidc 751 765 uBAGlobals.UnsignedOrders.Add(pOrderRec); 752 766 … … 764 778 if Assigned(rList) then rList.Clear; 765 779 if Assigned(newList) then newList.Clear; 766 767 768 769 770 771 780 781 for i := 0 to pOrderIDList.Count-1 do 782 begin 783 newList.Add(Piece(pOrderIDList.Strings[i],';',1)); 784 x := newlist.strings[i]; 785 end; 772 786 if newList.Count > 0 then 773 787 tCallV(rList,'ORWDBA4 GETTFCI',[newList]); … … 781 795 thisList: TStringList; 782 796 rList: TStringList; 783 i:integer;784 x: string;785 797 begin 786 798 … … 789 801 if Assigned(rList) then rList.Clear; 790 802 if Assigned(thisList)then thisList.Clear; 791 for i := 0 to pOrderList.Count -1 do 792 x := pOrderList.Strings[i]; 793 rpcSaveBillingData(pOrderList); // save unsigned info to be displayed when recalled at later time 803 SaveBillingData(pOrderList); // save unsigned info to be displayed when recalled at later time 794 804 end; 795 805 … … 980 990 function IsAllOrdersNA(pOrderList:TStringList):boolean; 981 991 var 982 i ,j:integer;992 i:integer; 983 993 rList: TStringList; 984 994 begin … … 986 996 if Assigned(rList) then rList.Clear; 987 997 Result := True;// disables dx button 988 for j := 0 to pOrderList.Count-1 do 989 begin 990 // code added to allow consult orders that are not cidc but require dx, dx can be edited. 991 if tempDxNodeExists(pOrderList.Strings[j]) then 992 begin 993 Result := False; 994 Exit; 995 end 996 else 997 if Piece(pOrderList.Strings[j],';',2) = DISCONTINUED_ORDER then 998 begin 999 Result := True; 1000 Exit; 1001 end; 1002 1003 end; 998 1004 999 // call returns boolean, orders is billable=1 or nonbillable=0 or discontinued = 0 1005 1000 tCallV(rList,'ORWDBA1 ORPKGTYP',[pOrderList]); … … 1097 1092 if pos( '(', thisString) > 0 then 1098 1093 begin 1099 dx2 := Piece(thisString,U,2);1100 dx2 := Piece(dx2,'(',1)+ U + Piece(thisString,':',2);1094 dx2 := Piece(thisString,U,2); 1095 dx2 := Piece(dx2,'(',1)+ U + Piece(thisString,':',2); 1101 1096 end 1102 1097 else 1103 1098 begin 1104 dx2 := Piece(thisString,U,2);1105 dx2 := Piece(dx2,':',1)+ U + Piece(thisString,':',2);1099 dx2 := Piece(thisString,U,2); 1100 dx2 := Piece(dx2,':',1)+ U + Piece(thisString,':',2); 1106 1101 end 1107 1102 end … … 1111 1106 if pos( '(', thisString) > 0 then 1112 1107 begin 1113 dx3 := Piece(thisString,U,2);1114 dx3 := Piece(dx3,'(',1)+ U + Piece(thisString,':',2);1108 dx3 := Piece(thisString,U,2); 1109 dx3 := Piece(dx3,'(',1)+ U + Piece(thisString,':',2); 1115 1110 end 1116 1111 else 1117 1112 begin 1118 dx3 := Piece(thisString,U,2);1119 dx3 := Piece(dx3,':',1)+ U + Piece(thisString,':',2);1113 dx3 := Piece(thisString,U,2); 1114 dx3 := Piece(dx3,':',1)+ U + Piece(thisString,':',2); 1120 1115 end 1121 1116 end … … 1125 1120 if pos( '(', thisString) > 0 then 1126 1121 begin 1127 dx4 := Piece(thisString,U,2);1128 dx4 := Piece(dx4,'(',1)+ U + Piece(thisString,':',2);1122 dx4 := Piece(thisString,U,2); 1123 dx4 := Piece(dx4,'(',1)+ U + Piece(thisString,':',2); 1129 1124 end 1130 1125 else 1131 1126 begin 1132 dx4 := Piece(thisString,U,2);1133 dx4 := Piece(dx4,':',1)+ U + Piece(thisString,':',2);1127 dx4 := Piece(thisString,U,2); 1128 dx4 := Piece(dx4,':',1)+ U + Piece(thisString,':',2); 1134 1129 end; 1135 1130 end; … … 1206 1201 dxRec := BuildConsultDxRec(ConsultOrderRec); 1207 1202 orderList.Add(RecOut.FExistingRecordID); 1208 TfFlags := Piece(GetPatientTFactors(orderList),U,2); 1203 // TfFlags := Piece(GetPatientTFactors(orderList),U,2); 1204 TfFlags := GetPatientTFactors(orderList); 1205 TfFlags := ConvertPIMTreatmentFactors(TfFlags); 1209 1206 orderList.Clear; 1210 if strLen(PChar(dxRec)) > 0 then1211 orderList.Add(RecOut.FExistingRecordID +TfFlags + '^'+ BuildConsultDxRec(ConsultOrderRec) )1212 else1207 // if strLen(PChar(dxRec)) > 0 then 1208 // orderList.Add(RecOut.FExistingRecordID +TfFlags + '^'+ BuildConsultDxRec(ConsultOrderRec) ) 1209 // else 1213 1210 orderList.Add(RecOut.FExistingRecordID +TfFlags); 1214 rpcSaveBillingData(OrderList); // save unsigned info to be displayed when re1211 SaveBillingData(OrderList); // save unsigned info to be displayed when re 1215 1212 end; 1216 1213 end; … … 1241 1238 1242 1239 begin 1243 strFlagsAsIs := pFlagsAsIs; // flags from pims1244 strTFactors := pPLFactors; // value selected from problem list1245 strFlagsOut := ''; // flags updated with selected values from problem list1246 x := strFlagsAsIs;1247 Result := '';1240 strFlagsAsIs := pFlagsAsIs; // flags from pims 1241 strTFactors := pPLFactors; // value selected from problem list 1242 strFlagsOut := ''; // flags updated with selected values from problem list 1243 x := strFlagsAsIs; 1244 Result := ''; 1248 1245 1249 1246 UBAGlobals.SC := Copy(x,1,1); … … 1279 1276 UBAGlobals.MST := 'C'; 1280 1277 1278 if UBAGlobals.HNC <> 'N' then 1279 if StrPos(PChar(strTFactors),PChar(HEAD_NECK_CANCER)) <> nil then 1280 UBAGlobals.HNC := 'C'; 1281 1281 1282 if UBAGlobals.CV <>'N' then 1282 1283 if StrPos(PChar(strTFactors),PChar(COMBAT_VETERAN)) <> nil then … … 1289 1290 end; 1290 1291 1291 procedure GetBAStatus(pProvider:int64; p Location:integer);1292 procedure GetBAStatus(pProvider:int64; pPatientDFN: string); 1292 1293 begin 1293 1294 // sets global switch, based in value returned from server. 1294 1295 // True -> Billing Aware Switch ON. else OFF 1295 1296 1296 UBACore.rpcSetBillingAwareSwitch(pProvider,p Location);1297 UBACore.rpcSetBillingAwareSwitch(pProvider,pPatientDFN); 1297 1298 1298 1299 if Assigned(UBAGlobals.BAPCEDiagList) then UBAGlobals.BAPCEDiagList.Clear; … … 1374 1375 Result := (strSC + strAO + strIR + strEC + strMST + strHNC + strCV); 1375 1376 end; 1377 1378 1376 1379 // Delete dc'd orders from BACopiedOrderList to keep things in sync. 1377 1380 procedure DeleteDCOrdersFromCopiedList(pOrderID:string); … … 1396 1399 procedure UpdateBAConsultOrderList(pDcOrders: TStringList); 1397 1400 var 1398 AnOrder,x: string;1401 x: string; 1399 1402 var i,j: integer; 1400 1403 holdList : TStringList; … … 1425 1428 end; 1426 1429 1427 {function SetOrderIDConsultDxRequired(pOrderID:string):string; 1428 var 1429 i: integer; 1430 orderIdIN, OrderIdOut,x: string; 1431 begin 1432 result := ''; 1433 for i := 0 to UBAGlobals.BAConsultOrdersRequireDx.Count-1 do 1434 begin 1435 orderIdIN := pOrderID; 1436 x := UBAGlobals.BAConsultOrdersRequireDx.Strings[i]; 1437 if orderIdIN = UBAGlobals.BAConsultOrdersRequireDx.Strings[i] then 1438 orderIdOUT := 'CONSULT_DX' // consult requires dx entry. enable display of cidc and non-cidc 1439 else 1440 orderIdOUT := orderIdIN; 1441 end; 1442 result := OrderIdOut; 1443 end; 1444 } 1430 // loop thru CIDC records remove records with invalid orderid 1431 function VerifyOrderIdExists(pOrderList: TStringList): TStringList; 1432 var 1433 goodList: TStringList; 1434 tOrderID: integer; 1435 i: integer; 1436 begin 1437 goodList := TStringList.Create; 1438 goodList.clear; 1439 1440 if pOrderList.Count > 0 then 1441 begin 1442 for i := 0 to pOrderList.Count-1 do 1443 begin 1444 tOrderID := StrToIntDef(Piece(pOrderList.Strings[i],';',1), 0); 1445 if tOrderID > 0 then 1446 goodList.add(pOrderList.Strings[i]); 1447 end; 1448 end; 1449 result := goodList; 1450 end; 1451 1452 // parse string return Treatment Factors when text inlcudes multiple "(())" 1453 //HDS8409 1454 function ProcessProblemTFactors(pText:String):String; 1455 var AText1,x: string; 1456 i,j: integer; 1457 begin 1458 if StrPos(PChar(pText),'(') = nil then exit; 1459 AText1 := Piece(pText,U,2); 1460 i := 1; 1461 j := 0; 1462 while j = 0 do 1463 begin 1464 x := Piece(AText1,'(',i); 1465 if Length(x) > 0 then 1466 inc(i) 1467 else 1468 begin 1469 x := Piece(AText1,'(',i-1); 1470 x := Piece(x,')',1); 1471 j := 1; 1472 Result := x; 1473 end; 1474 end; 1475 end; 1445 1476 1446 1477 end. -
cprs/branches/foia-cprs/CPRS-Chart/BA/UBAGlobals.pas
r459 r460 316 316 sourceOrderID: TStringList; 317 317 targetOrderIDLst: TStringList; 318 i:integer;319 tempOrderStr:string;320 318 begin 321 319 //Retrieve TF's/CI's from SOURCE Order … … 371 369 if UBAGlobals.tempDxNodeExists(thisOrderID) then 372 370 begin 373 thisRec := TBADxRecord.Create;374 371 if Assigned(tempDxList) then 375 372 … … 523 520 begin 524 521 Result := 0; 525 thisRec := TBADxRecord.Create;526 522 527 523 if Assigned(tempDxList) then … … 580 576 selectedOrders: smallint; 581 577 begin 582 Result := 0;583 578 selectedOrders := 0; 584 579 … … 762 757 if UBAGlobals.tempDxNodeExists(thisOrderID) then 763 758 begin 764 thisRec := TBADxRecord.Create;765 759 766 760 if Assigned(tempDxList) then … … 878 872 Result := false; 879 873 880 thisRec := TBADxRecord.Create;881 874 try 882 875 for i := 0 to tempDxList.Count - 1 do … … 909 902 i: integer; 910 903 begin 911 thisRec := TBADxRecord.Create;912 904 913 905 try … … 1013 1005 // StringList used to store DX Codes selected from Encounter Form 1014 1006 var 1015 BAVisitStr,BADxIEN: string; 1016 BAFileCat : char; 1017 BAFileDateTimeStr: string; 1007 BADxIEN: string; 1018 1008 BAProviderStr, BAProviderName : string; 1019 PList: TStringList;1020 1009 AList: TStringList; 1021 1010 begin … … 1106 1095 begin 1107 1096 Result := false; 1108 thisRec := TBADxRecord.Create;1109 1097 if Assigned(tempDxList) then 1110 1098 try -
cprs/branches/foia-cprs/CPRS-Chart/BA/fBALocalDiagnoses.dfm
r459 r460 21 21 PixelsPerInch = 96 22 22 TextHeight = 13 23 object lblPatientName: TStaticText24 Left = 5025 Top = 326 Width = 6527 Height = 1728 Caption = 'PatientName'29 TabOrder = 330 TabStop = True31 end32 23 object pnlTop: TPanel 33 24 Left = 0 34 25 Top = 0 35 26 Width = 612 36 Height = 11227 Height = 96 37 28 Align = alTop 38 29 Caption = 'pnlTop' … … 40 31 DesignSize = ( 41 32 612 42 112)33 96) 43 34 object lbOrders: TListBox 44 Left = 845 Top = 2 435 Left = 7 36 Top = 25 46 37 Width = 599 47 38 Height = 69 … … 49 40 IntegralHeight = True 50 41 ItemHeight = 13 51 TabOrder = 142 TabOrder = 2 52 43 OnMouseMove = lbOrdersMouseMove 53 44 end 54 45 object ORStaticText1: TORStaticText 55 Left = 846 Left = 216 56 47 Top = 8 57 48 Width = 169 … … 59 50 AutoSize = False 60 51 Caption = 'Selected Orders' 52 TabOrder = 1 53 TabStop = True 54 OnEnter = ORStaticText1Enter 55 OnExit = ORStaticText1Exit 56 end 57 object lblPatientName: TStaticText 58 Left = 11 59 Top = 9 60 Width = 76 61 Height = 17 62 Caption = 'PatientName' 63 Font.Charset = DEFAULT_CHARSET 64 Font.Color = clWindowText 65 Font.Height = -11 66 Font.Name = 'MS Sans Serif' 67 Font.Style = [fsBold] 68 ParentFont = False 61 69 TabOrder = 0 62 70 TabStop = True 63 OnEnter = ORStaticText1Enter64 OnExit = ORStaticText1Exit65 71 end 66 72 end 67 73 object pnlMain: TPanel 68 74 Left = 0 69 Top = 11275 Top = 96 70 76 Width = 612 71 Height = 2 4377 Height = 259 72 78 Align = alClient 73 79 TabOrder = 1 -
cprs/branches/foia-cprs/CPRS-Chart/BA/fBALocalDiagnoses.pas
r459 r460 18 18 end; 19 19 TfrmBALocalDiagnoses = class(TfrmAutoSz) 20 lblPatientName: TStaticText;21 20 pnlTop: TPanel; 22 21 lbOrders: TListBox; … … 38 37 ORStaticText3: TORStaticText; 39 38 ORStaticText4: TORStaticText; 39 lblPatientName: TStaticText; 40 40 procedure buOKClick(Sender: TObject); 41 41 procedure buCancelClick(Sender: TObject); … … 798 798 procedure TfrmBALocalDiagnoses.AddToProblemList; 799 799 var 800 i ,j: integer;801 tempCode, passCode ,x: string;800 i: integer; 801 tempCode, passCode: string; 802 802 NewList: TStringList; 803 803 PatientInfo:string; -
cprs/branches/foia-cprs/CPRS-Chart/BA/fBAOptionsDiagnoses.dfm
r459 r460 30 30 TabOrder = 0 31 31 object Splitter1: TSplitter 32 Left = 4 6832 Left = 458 33 33 Top = 26 34 34 Width = -3 … … 37 37 end 38 38 object Splitter2: TSplitter 39 Left = 1 9339 Left = 169 40 40 Top = 26 41 41 Width = 7 … … 44 44 end 45 45 object Splitter3: TSplitter 46 Left = 4 6746 Left = 457 47 47 Top = 26 48 48 Width = 1 … … 50 50 Cursor = crHSplit 51 51 end 52 object Splitter4: TSplitter53 Left = 38554 Top = 2655 Width = 256 Height = 46357 Cursor = crHSplit58 end59 52 object Splitter5: TSplitter 60 Left = 4 6553 Left = 455 61 54 Top = 26 62 55 Width = 2 … … 112 105 Left = 1 113 106 Top = 26 114 Width = 1 92107 Width = 168 115 108 Height = 463 116 109 Align = alLeft … … 126 119 Left = 0 127 120 Top = 17 128 Width = 1 92121 Width = 161 129 122 Height = 446 130 Align = alClient131 123 Font.Charset = DEFAULT_CHARSET 132 124 Font.Color = clWindowText … … 148 140 Left = 0 149 141 Top = 0 150 Width = 1 92142 Width = 168 151 143 Height = 17 152 144 DragReorder = False … … 161 153 end 162 154 object Panel4: TPanel 163 Left = 200164 Top = 26 165 Width = 185155 Left = 176 156 Top = 26 157 Width = 201 166 158 Height = 463 167 159 Align = alLeft … … 177 169 Left = 0 178 170 Top = 17 179 Width = 185171 Width = 201 180 172 Height = 446 181 Align = alLeft 182 Anchors = [akTop, akRight, akBottom] 173 Align = alClient 183 174 ItemHeight = 13 184 175 MultiSelect = True 185 176 ParentShowHint = False 186 177 ShowHint = True 178 Sorted = True 187 179 TabOrder = 0 188 180 OnClick = lbDiagnosisChange … … 196 188 Left = 0 197 189 Top = 0 198 Width = 185190 Width = 201 199 191 Height = 17 200 192 DragReorder = False … … 209 201 end 210 202 object Panel5: TPanel 211 Left = 4 65212 Top = 26 213 Width = 2 47203 Left = 455 204 Top = 26 205 Width = 257 214 206 Height = 463 215 207 Align = alClient … … 220 212 Left = 0 221 213 Top = 17 222 Width = 2 47214 Width = 257 223 215 Height = 446 224 216 Align = alClient … … 229 221 ParentShowHint = False 230 222 ShowHint = True 223 Sorted = True 231 224 TabOrder = 0 232 225 OnClick = lbPersonalDxClick … … 238 231 Left = 0 239 232 Top = 0 240 Width = 2 47233 Width = 257 241 234 Height = 17 242 235 DragReorder = False … … 277 270 end 278 271 object Panel7: TPanel 279 Left = 3 87272 Left = 377 280 273 Top = 26 281 274 Width = 78 -
cprs/branches/foia-cprs/CPRS-Chart/BA/fBAOptionsDiagnoses.pas
r459 r460 29 29 btnAdd: TBitBtn; 30 30 btnDelete: TBitBtn; 31 Splitter4: TSplitter;32 31 Splitter5: TSplitter; 33 32 Button1: TButton; … … 65 64 procedure ListDiagnosesCodes(Section: String); 66 65 procedure InactiveICDNotification; 66 procedure SyncDxDeleteList; 67 procedure SyncDxNewList; 67 68 68 69 public … … 123 124 LoadEncounterDx; 124 125 ListDiagnosesSections(lbSections.Items); 125 lbPersonalDx.Items := rpcGetPersonalDxList(User.DUZ); 126 // lbPersonalDx.Items := rpcGetPersonalDxList(User.DUZ); 127 LoadPersonalDxList; 126 128 btnOK.Enabled := False; 127 129 hdrCntlDx.Sections[0].Width := lbPersonalDX.Width; 128 130 hdrCntlDxSections.Sections[0].Width := lbSections.Width; 129 131 hdrCntlDxAdd.Sections[0].Width := lbDiagnosis.Width; 130 lbPersonalDx.Sorted := false;131 132 // lbPersonalDx.Sorted := false; 133 // lbPersonalDx.Sorted := True; 132 134 lbPersonalDX.Repaint; 133 135 end; … … 374 376 procedure TfrmBAOptionsDiagnoses.btnDeleteClick(Sender: TObject); 375 377 var 376 delDxCode: string; 377 i, c: integer; 378 begin 379 inherited; 380 // save dx seleted for deletion, update file when ok is pressed 381 for i := 0 to lbPersonalDX.Count-1 do 382 begin 383 if(lbPersonalDX.Selected[i]) then 384 begin 385 delDxCode := Piece(lbPersonalDX.Items[i],U,1); 386 delDxLst.Add(delDxCode); 387 end; 388 end; 389 378 i, c: integer; 379 begin 380 inherited; 381 SyncDxDeleteList; 382 SyncDxNewList; 390 383 // delete selected dx from listbox. 391 384 with lbPersonalDX do … … 599 592 end; 600 593 594 procedure TfrmBAOptionsDiagnoses.SyncDxDeleteList; 595 var 596 i: integer; 597 delDxCode: string; 598 begin 599 // save dx selected for deletion, update file when ok is pressed 600 for i := 0 to lbPersonalDX.Count-1 do 601 begin 602 if(lbPersonalDX.Selected[i]) then 603 begin 604 delDxCode := Piece(lbPersonalDX.Items[i],U,1); 605 delDxLst.Add(delDxCode); 606 end; 607 end; 608 end; 609 610 procedure TfrmBAOptionsDiagnoses.SyncDxNewList; 611 var 612 i,j :integer; 613 begin 614 // remove diagnoses selected for deletion from newdxList; 615 for i := 0 to lbPersonalDX.Count-1 do 616 begin 617 if lbPersonalDX.Selected[i] then 618 begin 619 for j := 0 to newDxLst.Count-1 do 620 begin 621 if (Piece(lbPersonalDX.Items[i],U,1)) = (newDxLst.Strings[j]) then 622 begin 623 newDxLst.Delete(j); 624 Break; 625 end; 626 end; 627 end; 628 end; 629 end; 630 631 601 632 initialization 602 633 uAddToPDL := 0;
Note:
See TracChangeset
for help on using the changeset viewer.