1 | unit fDiagnoses;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
7 | fPCEBase, StdCtrls, CheckLst, ORCtrls, ORNet, ExtCtrls, Buttons, uPCE, rPCE, ORFn,
|
---|
8 | ComCtrls, fPCEBaseMain, UBAGlobals, UBAConst, UCore, VA508AccessibilityManager;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TfrmDiagnoses = class(TfrmPCEBaseMain)
|
---|
12 | cmdDiagPrimary: TButton;
|
---|
13 | ckbDiagProb: TCheckBox;
|
---|
14 | procedure cmdDiagPrimaryClick(Sender: TObject);
|
---|
15 | procedure ckbDiagProbClicked(Sender: TObject);
|
---|
16 | procedure FormCreate(Sender: TObject);
|
---|
17 | procedure btnRemoveClick(Sender: TObject);
|
---|
18 | procedure FormResize(Sender: TObject); override;
|
---|
19 | procedure lbxSectionClickCheck(Sender: TObject; Index: Integer);
|
---|
20 | procedure btnOKClick(Sender: TObject); override;
|
---|
21 | procedure lbSectionClick(Sender: TObject);
|
---|
22 | procedure GetEncounterDiagnoses;
|
---|
23 | procedure lbSectionDrawItem(Control: TWinControl; Index: Integer;
|
---|
24 | Rect: TRect; State: TOwnerDrawState);
|
---|
25 | private
|
---|
26 | procedure EnsurePrimaryDiag;
|
---|
27 |
|
---|
28 | protected
|
---|
29 | procedure UpdateNewItemStr(var x: string); override;
|
---|
30 | procedure UpdateControls; override;
|
---|
31 | public
|
---|
32 | end;
|
---|
33 |
|
---|
34 | const
|
---|
35 | TX_INACTIVE_CODE = 'The "#" character next to the code for this problem indicates that the problem' + #13#10 +
|
---|
36 | 'references an ICD code that is not active as of the date of this encounter.' + #13#10 +
|
---|
37 | 'Before you can select this problem, you must update the ICD code it contains' + #13#10 +
|
---|
38 | 'via the Problems tab.';
|
---|
39 | TC_INACTIVE_CODE = 'Problem Contains Inactive Code';
|
---|
40 |
|
---|
41 | var
|
---|
42 | frmDiagnoses: TfrmDiagnoses;
|
---|
43 | dxList : TStringList;
|
---|
44 |
|
---|
45 | implementation
|
---|
46 |
|
---|
47 | {$R *.DFM}
|
---|
48 |
|
---|
49 | uses
|
---|
50 | fEncounterFrame, uConst, UBACore, VA508AccessibilityRouter;
|
---|
51 |
|
---|
52 | procedure TfrmDiagnoses.EnsurePrimaryDiag;
|
---|
53 | var
|
---|
54 | i: Integer;
|
---|
55 | Primary: Boolean;
|
---|
56 |
|
---|
57 | begin
|
---|
58 | with lbGrid do
|
---|
59 | begin
|
---|
60 | Primary := False;
|
---|
61 | for i := 0 to Items.Count - 1 do
|
---|
62 | if TPCEDiag(Items.Objects[i]).Primary then
|
---|
63 | Primary := True;
|
---|
64 |
|
---|
65 | if not Primary and (Items.Count > 0) then
|
---|
66 | begin
|
---|
67 | GridIndex := 0;
|
---|
68 | TPCEDiag(Items.Objects[0]).Primary := True;
|
---|
69 | GridChanged;
|
---|
70 | end;
|
---|
71 | end;
|
---|
72 | end;
|
---|
73 |
|
---|
74 | procedure TfrmDiagnoses.cmdDiagPrimaryClick(Sender: TObject);
|
---|
75 | var
|
---|
76 | gi, i: Integer;
|
---|
77 | ADiagnosis: TPCEDiag;
|
---|
78 |
|
---|
79 | begin
|
---|
80 | inherited;
|
---|
81 | gi := GridIndex;
|
---|
82 | with lbGrid do for i := 0 to Items.Count - 1 do
|
---|
83 | begin
|
---|
84 | ADiagnosis := TPCEDiag(Items.Objects[i]);
|
---|
85 | ADiagnosis.Primary := (gi = i);
|
---|
86 | end;
|
---|
87 | GridChanged;
|
---|
88 | end;
|
---|
89 |
|
---|
90 | procedure TfrmDiagnoses.ckbDiagProbClicked(Sender: TObject);
|
---|
91 | var
|
---|
92 | i: integer;
|
---|
93 | const
|
---|
94 | PL_ITEMS = 'Problem List Items';
|
---|
95 |
|
---|
96 | begin
|
---|
97 | inherited;
|
---|
98 | if(NotUpdating) then
|
---|
99 | begin
|
---|
100 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
101 | if(lbGrid.Selected[i]) then
|
---|
102 | TPCEDiag(lbGrid.Items.Objects[i]).AddProb := (ckbDiagProb.Checked) and
|
---|
103 | (TPCEDiag(lbGrid.Items.Objects[i]).Category <> PL_ITEMS);
|
---|
104 | GridChanged;
|
---|
105 | end;
|
---|
106 | end;
|
---|
107 |
|
---|
108 | procedure TfrmDiagnoses.FormCreate(Sender: TObject);
|
---|
109 | begin
|
---|
110 | inherited;
|
---|
111 | FTabName := CT_DiagNm;
|
---|
112 | FPCEListCodesProc := ListDiagnosisCodes;
|
---|
113 | FPCEItemClass := TPCEDiag;
|
---|
114 | FPCECode := 'POV';
|
---|
115 | FSectionTabCount := 3;
|
---|
116 | FormResize(Self);
|
---|
117 | end;
|
---|
118 |
|
---|
119 | procedure TfrmDiagnoses.btnRemoveClick(Sender: TObject);
|
---|
120 | begin
|
---|
121 | inherited;
|
---|
122 | EnsurePrimaryDiag;
|
---|
123 | end;
|
---|
124 |
|
---|
125 | procedure TfrmDiagnoses.UpdateNewItemStr(var x: string);
|
---|
126 | begin
|
---|
127 | inherited;
|
---|
128 | if lbGrid.Items.Count = 0 then
|
---|
129 | x := x + U + '1'
|
---|
130 | else
|
---|
131 | x := x + U + '0';
|
---|
132 | end;
|
---|
133 |
|
---|
134 | procedure TfrmDiagnoses.UpdateControls;
|
---|
135 | var
|
---|
136 | i, j, k, PLItemCount: integer;
|
---|
137 | OK: boolean;
|
---|
138 | const
|
---|
139 | PL_ITEMS = 'Problem List Items';
|
---|
140 | begin
|
---|
141 | inherited;
|
---|
142 | if(NotUpdating) then
|
---|
143 | begin
|
---|
144 | BeginUpdate;
|
---|
145 | try
|
---|
146 | cmdDiagPrimary.Enabled := (lbGrid.SelCount = 1);
|
---|
147 | OK := (lbGrid.SelCount > 0);
|
---|
148 | PLItemCount := 0;
|
---|
149 | if OK then
|
---|
150 | for k := 0 to lbGrid.Items.Count - 1 do
|
---|
151 | if (lbGrid.Selected[k]) and (TPCEDiag(lbGrid.Items.Objects[k]).Category = PL_ITEMS) then
|
---|
152 | PLItemCount := PLItemCount + 1;
|
---|
153 | OK := OK and (PLItemCount < lbGrid.SelCount);
|
---|
154 | ckbDiagProb.Enabled := OK;
|
---|
155 | if(OK) then
|
---|
156 | begin
|
---|
157 | j := 0;
|
---|
158 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
159 | begin
|
---|
160 | if(lbGrid.Selected[i]) and (TPCEDiag(lbGrid.Items.Objects[i]).AddProb) then
|
---|
161 | inc(j);
|
---|
162 | end;
|
---|
163 | if(j = 0) then
|
---|
164 | ckbDiagProb.Checked := FALSE
|
---|
165 | else
|
---|
166 | if(j < lbGrid.SelCount) then
|
---|
167 | ckbDiagProb.State := cbGrayed
|
---|
168 | else
|
---|
169 | ckbDiagProb.Checked := TRUE;
|
---|
170 | end
|
---|
171 | else
|
---|
172 | ckbDiagProb.Checked := FALSE;
|
---|
173 | finally
|
---|
174 | EndUpdate;
|
---|
175 | end;
|
---|
176 | end;
|
---|
177 | end;
|
---|
178 |
|
---|
179 | procedure TfrmDiagnoses.FormResize(Sender: TObject);
|
---|
180 | begin
|
---|
181 | inherited;
|
---|
182 | if lbxSection.width = 0 then Exit;
|
---|
183 | FSectionTabs[0] := -(lbxSection.width - LBCheckWidthSpace - (8*MainFontWidth) - ScrollBarWidth);
|
---|
184 | FSectionTabs[1] := -FSectionTabs[0]+2;
|
---|
185 | FSectionTabs[2] := -FSectionTabs[0]+4;
|
---|
186 | UpdateTabPos;
|
---|
187 | end;
|
---|
188 |
|
---|
189 | procedure TfrmDiagnoses.lbxSectionClickCheck(Sender: TObject;
|
---|
190 | Index: Integer);
|
---|
191 | begin
|
---|
192 | if not FUpdatingGrid then
|
---|
193 | if (lbxSection.Checked[Index]) and (Piece(lbxSection.Items[Index], U, 5) = '#') then
|
---|
194 | begin
|
---|
195 | InfoBox(TX_INACTIVE_CODE, TC_INACTIVE_CODE, MB_ICONWARNING or MB_OK);
|
---|
196 | lbxSection.Checked[Index] := False;
|
---|
197 | exit;
|
---|
198 | end;
|
---|
199 | inherited;
|
---|
200 | EnsurePrimaryDiag;
|
---|
201 | end;
|
---|
202 |
|
---|
203 | procedure TfrmDiagnoses.btnOKClick(Sender: TObject);
|
---|
204 | begin
|
---|
205 | inherited;
|
---|
206 | if BILLING_AWARE then
|
---|
207 | GetEncounterDiagnoses;
|
---|
208 | end;
|
---|
209 |
|
---|
210 | procedure TfrmDiagnoses.lbSectionClick(Sender: TObject);
|
---|
211 | begin
|
---|
212 | inherited;
|
---|
213 | //
|
---|
214 | end;
|
---|
215 |
|
---|
216 | procedure TfrmDiagnoses.GetEncounterDiagnoses;
|
---|
217 | var
|
---|
218 | i: integer;
|
---|
219 | dxCode, dxName: string;
|
---|
220 | ADiagnosis: TPCEItem;
|
---|
221 | begin
|
---|
222 | inherited;
|
---|
223 | UBAGlobals.BAPCEDiagList.Clear;
|
---|
224 | with lbGrid do for i := 0 to Items.Count - 1 do
|
---|
225 | begin
|
---|
226 | ADiagnosis := TPCEDiag(Items.Objects[i]);
|
---|
227 | dxCode := ADiagnosis.Code;
|
---|
228 | dxName := ADiagnosis.Narrative;
|
---|
229 | if BAPCEDiagList.Count = 0 then
|
---|
230 | UBAGlobals.BAPCEDiagList.Add(U + DX_ENCOUNTER_LIST_TXT);
|
---|
231 | UBAGlobals.BAPCEDiagList.Add(dxCode + U + dxName);
|
---|
232 | end;
|
---|
233 | end;
|
---|
234 |
|
---|
235 |
|
---|
236 | procedure TfrmDiagnoses.lbSectionDrawItem(Control: TWinControl;
|
---|
237 | Index: Integer; Rect: TRect; State: TOwnerDrawState);
|
---|
238 | begin
|
---|
239 | inherited;
|
---|
240 | if (control as TListbox).items[index] = DX_PROBLEM_LIST_TXT then
|
---|
241 | (Control as TListBox).Canvas.Font.Style := [fsBold]
|
---|
242 | else
|
---|
243 | if (control as Tlistbox).items[index] = DX_PERSONAL_LIST_TXT then
|
---|
244 | (Control as TListBox).Canvas.Font.Style := [fsBold]
|
---|
245 | else
|
---|
246 | if (control as Tlistbox).items[index] = DX_TODAYS_DX_LIST_TXT then
|
---|
247 | (Control as TListBox).Canvas.Font.Style := [fsBold]
|
---|
248 | else
|
---|
249 | if (control as Tlistbox).items[index] = DX_ENCOUNTER_LIST_TXT then
|
---|
250 | (Control as TListBox).Canvas.Font.Style := [fsBold]
|
---|
251 | else
|
---|
252 | (Control as TListBox).Canvas.Font.Style := [];
|
---|
253 |
|
---|
254 | (Control as TListBox).Canvas.TextOut(Rect.Left+2, Rect.Top+1, (Control as
|
---|
255 | TListBox).Items[Index]); {display the text }
|
---|
256 | end;
|
---|
257 |
|
---|
258 | initialization
|
---|
259 | SpecifyFormIsNotADialog(TfrmDiagnoses);
|
---|
260 |
|
---|
261 | end.
|
---|