| 1 | //kt -- Modified with SourceScanner on 7/24/2007
|
---|
| 2 | unit fPatientFlagMulti;
|
---|
| 3 |
|
---|
| 4 | interface
|
---|
| 5 |
|
---|
| 6 | uses
|
---|
| 7 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
| 8 | Dialogs, StdCtrls, fAutoSz, ORCtrls, ExtCtrls, ComCtrls, rMisc, DKLang;
|
---|
| 9 |
|
---|
| 10 | type
|
---|
| 11 | {This object holds a List of Notes Linked to a PRF as Returned VIA the RPCBroker}
|
---|
| 12 | TPRFNotes = class(TObject)
|
---|
| 13 | private
|
---|
| 14 | FPRFNoteList : TStringList;
|
---|
| 15 | public
|
---|
| 16 | //procedure to show the Notes in a ListView, requires a listview parameter
|
---|
| 17 | procedure ShowActionsOnList(DisplayList : TCaptionListView);
|
---|
| 18 | //procedure to load the notes, this will call the RPC
|
---|
| 19 | procedure Load(TitleIEN : Int64; DFN : String);
|
---|
| 20 | function getNoteIEN(index: integer): String;
|
---|
| 21 | constructor create;
|
---|
| 22 | destructor Destroy(); override;
|
---|
| 23 | end;
|
---|
| 24 |
|
---|
| 25 | TfrmFlags = class(TForm)
|
---|
| 26 | Splitter1: TSplitter;
|
---|
| 27 | pnlTop: TORAutoPanel;
|
---|
| 28 | lblFlags: TLabel;
|
---|
| 29 | lstFlags: TORListBox;
|
---|
| 30 | memFlags: TRichEdit;
|
---|
| 31 | pnlNotes: TPanel;
|
---|
| 32 | lvPRF: TCaptionListView;
|
---|
| 33 | lblNoteTitle: TLabel;
|
---|
| 34 | Splitter2: TSplitter;
|
---|
| 35 | pnlBottom: TORAutoPanel;
|
---|
| 36 | btnClose: TButton;
|
---|
| 37 | DKLanguageController1: TDKLanguageController;
|
---|
| 38 | procedure lstFlagsClick(Sender: TObject);
|
---|
| 39 | procedure FormKeyDown(Sender: TObject; var Key: Word;
|
---|
| 40 | Shift: TShiftState);
|
---|
| 41 | procedure FormShow(Sender: TObject);
|
---|
| 42 | procedure FormCreate(Sender: TObject);
|
---|
| 43 | procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 44 | procedure FormDestroy(Sender: TObject);
|
---|
| 45 | procedure lvPRFClick(Sender: TObject);
|
---|
| 46 | procedure lvPRFKeyDown(Sender: TObject; var Key: Word;
|
---|
| 47 | Shift: TShiftState);
|
---|
| 48 | private
|
---|
| 49 | FFlagID: integer;
|
---|
| 50 | FPRFNotes : TPRFNotes;
|
---|
| 51 | FNoteTitle: String;
|
---|
| 52 | procedure GetNotes();
|
---|
| 53 | public
|
---|
| 54 | { Public declarations }
|
---|
| 55 | end;
|
---|
| 56 |
|
---|
| 57 | const
|
---|
| 58 | //HIDDEN_COL = 'Press enter or space bar to view this note:'; <-- original line. //kt 7/24/2007
|
---|
| 59 | //TIU GET LINKED PRF NOTES, return position constants
|
---|
| 60 | NOTE_IEN_POS = 1;
|
---|
| 61 | ACTION_POS = 2;
|
---|
| 62 | NOTE_DATE_POS = 3;
|
---|
| 63 | AUTHOR_POS = 4;
|
---|
| 64 | //TIU GET PRF TITLE, return position constants
|
---|
| 65 | NOTE_TITLE_IEN = 1;
|
---|
| 66 | NOTE_TITLE = 2;
|
---|
| 67 |
|
---|
| 68 |
|
---|
| 69 | procedure ShowFlags(FlagId: integer = 0);
|
---|
| 70 | function HIDDEN_COL : string; //kt
|
---|
| 71 |
|
---|
| 72 | implementation
|
---|
| 73 |
|
---|
| 74 | uses uCore,uOrPtf,ORFn, ORNet, uConst, fRptBox, rCover;
|
---|
| 75 | {$R *.dfm}
|
---|
| 76 |
|
---|
| 77 | function HIDDEN_COL : string; //kt
|
---|
| 78 | begin
|
---|
| 79 | Result := DKLangConstW('fPatientFlagMulti_Press_enter_or_space_bar_to_view_this_notex');
|
---|
| 80 | end;
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | procedure ShowFlags(FlagId: integer);
|
---|
| 84 | var
|
---|
| 85 | frmFlags: TfrmFlags;
|
---|
| 86 | begin
|
---|
| 87 | frmFlags := TFrmFlags.Create(Nil);
|
---|
| 88 | try
|
---|
| 89 | SetFormPosition(frmFlags);
|
---|
| 90 | if HasFlag then
|
---|
| 91 | begin
|
---|
| 92 | //SetFormPosition(frmFlags);
|
---|
| 93 | frmFlags.FFlagID := FlagId;
|
---|
| 94 | frmFlags.lstFlags.Items.Assign(FlagList);
|
---|
| 95 | frmFlags.memFlags.SelStart := 0;
|
---|
| 96 | ResizeFormToFont(TForm(frmFlags));
|
---|
| 97 | frmFlags.ShowModal;
|
---|
| 98 | end
|
---|
| 99 | finally
|
---|
| 100 | frmFlags.Release;
|
---|
| 101 | end;
|
---|
| 102 | end;
|
---|
| 103 |
|
---|
| 104 | procedure TfrmFlags.lstFlagsClick(Sender: TObject);
|
---|
| 105 | var
|
---|
| 106 | FlagArray: TStringList;
|
---|
| 107 | begin
|
---|
| 108 | if lstFlags.ItemIndex >= 0 then
|
---|
| 109 | begin
|
---|
| 110 | FlagArray := TStringList.Create;
|
---|
| 111 | GetActiveFlg(FlagArray, Patient.DFN, lstFlags.ItemID);
|
---|
| 112 | if FlagArray.Count > 0 then
|
---|
| 113 | memFlags.Lines.Assign(FlagArray);
|
---|
| 114 | memFlags.SelStart := 0;
|
---|
| 115 | GetNotes;
|
---|
| 116 | end;
|
---|
| 117 | end;
|
---|
| 118 |
|
---|
| 119 | procedure TfrmFlags.FormKeyDown(Sender: TObject; var Key: Word;
|
---|
| 120 | Shift: TShiftState);
|
---|
| 121 | begin
|
---|
| 122 | if Key = VK_ESCAPE then
|
---|
| 123 | Close;
|
---|
| 124 | end;
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 | procedure TfrmFlags.FormShow(Sender: TObject);
|
---|
| 128 | var
|
---|
| 129 | idx: integer;
|
---|
| 130 | begin
|
---|
| 131 | inherited;
|
---|
| 132 | SetFormPosition(Self);
|
---|
| 133 | idx := 0;
|
---|
| 134 | if FFlagID > 0 then idx := lstFlags.SelectByIEN(FFlagId);
|
---|
| 135 | lstFlags.ItemIndex := idx;
|
---|
| 136 | lstFlagsClick(Self);
|
---|
| 137 | ActiveControl := memFlags;
|
---|
| 138 | GetNotes;
|
---|
| 139 | end;
|
---|
| 140 |
|
---|
| 141 | procedure TfrmFlags.FormCreate(Sender: TObject);
|
---|
| 142 | begin
|
---|
| 143 | inherited;
|
---|
| 144 | FFlagID := 0;
|
---|
| 145 | end;
|
---|
| 146 |
|
---|
| 147 | procedure TfrmFlags.FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 148 | begin
|
---|
| 149 | inherited;
|
---|
| 150 | SaveUserBounds(Self);
|
---|
| 151 | end;
|
---|
| 152 |
|
---|
| 153 | procedure TfrmFlags.GetNotes;
|
---|
| 154 | var
|
---|
| 155 | NoteTitleIEN, FlagID : Int64;
|
---|
| 156 | begin
|
---|
| 157 | if FPRFNotes = nil then
|
---|
| 158 | FPRFNotes := TPRFNotes.Create;
|
---|
| 159 | FlagID := lstFlags.ItemID;
|
---|
| 160 | CallV('TIU GET PRF TITLE', [Patient.DFN,FlagID]);
|
---|
| 161 | FNoteTitle := Piece(RPCBrokerV.Results[0],U,NOTE_TITLE);
|
---|
| 162 | // lblNoteTitle.Caption := 'Signed, Linked Notes of Title: '+ FNoteTitle; <-- original line. //kt 7/24/2007
|
---|
| 163 | lblNoteTitle.Caption := DKLangConstW('fPatientFlagMulti_Signedx_Linked_Notes_of_Titlex')+ FNoteTitle; //kt added 7/24/2007
|
---|
| 164 | NoteTitleIEN := StrToInt(Piece(RPCBrokerV.Results[0],U,NOTE_TITLE_IEN));
|
---|
| 165 | FPRFNotes.Load(NoteTitleIEN,Patient.DFN);
|
---|
| 166 | FPRFNotes.ShowActionsOnList(lvPRF);
|
---|
| 167 | with lvPRF do begin
|
---|
| 168 |
|
---|
| 169 | Columns.BeginUpdate;
|
---|
| 170 | Columns.EndUpdate;
|
---|
| 171 | end;
|
---|
| 172 | end;
|
---|
| 173 |
|
---|
| 174 | { TPRFNotes }
|
---|
| 175 |
|
---|
| 176 | constructor TPRFNotes.create;
|
---|
| 177 | begin
|
---|
| 178 | inherited;
|
---|
| 179 | FPRFNoteList := TStringList.create;
|
---|
| 180 | end;
|
---|
| 181 |
|
---|
| 182 | destructor TPRFNotes.Destroy;
|
---|
| 183 | begin
|
---|
| 184 | FPRFNoteList.Free;
|
---|
| 185 | inherited;
|
---|
| 186 | end;
|
---|
| 187 |
|
---|
| 188 | function TPRFNotes.getNoteIEN(index: integer): String;
|
---|
| 189 | begin
|
---|
| 190 | Result := Piece(FPRFNoteList[index],U,NOTE_IEN_POS);
|
---|
| 191 | end;
|
---|
| 192 |
|
---|
| 193 | procedure TPRFNotes.Load(TitleIEN: Int64; DFN: String);
|
---|
| 194 | const
|
---|
| 195 | REVERSE_CHRONO = 1;
|
---|
| 196 | begin
|
---|
| 197 | CallV('TIU GET LINKED PRF NOTES', [DFN,TitleIEN,REVERSE_CHRONO]);
|
---|
| 198 | FPRFNoteList.Assign(RPCBrokerV.Results);
|
---|
| 199 | end;
|
---|
| 200 |
|
---|
| 201 | procedure TPRFNotes.ShowActionsOnList(DisplayList: TCaptionListView);
|
---|
| 202 | var
|
---|
| 203 | i : integer;
|
---|
| 204 | ListItem: TListItem;
|
---|
| 205 | begin
|
---|
| 206 | DisplayList.Clear;
|
---|
| 207 | for i := 0 to FPRFNoteList.Count-1 do
|
---|
| 208 | begin
|
---|
| 209 | //Caption="Text for Screen Reader" SubItem1=Flag SubItem2=Date SubItem3=Action SubItem4=Note
|
---|
| 210 | ListItem := DisplayList.Items.Add;
|
---|
| 211 | ListItem.Caption := HIDDEN_COL; //Screen readers don't read the first column title on a listview.
|
---|
| 212 | ListItem.SubItems.Add(Piece(FPRFNoteList[i],U,NOTE_DATE_POS));
|
---|
| 213 | ListItem.SubItems.Add(Piece(FPRFNoteList[i],U,ACTION_POS));
|
---|
| 214 | ListItem.SubItems.Add(Piece(FPRFNoteList[i],U,AUTHOR_POS));
|
---|
| 215 | end;
|
---|
| 216 | end;
|
---|
| 217 |
|
---|
| 218 | procedure TfrmFlags.FormDestroy(Sender: TObject);
|
---|
| 219 | begin
|
---|
| 220 | FPRFNotes.Free;
|
---|
| 221 | end;
|
---|
| 222 |
|
---|
| 223 | procedure TfrmFlags.lvPRFClick(Sender: TObject);
|
---|
| 224 | begin
|
---|
| 225 | if lvPRF.ItemIndex > -1 then
|
---|
| 226 | begin
|
---|
| 227 | NotifyOtherApps(NAE_REPORT, 'TIU^' + FPRFNotes.getNoteIEN(lvPRF.ItemIndex));
|
---|
| 228 | ReportBox(DetailPosting(FPRFNotes.getNoteIEN(lvPRF.ItemIndex)), FNoteTitle, True);
|
---|
| 229 | end;
|
---|
| 230 | end;
|
---|
| 231 |
|
---|
| 232 | procedure TfrmFlags.lvPRFKeyDown(Sender: TObject; var Key: Word;
|
---|
| 233 | Shift: TShiftState);
|
---|
| 234 | begin
|
---|
| 235 | if (Key = VK_SPACE) or (Key = VK_RETURN) then
|
---|
| 236 | lvPRFClick(Sender);
|
---|
| 237 | end;
|
---|
| 238 |
|
---|
| 239 | end.
|
---|