Changeset 1679 for cprs/trunk/CPRS-Chart/Encounter/fDiagnoses.pas
- Timestamp:
- May 7, 2015, 12:34:29 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cprs/trunk/CPRS-Chart/Encounter/fDiagnoses.pas
r829 r1679 25 25 private 26 26 procedure EnsurePrimaryDiag; 27 27 function isProblem(diagnosis: TPCEDiag): Boolean; 28 function isEncounterDx(problem: string): Boolean; 28 29 protected 29 30 procedure UpdateNewItemStr(var x: string); override; … … 38 39 'via the Problems tab.'; 39 40 TC_INACTIVE_CODE = 'Problem Contains Inactive Code'; 41 TX_REDUNDANT_DX = 'The problem that you''ve selected is already included in the list of diagnoses' + #13#10 + 42 'for this encounter. No need to select it again...'; 43 TC_REDUNDANT_DX = 'Redundant Diagnosis: '; 40 44 41 45 var … … 65 69 if not Primary and (Items.Count > 0) then 66 70 begin 67 GridIndex := 0;68 TPCEDiag(Items.Objects[ 0]).Primary := True;71 GridIndex := Items.Count - 1;//0; vhaispbellc CQ 15836 72 TPCEDiag(Items.Objects[Items.Count - 1]).Primary := True; 69 73 GridChanged; 70 74 end; … … 101 105 if(lbGrid.Selected[i]) then 102 106 TPCEDiag(lbGrid.Items.Objects[i]).AddProb := (ckbDiagProb.Checked) and 107 (not isProblem(TPCEDiag(lbGrid.Items.Objects[i]))) and 103 108 (TPCEDiag(lbGrid.Items.Objects[i]).Category <> PL_ITEMS); 104 109 GridChanged; … … 130 135 else 131 136 x := x + U + '0'; 137 end; 138 139 function TfrmDiagnoses.isProblem(diagnosis: TPCEDiag): Boolean; 140 var 141 i: integer; 142 p, code, narr, sct: String; 143 begin 144 result := false; 145 for i := 0 to FProblems.Count - 1 do 146 begin 147 p := FProblems[i]; 148 code := piece(p, '^', 1); 149 narr := piece(p, '^', 2); 150 if (pos('SCT', narr) > 0) or (pos('SNOMED', narr) > 0) then 151 sct := piece(piece(piece(narr, ')', 1), '(', 2), ' ', 2) 152 else 153 sct := ''; 154 narr := TrimRight(piece(narr, '(',1)); 155 if pos(diagnosis.Code, code) > 0 then 156 begin 157 result := true; 158 break; 159 end 160 else if (sct <> '') and (pos(sct, diagnosis.Narrative) > 0) then 161 begin 162 result := true; 163 break; 164 end 165 else if pos(narr, diagnosis.Narrative) > 0 then 166 begin 167 result := true; 168 break; 169 end; 170 end; 171 end; 172 173 function TfrmDiagnoses.isEncounterDx(problem: string): Boolean; 174 var 175 i: integer; 176 dx, code, narr, pCode, pNarrative, sct: String; 177 178 function getSCT(narr: string): string; 179 begin 180 if (pos('SNOMED CT ', narr) > 0) then 181 result := copy(narr, pos('SNOMED CT ', narr) + 10, length(narr)) 182 else 183 result := ''; 184 end; 185 186 begin 187 result := false; 188 pCode := piece(problem, U, 1); 189 pNarrative := piece(problem, U, 2); 190 for i := 0 to lbGrid.Items.Count - 1 do 191 begin 192 dx := lbGrid.Items[i]; 193 narr := piece(dx, U, 3); 194 code := piece(piece(copy(narr, pos('ICD-9-CM', narr), length(narr)), ' ', 2), ')', 1); 195 sct := getSCT(piece(narr, ':', 1)); 196 if pos(pCode, narr) > 0 then 197 begin 198 result := true; 199 break; 200 end 201 else if (sct <> '') and (pos(sct, pNarrative) > 0) then 202 begin 203 result := true; 204 break; 205 end 206 else if pos(narr, pNarrative) > 0 then 207 begin 208 result := true; 209 break; 210 end; 211 end; 132 212 end; 133 213 … … 149 229 if OK then 150 230 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; 231 begin 232 if (lbGrid.Selected[k]) then 233 begin 234 if (TPCEDiag(lbGrid.Items.Objects[k]).Category = PL_ITEMS) or isProblem(TPCEDiag(lbGrid.Items.Objects[k])) then 235 PLItemCount := PLItemCount + 1; 236 end; 237 end; 153 238 OK := OK and (PLItemCount < lbGrid.SelCount); 154 239 ckbDiagProb.Enabled := OK; … … 180 265 begin 181 266 inherited; 182 if lbxSection.width = 0 then Exit; 183 FSectionTabs[0] := -(lbxSection.width - LBCheckWidthSpace - (8*MainFontWidth) - ScrollBarWidth); 267 FSectionTabs[0] := -(lbxSection.width - LBCheckWidthSpace - (10 * MainFontWidth) - ScrollBarWidth); 184 268 FSectionTabs[1] := -FSectionTabs[0]+2; 185 269 FSectionTabs[2] := -FSectionTabs[0]+4; … … 190 274 Index: Integer); 191 275 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; 276 if (not FUpdatingGrid) and (lbxSection.Checked[Index]) then 277 begin 278 if (Piece(lbxSection.Items[Index], U, 5) = '#') then 279 begin 280 InfoBox(TX_INACTIVE_CODE, TC_INACTIVE_CODE, MB_ICONWARNING or MB_OK); 281 lbxSection.Checked[Index] := False; 282 exit; 283 end 284 else if isEncounterDx(lbxSection.Items[Index]) then 285 begin 286 InfoBox(TX_REDUNDANT_DX, TC_REDUNDANT_DX + piece(lbxSection.Items[Index], '^',2), 287 MB_ICONWARNING or MB_OK); 288 lbxSection.Checked[Index] := False; 289 exit; 290 end; 291 end; 199 292 inherited; 200 293 EnsurePrimaryDiag; … … 220 313 ADiagnosis: TPCEItem; 221 314 begin 222 315 inherited; 223 316 UBAGlobals.BAPCEDiagList.Clear; 224 317 with lbGrid do for i := 0 to Items.Count - 1 do
Note:
See TracChangeset
for help on using the changeset viewer.