Changeset 829 for cprs/trunk/CPRS-Chart/Orders/fODDiet.pas
- Timestamp:
- Jul 7, 2010, 4:31:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Chart/Orders/fODDiet.pas
r456 r829 5 5 uses 6 6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 7 fODBase, ComCtrls, ExtCtrls, StdCtrls, Grids, ORCtrls, ORDtTm, ORFn, uConst; 7 fODBase, ComCtrls, ExtCtrls, StdCtrls, Grids, ORCtrls, ORDtTm, ORFn, uConst, 8 VA508AccessibilityManager; 8 9 9 10 type … … 161 162 FIsolationID: string; 162 163 FTabChanging: Boolean; 164 FGiveMultiTabMessage: boolean; 163 165 procedure DietCheckForNPO; 164 166 procedure DietCheckForTF; … … 192 194 procedure OPDietCheckForNPO; 193 195 procedure OPDietCheckForTF; 194 function PatientHasRecurringMeals(var MealList: TStringList; MealType: string = ''): boolean; 196 function PatientHasRecurringMeals(var MealList: TStringList; MealType: string = ''): boolean; 197 //procedure CheckForAutoDCOrders(EvtID: integer; CurrentText: string; var CancelText: string; Sender: TObject); 195 198 protected 196 199 procedure InitDialog; override; … … 210 213 {$R *.DFM} 211 214 212 uses uCore, rODBase, rODDiet, rCore, rOrders, fODDietLT, uAccessibleStringGrid, DateUtils; 215 uses uCore, rODBase, rODDiet, rCore, rOrders, fODDietLT, DateUtils, 216 fOrders, uODBase, VA508AccessibilityRouter; 213 217 214 218 const … … 314 318 begin 315 319 inherited; 320 FGiveMultiTabMessage := ScreenReaderSystemActive; 316 321 AbortOrder := False; 317 322 uRecurringMealList := TStringList.Create; … … 366 371 end; 367 372 end; 368 TAccessibleStringGrid.WrapControl(grdSelected);369 373 end; 370 374 371 375 procedure TfrmODDiet.FormDestroy(Sender: TObject); 372 376 begin 373 TAccessibleStringGrid.UnwrapControl(grdSelected);374 377 TFClearGrid; 375 378 uRecurringMealList.Free; … … 667 670 end; 668 671 669 procedure TfrmODDiet.nbkDietChange(Sender: TObject); 670 var 671 x, CxMsg: string ; 672 i: integer; 673 AStringList: TStringList; 672 (*procedure TfrmODDiet.CheckForAutoDCOrders(EvtID: integer; CurrentText: string; var CancelText: string; Sender: TObject); 674 673 const 675 // TX_CX_CUR = 'A new diet order will CANCEL and REPLACE this current diet:' + CRLF + CRLF;676 674 TX_CX_CUR = 'A new diet order will CANCEL and REPLACE this current diet now unless' + CRLF + 677 675 'you specify a start date for when the new diet should replace the current' + CRLF + 678 676 'diet:' + CRLF + CRLF; 679 677 TX_CX_FUT = 'A new diet order with no expiration date will CANCEL and REPLACE these diets:' + CRLF + CRLF; 678 TX_CX_DELAYED1 = 'There are other delayed diet orders for this release event:'; 679 TX_CX_DELAYED2 = 'This new diet order may cancel and replace those other diets' + CRLF + 680 'IMMEDIATELY ON RELEASE, unless you either:' + CRLF + CRLF + 681 682 '1. Specify an expiration date/time for this order that will' + CRLF + 683 ' be prior to the start date/time of those other orders; or' + CRLF + CRLF + 684 685 '2. Specify a later start date/time for this order for when you' + CRLF + 686 ' would like it to cancel and replace those other orders.'; 687 688 var 689 i: integer; 690 AStringList: TStringList; 691 AList: TList; 692 x, PtEvtIFN, PtEvtName: string; 693 //AResponse: TResponse; 694 begin 695 if Self.EvtID = 0 then // check current and future released diets 696 begin 697 x := CurrentText; 698 if Piece(x, #13, 1) <> 'Current Diet: ' then 699 begin 700 AStringList := TStringList.Create; 701 try 702 AStringList.Text := x; 703 CancelText := TX_CX_CUR + #9 + Piece(AStringList[0], ':', 1) + ':' + CRLF + CRLF 704 + #9 + Copy(AStringList[0], 16, 99) + CRLF; 705 if AStringList.Count > 1 then 706 begin 707 CancelText := CancelText + CRLF + CRLF + 708 TX_CX_FUT + #9 + Piece(AStringList[1], ':', 1) + ':' + CRLF + CRLF 709 + #9 + Copy(AStringList[1], 22, 99) + CRLF; 710 if AStringList.Count > 2 then 711 for i := 2 to AStringList.Count - 1 do 712 CancelText := CancelText + #9 + TrimLeft(AStringList[i]) + CRLF; 713 end; 714 finally 715 AStringList.Free; 716 end; 717 end; 718 end 719 else if Sender is TButton then // delayed orders code here - on accept only 720 begin 721 //AResponse := Responses.FindResponseByName('STOP', 1); 722 //if (AResponse <> nil) and (AResponse.EValue <> '') then exit; 723 AList := TList.Create; 724 try 725 PtEvtIFN := IntToStr(frmOrders.TheCurrentView.EventDelay.PtEventIFN); 726 PtEvtName := frmOrders.TheCurrentView.EventDelay.EventName; 727 LoadOrdersAbbr(AList, frmOrders.TheCurrentView, PtEvtIFN); 728 for i := AList.Count - 1 downto 0 do 729 begin 730 if TOrder(Alist.Items[i]).DGroup <> Self.DisplayGroup then 731 begin 732 TOrder(AList.Items[i]).Free; 733 AList.Delete(i); 734 end; 735 end; 736 if AList.Count > 0 then 737 begin 738 x := ''; 739 RetrieveOrderFields(AList, 0, 0); 740 CancelText := TX_CX_DELAYED1 + CRLF + CRLF + 'Release event: ' + PtEvtName; 741 for i := 0 to AList.Count - 1 do 742 with TOrder(AList.Items[i]) do 743 begin 744 x := x + #9 + Text + CRLF; 745 (* if StartTime <> '' then 746 x := #9 + x + 'Start: ' + StartTime + CRLF 747 else 748 x := #9 + x + 'Ordered: ' + FormatFMDateTime('mmm dd,yyyy@hh:nn', OrderTime) + CRLF;*) 749 (* end; 750 CancelText := CancelText + CRLF + CRLF + x; 751 CancelText := CancelText + CRLF + CRLF + TX_CX_DELAYED2; 752 end; 753 finally 754 with AList do for i := 0 to Count - 1 do TOrder(Items[i]).Free; 755 AList.Free; 756 end; 757 end; 758 end;*) 759 760 procedure TfrmODDiet.nbkDietChange(Sender: TObject); 761 var 762 x: string ; 763 CxMsg: string; 680 764 begin 681 765 inherited; … … 693 777 AllowQuickOrder := True; 694 778 x := CurrentDietText; 695 if Piece(x, #13, 1) <> 'Current Diet: ' then 696 begin 697 AStringList := TStringList.Create; 698 try 699 AStringList.Text := x; 700 CxMsg := TX_CX_CUR + #9 + Piece(AStringList[0], ':', 1) + ':' + CRLF + CRLF 701 + #9 + Copy(AStringList[0], 16, 99) + CRLF; 702 if AStringList.Count > 1 then 703 begin 704 CxMsg := CxMsg + CRLF + CRLF + 705 TX_CX_FUT + #9 + Piece(AStringList[1], ':', 1) + ':' + CRLF + CRLF 706 + #9 + Copy(AStringList[1], 22, 99) + CRLF; 707 if AStringList.Count > 2 then 708 for i := 2 to AStringList.Count - 1 do 709 CxMsg := CxMsg + #9 + TrimLeft(AStringList[i]) + CRLF; 710 end; 711 finally 712 AStringList.Free; 713 end; 714 end; 779 CheckForAutoDCDietOrders(Self.EvtID, Self.DisplayGroup, x, CxMsg, nbkDiet); 715 780 if CxMsg <> '' then 716 781 begin … … 745 810 end 746 811 else 747 cboOPTFRecurringMeals.Items.Assign(uRecurringMealList);812 FastAssign(uRecurringMealList, cboOPTFRecurringMeals.Items); 748 813 end; 749 814 cboOPTFRecurringMeals.Visible := not OrderForInpatient; … … 781 846 end 782 847 else 783 cboOPELRecurringMeals.Items.Assign(uRecurringMealList);848 FastAssign(uRecurringMealList, cboOPELRecurringMeals.Items); 784 849 end 785 850 else if (StrToIntDef(uDietParams.EarlyIEN, 0) = 0) or (StrToIntDef(uDietParams.LateIEN, 0) = 0) then … … 828 893 end 829 894 else 830 cboOPAORecurringMeals.Items.Assign(uRecurringMealList);895 FastAssign(uRecurringMealList, cboOPAORecurringMeals.Items); 831 896 end; 832 897 cboOPAORecurringMeals.Visible := not OrderForInpatient; … … 854 919 AllowQuickOrder := False; 855 920 ResetControlsOP; 856 cboOPDietAvail.Items.AddStrings(SubsetOfOPDiets);921 FastAddStrings(SubsetOfOPDiets, cboOPDietAvail.Items); 857 922 { TODO -oRich V. -cOutpatient Meals : Need to DC Tubefeeding order for OP meals? } 858 923 chkOPCancelTubefeeding.State := cbGrayed; … … 873 938 LoadDietQuickList(cboOPDietAvail.Items, 'MEAL'); // use D.G. short name here 874 939 cboOPDietAvail.InsertSeparator; 875 cboOPDietAvail.Items.AddStrings(SubsetOfOPDiets);940 FastAddStrings(SubsetOfOPDiets, cboOPDietAvail.Items); 876 941 cboOPDietAvail.SelectByIEN(uDietParams.OPDefaultDiet); 877 942 { TODO -oRich V. -cOutpatient Meals : Need to DC Tubefeeding order for OP meals? } … … 886 951 Changing := False; // Changing reset 887 952 StatusText(''); 953 if FGiveMultiTabMessage then // CQ#15483 954 begin 955 FGiveMultiTabMessage := FALSE; 956 GetScreenReader.Speak('Multi Tab Form'); 957 end; 888 958 end; 889 959 … … 1615 1685 end 1616 1686 else 1617 cboOPELRecurringMeals.Items.Assign(uRecurringMealList);1687 FastAssign(uRecurringMealList, cboOPELRecurringMeals.Items); 1618 1688 end; 1619 1689 Changing := False; … … 2142 2212 var 2143 2213 DCOrder: TOrder; 2144 AResponse, AnotherResponse: TResponse;2145 2214 LateTrayFields: TLateTrayFields; 2146 NewOrder: TOrder; 2147 CanSign: Integer; 2215 //CxMsg: string; 2148 2216 begin 2149 2217 // these actions should be before inherited, so that InitDialog doesn't clear properties … … 2151 2219 if nbkDiet.ActivePage = pgeDiet then 2152 2220 begin 2221 (* if Self.EvtID <> 0 then 2222 begin 2223 CheckForAutoDCDietOrders(Self.EvtID, Self.DisplayGroup, '', CxMsg, cmdAccept); 2224 if CxMsg <> '' then 2225 begin 2226 if InfoBox(CxMsg + CRLF + CRLF + 2227 'Have you done either of the above?', 'Possible delayed order conflict', 2228 MB_ICONWARNING or MB_YESNO) = ID_NO 2229 then exit; 2230 end; 2231 end;*) 2153 2232 // create dc tubefeeding order 2154 2233 if chkCancelTubeFeeding.State = cbChecked then … … 2160 2239 end; 2161 2240 // check if late tray should be ordered 2162 AResponse := Responses.FindResponseByName('ORDERABLE', 1); 2163 if (Self.EvtID = 0) and (AResponse <> nil) and (Copy(AResponse.EValue, 1, 3) <> 'NPO') then 2164 begin 2165 AResponse := Responses.FindResponseByName('START', 1); 2166 if AResponse <> nil then CheckLateTray(AResponse.IValue, LateTrayFields, False); 2167 end; 2241 LateTrayCheck(Responses, Self.EvtID, FALSE, LateTrayFields); 2168 2242 end; 2169 2243 { TODO -oRich V. -cOutpatient Meals : Need to DC Tubefeeding order for OP meals? } … … 2179 2253 end; 2180 2254 // check if late tray should be ordered 2181 AResponse := Responses.FindResponseByName('ORDERABLE', 1); 2182 if (Self.EvtID = 0) and (AResponse <> nil) and (Copy(AResponse.EValue, 1, 3) <> 'NPO') then 2183 begin 2184 AResponse := Responses.FindResponseByName('START', 1); 2185 AnotherResponse := Responses.FindResponseByName('MEAL', 1); 2186 if (AResponse <> nil) and (AnotherResponse <> nil) then 2187 CheckLateTray(AResponse.IValue, LateTrayFields, True, CharAt(AnotherResponse.IValue, 1)); 2188 end; 2189 end; 2190 inherited; 2191 with LateTrayFields do if LateMeal <> #0 then 2192 begin 2193 NewOrder := TOrder.Create; 2194 OrderLateTray(NewOrder, LateMeal, LateTime, IsBagged); 2195 if NewOrder.ID <> '' then 2196 begin 2197 if OrderForInpatient then 2198 begin 2199 if (Encounter.Provider = User.DUZ) and User.CanSignOrders 2200 then CanSign := CH_SIGN_YES 2201 else CanSign := CH_SIGN_NA; 2202 end 2203 else 2204 begin 2205 CanSign := CH_SIGN_NA; 2206 end; 2207 Changes.Add(CH_ORD, NewOrder.ID, NewOrder.Text, '', CanSign); 2208 SendMessage(Application.MainForm.Handle, UM_NEWORDER, ORDER_NEW, Integer(NewOrder)) 2209 end 2210 else InfoBox(TX_EL_SAVE_ERR, TC_EL_SAVE_ERR, MB_OK); 2211 NewOrder.Free; 2212 end; 2255 LateTrayCheck(Responses, Self.EvtID, TRUE, LateTrayFields); 2256 end; 2257 inherited; 2258 with LateTrayFields do if LateMeal <> #0 then LateTrayOrder(LateTrayFields, OrderForInpatient); 2213 2259 end; 2214 2260
Note:
See TracChangeset
for help on using the changeset viewer.