[456] | 1 | unit fImmunization;
|
---|
| 2 |
|
---|
| 3 | interface
|
---|
| 4 |
|
---|
| 5 | uses
|
---|
| 6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
---|
| 7 | fPCEBase, StdCtrls, ORCtrls, CheckLst, ExtCtrls, Buttons, uPCE, rPCE, ORFn,
|
---|
| 8 | fPCELex, fPCEOther, ComCtrls, fPCEBaseMain;
|
---|
| 9 |
|
---|
| 10 | type
|
---|
| 11 | TfrmImmunizations = class(TfrmPCEBaseMain)
|
---|
| 12 | lblReaction: TLabel;
|
---|
| 13 | lblSeries: TLabel;
|
---|
| 14 | cboImmReaction: TORComboBox;
|
---|
| 15 | cboImmSeries: TORComboBox;
|
---|
| 16 | ckbContra: TCheckBox;
|
---|
| 17 | lblContra: TLabel;
|
---|
| 18 |
|
---|
| 19 | procedure cboImmSeriesChange(Sender: TObject);
|
---|
| 20 | procedure cboImmReactionChange(Sender: TObject);
|
---|
| 21 | procedure ckbContraClick(Sender: TObject);
|
---|
| 22 | procedure FormCreate(Sender: TObject);
|
---|
| 23 | private
|
---|
| 24 | protected
|
---|
| 25 | procedure UpdateNewItemStr(var x: string); override;
|
---|
| 26 | procedure UpdateControls; override;
|
---|
| 27 | public
|
---|
| 28 | // procedure ChangeProvider;
|
---|
| 29 | end;
|
---|
| 30 |
|
---|
| 31 | var
|
---|
| 32 | frmImmunizations: TfrmImmunizations;
|
---|
| 33 |
|
---|
| 34 | implementation
|
---|
| 35 |
|
---|
| 36 | {$R *.DFM}
|
---|
| 37 |
|
---|
| 38 | uses
|
---|
| 39 | fEncounterFrame;
|
---|
| 40 |
|
---|
| 41 | procedure TfrmImmunizations.cboImmSeriesChange(Sender: TObject);
|
---|
| 42 | var
|
---|
| 43 | i: integer;
|
---|
| 44 |
|
---|
| 45 | begin
|
---|
| 46 | if(NotUpdating) and (cboImmSeries.Text <> '') then
|
---|
| 47 | begin
|
---|
| 48 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 49 | if(lbGrid.Selected[i]) then
|
---|
| 50 | TPCEImm(lbGrid.Items.Objects[i]).Series := cboImmSeries.ItemID;
|
---|
| 51 | GridChanged;
|
---|
| 52 | end;
|
---|
| 53 | end;
|
---|
| 54 |
|
---|
| 55 | procedure TfrmImmunizations.cboImmReactionChange(Sender: TObject);
|
---|
| 56 | var
|
---|
| 57 | i: integer;
|
---|
| 58 |
|
---|
| 59 | begin
|
---|
| 60 | if(NotUpdating) and (cboImmReaction.Text <> '') then
|
---|
| 61 | begin
|
---|
| 62 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 63 | if(lbGrid.Selected[i]) then
|
---|
| 64 | TPCEImm(lbGrid.Items.Objects[i]).Reaction := cboImmReaction.ItemID;
|
---|
| 65 | GridChanged;
|
---|
| 66 | end;
|
---|
| 67 | end;
|
---|
| 68 |
|
---|
| 69 | procedure TfrmImmunizations.ckbContraClick(Sender: TObject);
|
---|
| 70 | var
|
---|
| 71 | i: integer;
|
---|
| 72 |
|
---|
| 73 | begin
|
---|
| 74 | if(NotUpdating) then
|
---|
| 75 | begin
|
---|
| 76 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 77 | if(lbGrid.Selected[i]) then
|
---|
| 78 | TPCEImm(lbGrid.Items.Objects[i]).Contraindicated := ckbContra.Checked;
|
---|
| 79 | GridChanged;
|
---|
| 80 | end;
|
---|
| 81 | end;
|
---|
| 82 |
|
---|
| 83 | procedure TfrmImmunizations.FormCreate(Sender: TObject);
|
---|
| 84 | begin
|
---|
| 85 | inherited;
|
---|
| 86 | FTabName := CT_ImmNm;
|
---|
| 87 | FPCEListCodesProc := ListImmunizCodes;
|
---|
| 88 | FPCEItemClass := TPCEImm;
|
---|
| 89 | FPCECode := 'IMM';
|
---|
| 90 | PCELoadORCombo(cboImmReaction);
|
---|
| 91 | PCELoadORCombo(cboImmSeries);
|
---|
| 92 | end;
|
---|
| 93 |
|
---|
| 94 | procedure TfrmImmunizations.UpdateNewItemStr(var x: string);
|
---|
| 95 | begin
|
---|
| 96 | inherited;
|
---|
| 97 | SetPiece(x, U, pnumImmSeries, NoPCEValue);
|
---|
| 98 | SetPiece(x, U, pnumImmReaction, NoPCEValue);
|
---|
| 99 | SetPiece(x, U, pnumImmRefused, '0');
|
---|
| 100 | SetPiece(x, U, pnumImmContra, '0');
|
---|
| 101 | end;
|
---|
| 102 |
|
---|
| 103 | procedure TfrmImmunizations.UpdateControls;
|
---|
| 104 | var
|
---|
| 105 | ok, Contra, First: boolean;
|
---|
| 106 | SameS, SameR, SameC: boolean;
|
---|
| 107 | i: integer;
|
---|
| 108 | Ser, React: string;
|
---|
| 109 | Obj: TPCEImm;
|
---|
| 110 |
|
---|
| 111 | begin
|
---|
| 112 | inherited;
|
---|
| 113 | if(NotUpdating) then
|
---|
| 114 | begin
|
---|
| 115 | BeginUpdate;
|
---|
| 116 | try
|
---|
| 117 | ok := (lbGrid.SelCount > 0);
|
---|
| 118 | lblSeries.Enabled := ok;
|
---|
| 119 | lblReaction.Enabled := ok;
|
---|
| 120 | cboImmSeries.Enabled := ok;
|
---|
| 121 | cboImmReaction.Enabled := ok;
|
---|
| 122 | ckbContra.Enabled := ok;
|
---|
| 123 | if(ok) then
|
---|
| 124 | begin
|
---|
| 125 | First := TRUE;
|
---|
| 126 | SameS := TRUE;
|
---|
| 127 | SameR := TRUE;
|
---|
| 128 | SameC := TRUE;
|
---|
| 129 | Contra := FALSE;
|
---|
| 130 | Ser := NoPCEValue;
|
---|
| 131 | React := NoPCEValue;
|
---|
| 132 | for i := 0 to lbGrid.Items.Count-1 do
|
---|
| 133 | begin
|
---|
| 134 | if lbGrid.Selected[i] then
|
---|
| 135 | begin
|
---|
| 136 | Obj := TPCEImm(lbGrid.Items.Objects[i]);
|
---|
| 137 | if(First) then
|
---|
| 138 | begin
|
---|
| 139 | First := FALSE;
|
---|
| 140 | Contra := Obj.Contraindicated;
|
---|
| 141 | Ser := Obj.Series;
|
---|
| 142 | React := Obj.Reaction;
|
---|
| 143 | end
|
---|
| 144 | else
|
---|
| 145 | begin
|
---|
| 146 | if(SameS) then
|
---|
| 147 | SameS := (Ser = Obj.Series);
|
---|
| 148 | if(SameR) then
|
---|
| 149 | SameR := (React = Obj.Reaction);
|
---|
| 150 | if(SameC) then
|
---|
| 151 | SameC := (Contra = Obj.Contraindicated);
|
---|
| 152 | end;
|
---|
| 153 | end;
|
---|
| 154 | end;
|
---|
| 155 | if(SameS) then
|
---|
| 156 | cboImmSeries.SelectByID(Ser)
|
---|
| 157 | else
|
---|
| 158 | cboImmSeries.Text := '';
|
---|
| 159 | if(SameR) then
|
---|
| 160 | cboImmReaction.SelectByID(React)
|
---|
| 161 | else
|
---|
| 162 | cboImmReaction.Text := '';
|
---|
| 163 | if(SameC) then
|
---|
| 164 | ckbContra.Checked := Contra
|
---|
| 165 | else
|
---|
| 166 | ckbContra.State := cbGrayed;
|
---|
| 167 | end
|
---|
| 168 | else
|
---|
| 169 | begin
|
---|
| 170 | cboImmSeries.Text := '';
|
---|
| 171 | cboImmReaction.Text := '';
|
---|
| 172 | ckbContra.Checked := FALSE;
|
---|
| 173 | end;
|
---|
| 174 | finally
|
---|
| 175 | EndUpdate;
|
---|
| 176 | end;
|
---|
| 177 | end;
|
---|
| 178 | end;
|
---|
| 179 |
|
---|
| 180 | end.
|
---|
| 181 |
|
---|