1 | unit fCsltNote;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
|
---|
6 | Buttons, ORCtrls, ORfn, ExtCtrls;
|
---|
7 |
|
---|
8 | type
|
---|
9 | TfrmCsltNote = class(TForm)
|
---|
10 | cmdOK: TButton;
|
---|
11 | cmdCancel: TButton;
|
---|
12 | cboCsltNote: TORComboBox;
|
---|
13 | lblAction: TLabel;
|
---|
14 | pnlBase: TORAutoPanel;
|
---|
15 | procedure cmdOKClick(Sender: TObject);
|
---|
16 | procedure cmdCancelClick(Sender: TObject);
|
---|
17 | private
|
---|
18 | FNoteIEN: string ;
|
---|
19 | FChanged: Boolean;
|
---|
20 | end;
|
---|
21 |
|
---|
22 | procedure SelectNoteForProcessing(FontSize: Integer; ActionType: integer; NoteList: TStrings;
|
---|
23 | var NoteIEN: integer; CPStatus: integer) ;
|
---|
24 |
|
---|
25 | implementation
|
---|
26 |
|
---|
27 | {$R *.DFM}
|
---|
28 |
|
---|
29 | uses rConsults, rCore, uCore, fConsults, uConsults;
|
---|
30 |
|
---|
31 | const
|
---|
32 | TX_NOTE_TEXT = 'Select a document or press Cancel.';
|
---|
33 | TX_NOTE_CAP = 'No Document Selected';
|
---|
34 |
|
---|
35 | procedure SelectNoteForProcessing(FontSize: Integer; ActionType: integer; NoteList: TStrings;
|
---|
36 | var NoteIEN: integer; CPStatus: integer) ;
|
---|
37 | { displays progress note selection form and returns a record of the selection }
|
---|
38 | var
|
---|
39 | frmCsltNote: TfrmCsltNote;
|
---|
40 | W, H, i: Integer;
|
---|
41 | begin
|
---|
42 | frmCsltNote := TfrmCsltNote.Create(Application);
|
---|
43 | try
|
---|
44 | with frmCsltNote do
|
---|
45 | begin
|
---|
46 | Font.Size := FontSize;
|
---|
47 | W := ClientWidth;
|
---|
48 | H := ClientHeight;
|
---|
49 | ResizeToFont(FontSize, W, H);
|
---|
50 | ClientWidth := W; pnlBase.Width := W;
|
---|
51 | ClientHeight := H; pnlBase.Height := H;
|
---|
52 | FChanged := False;
|
---|
53 | Caption := fConsults.ActionType[ActionType];
|
---|
54 | case ActionType of
|
---|
55 | CN_ACT_CP_COMPLETE:
|
---|
56 | begin
|
---|
57 | if CPStatus = CP_INSTR_INCOMPLETE then
|
---|
58 | begin
|
---|
59 | lblAction.Caption := 'Interpret Clinical Procedure Results:';
|
---|
60 | cboCsltNote.Caption := lblAction.Caption;
|
---|
61 | for i := 0 to NoteList.Count-1 do
|
---|
62 | if ((not (Copy(Piece(Piece(NoteList[i], U, 1), ';', 2), 1, 4) = 'MCAR')) and
|
---|
63 | (Piece(NoteList[i], U, 13) <> '%') and
|
---|
64 | (Piece(NoteList[i], U, 7) <> 'completed')) then
|
---|
65 | cboCsltNote.Items.Add(Piece(NoteList[i], U, 1) + U + MakeConsultNoteDisplayText(Notelist[i]));
|
---|
66 | cboCsltNote.ItemIndex := 0;
|
---|
67 | FNoteIEN := cboCsltNote.ItemID;
|
---|
68 | //ShowModal;
|
---|
69 | end
|
---|
70 | else if CPStatus in [CP_NO_INSTRUMENT, CP_INSTR_COMPLETE] then
|
---|
71 | begin
|
---|
72 | lblAction.Caption := 'Select incomplete note to continue with:';
|
---|
73 | cboCsltNote.Caption := lblAction.Caption;
|
---|
74 | for i := 0 to NoteList.Count-1 do
|
---|
75 | if ((not (Copy(Piece(Piece(NoteList[i], U, 1), ';', 2), 1, 4) = 'MCAR')) and
|
---|
76 | (Piece(NoteList[i], U, 7) <> 'completed') and
|
---|
77 | ((Piece(Piece(NoteList[i], U, 5), ';', 1) = IntToStr(User.DUZ)) or
|
---|
78 | (Piece(Piece(NoteList[i], U, 5), ';', 1) = '0'))) then
|
---|
79 | cboCsltNote.Items.Add(Piece(NoteList[i], U, 1) + U + MakeConsultNoteDisplayText(Notelist[i]));
|
---|
80 | if cboCsltNote.Items.Count > 0 then cboCsltNote.Items.Insert(0, CN_NEW_CP_NOTE + '^<Create new note>');
|
---|
81 | if cboCsltNote.Items.Count > 0 then
|
---|
82 | ShowModal
|
---|
83 | else
|
---|
84 | FNoteIEN := CN_NEW_CP_NOTE;
|
---|
85 | end;
|
---|
86 | end;
|
---|
87 | CN_ACT_COMPLETE:
|
---|
88 | begin
|
---|
89 | lblAction.Caption := 'Select incomplete note to continue with:';
|
---|
90 | cboCsltNote.Caption := lblAction.Caption;
|
---|
91 | for i := 0 to NoteList.Count-1 do
|
---|
92 | if ((not (Copy(Piece(Piece(NoteList[i], U, 1), ';', 2), 1, 4) = 'MCAR')) and
|
---|
93 | (Piece(NoteList[i], U, 7) <> 'completed') and
|
---|
94 | (Piece(Piece(NoteList[i], U, 5), ';', 1) = IntToStr(User.DUZ))) then
|
---|
95 | cboCsltNote.Items.Add(Piece(NoteList[i], U, 1) + U + MakeConsultNoteDisplayText(Notelist[i]));
|
---|
96 | if cboCsltNote.Items.Count > 0 then cboCsltNote.Items.Insert(0, CN_NEW_CSLT_NOTE + '^<Create new note>');
|
---|
97 | if cboCsltNote.Items.Count > 0 then
|
---|
98 | ShowModal
|
---|
99 | else
|
---|
100 | FNoteIEN := CN_NEW_CSLT_NOTE;
|
---|
101 | end;
|
---|
102 | (* CN_ACT_ADDENDUM: // no longer called in v15
|
---|
103 | begin
|
---|
104 | lblAction.Caption := 'Select completed note to addend to:';
|
---|
105 | for i := 0 to NoteList.Count-1 do
|
---|
106 | begin
|
---|
107 | if Copy(Piece(NoteList[i], U, 2), 1, 8) = 'Addendum' then continue;
|
---|
108 | if Piece(NoteList[i], U, 13) = '%' then continue;
|
---|
109 | cboCsltNote.Items.Add(Piece(NoteList[i], U, 1) + U + MakeConsultNoteDisplayText(Notelist[i]));
|
---|
110 | end;
|
---|
111 | if cboCsltNote.Items.Count > 0 then
|
---|
112 | ShowModal
|
---|
113 | else
|
---|
114 | FNoteIEN := '-30';
|
---|
115 | end;*)
|
---|
116 | end; {case}
|
---|
117 |
|
---|
118 | NoteIEN:= StrToIntDef(FNoteIEN, -1) ;
|
---|
119 | end; {with frmCsltNote}
|
---|
120 | finally
|
---|
121 | frmCsltNote.Release;
|
---|
122 | end;
|
---|
123 | end;
|
---|
124 |
|
---|
125 | procedure TfrmCsltNote.cmdCancelClick(Sender: TObject);
|
---|
126 | begin
|
---|
127 | FNoteIEN := '-1';
|
---|
128 | Close;
|
---|
129 | end;
|
---|
130 |
|
---|
131 | procedure TfrmCsltNote.cmdOKClick(Sender: TObject);
|
---|
132 | begin
|
---|
133 | with cboCsltNote do
|
---|
134 | begin
|
---|
135 | if ItemIEN = 0 then
|
---|
136 | begin
|
---|
137 | InfoBox(TX_NOTE_TEXT, TX_NOTE_CAP, MB_OK or MB_ICONWARNING);
|
---|
138 | FChanged := False ;
|
---|
139 | FNoteIEN := '-1';
|
---|
140 | Exit;
|
---|
141 | end;
|
---|
142 | FChanged := True;
|
---|
143 | FNoteIEN := Piece(Items[ItemIndex],U,1);
|
---|
144 | Close;
|
---|
145 | end ;
|
---|
146 | end;
|
---|
147 |
|
---|
148 | end.
|
---|