-
Notifications
You must be signed in to change notification settings - Fork 1
/
MDN110UP_수정.pas
1531 lines (1147 loc) · 37.9 KB
/
MDN110UP_수정.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{===============================================================================
Program ID : MDN110UP
Program Name : 중환자실 Monitoring항목 처방 Mapping 관리
Program Desc. :
Author : Lee, Se-Ha
Date : 2011. 02. 23
===============================================================================}
unit MDN110UP;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Buttons, ComCtrls, Grids, UltraGrid, Variants;
type
TMDN110FP = class(TForm)
stb_Message: TStatusBar;
pn_Monitor: TPanel;
pc_Monitor: TPageControl;
TabSheet1: TTabSheet;
Bevel2: TBevel;
TabSheet2: TTabSheet;
Bevel3: TBevel;
Panel2: TPanel;
rbt_Moni: TRadioButton;
ugd_Monitoring: TUltraGrid;
Panel1: TPanel;
bbt_Add: TBitBtn;
bbt_Close: TBitBtn;
ugd_Monitor: TUltraGrid;
Panel3: TPanel;
cbx_All: TCheckBox;
sbt_MonitorCopyAll: TSpeedButton;
sbt_MonitorCopy: TSpeedButton;
ed_Input: TEdit;
bbt_FirstDate: TBitBtn;
bbt_PrevDate: TBitBtn;
ed_PreOrdDate: TEdit;
bbt_NextDate: TBitBtn;
bbt_LastDate: TBitBtn;
ugd_DayList: TUltraGrid;
Panel5: TPanel;
dtp_RgtDate: TDateTimePicker;
Panel31: TPanel;
pn_PatNo: TPanel;
pn_SexAge: TPanel;
pn_PatName: TPanel;
Bevel4: TBevel;
bbt_Delete: TBitBtn;
Bevel1: TBevel;
Label1: TLabel;
Bevel5: TBevel;
Label2: TLabel;
lb_SetTypeName: TLabel;
rbt_Hemo: TRadioButton;
rbt_Set2: TRadioButton;
rbt_Set3: TRadioButton;
// Event Handler -----------------------------------------------------------
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure bbt_CloseClick(Sender: TObject);
procedure ugd_MonitorDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
procedure pc_MonitorChange(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure rbt_MoniClick(Sender: TObject);
procedure ugd_MonitorMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure cbx_AllClick(Sender: TObject);
procedure ugd_MonitorMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure rbt_MedClick(Sender: TObject);
procedure rbt_IOClick(Sender: TObject);
procedure sbt_MonitorCopyClick(Sender: TObject);
procedure sbt_MonitorCopyAllClick(Sender: TObject);
procedure ugd_MonitoringKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ugd_MonitoringDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
procedure ed_InputEnter(Sender: TObject);
procedure ed_InputExit(Sender: TObject);
procedure ed_InputKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ed_InputKeyPress(Sender: TObject; var Key: Char);
procedure ugd_MonitorDblClick(Sender: TObject);
procedure bbt_AddClick(Sender: TObject);
procedure bbt_FirstDateClick(Sender: TObject);
procedure bbt_DeleteClick(Sender: TObject);
procedure dtp_RgtDateChange(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormCreate(Sender: TObject);
//--------------------------------------------------------------------------
private
{ Private declarations }
procedure SelectCell(Sender:TObject; iCol,iRow:Integer; IsSelect:Boolean);
function GetFindProgress(sType1:String; inum : Integer):Boolean;
// 작성된 전일내역 조회
procedure GetDayList;
// 특정일자 Interface 적용 내역 조회
Procedure GetMonitorDayInfo(sTemp:String);
// 작성 내역 조회...
procedure GetMonitorDayList;
public
{ Public declarations }
dtp_RgtDate_Date : TDateTimePicker;
g_Mode : String;
X_PatNo, X_PatName, X_AdmDate, X_SexAge, X_Settype : String;
published
{ Public declarations }
property prop_Mode : String write g_Mode; // 입력모드
property prop_PatNo : String write X_PatNo;
property prop_PatName : String write X_PatName;
property prop_AdmDate : String write X_AdmDate;
property prop_SexAge : String write X_SexAge;
property prop_Settype : String write X_Settype;
end;
var
MDN110FP: TMDN110FP;
implementation
uses
CComFunc, VarCom, TuxCom, MsgCom, MDCLASS1, MComFunc, HisUtil;
{$R *.DFM}
//------------------------------------------------------------------------------
// Form onClose Event Handler
//
// Author :
// Date :
//------------------------------------------------------------------------------
procedure TMDN110FP.FormClose(Sender: TObject; var Action: TCloseAction);
type
TProcedureType = Procedure of Object;
var
Procedure1 : TProcedureType;
PProcedure1 : PMethod;
begin
// OK
PProcedure1 := @TMethod(Procedure1);
if FindFormMethod('MDN110FM', 'GetMonitorDayInfo', PProcedure1) = True then Procedure1;
PProcedure1 := @TMethod(Procedure1);
if FindFormMethod('MDN110FM', 'GetMonitoring', PProcedure1) = True then Procedure1;
Action := Cafree;
end;
procedure TMDN110FP.FormDestroy(Sender: TObject);
begin
// OK
MDN110FP := Nil;
end;
procedure TMDN110FP.bbt_CloseClick(Sender: TObject);
begin
// OK
Close;
end;
procedure TMDN110FP.ugd_MonitorDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
// OK
ReSizeGridCol((Sender as TUltragrid), 1);
ReSizeGridRow(Sender as TUltraGrid,1,ARow);
end;
procedure TMDN110FP.pc_MonitorChange(Sender: TObject);
var
i : Integer;
begin
// OK
// 선택 해제..
for i := 0 to ugd_Monitor.Rowcount - 1 do
begin
SelectCell(ugd_Monitor,25,i,False); //선택표시설정
end;
Clear_Grid(ugd_Monitor, ugd_Monitor.ColCount);
if pc_Monitor.ActivePageIndex = 1 then
begin
rbt_Moni.Checked := True;
rbt_MoniClick(Nil);
end
else
begin
if ed_PreOrdDate.Text <> '' then
begin
GetMonitorDayInfo(ed_PreOrdDate.Text);
end;
end;
end;
//------------------------------------------------------------------------------
// Form onShow Event Handler
//
// Author :
// Date :
//------------------------------------------------------------------------------
procedure TMDN110FP.FormShow(Sender: TObject);
begin
// OK
Clear_Grid(ugd_Monitor, ugd_Monitor.ColCount);
Clear_Grid(ugd_Monitoring, ugd_Monitoring.ColCount);
//
showmessage(X_PatNo + ' ' + X_PatName + ' ' + X_SexAge);
pc_Monitor.ActivePageIndex := 0;
dtp_RgtDate_Date := (GetComp('MDN110FM', 'dtp_RgtDate') as TDateTimePicker);
dtp_RgtDate.Date := dtp_RgtDate_Date.Date;
//showmessage('1');
// Set 구분
if X_SetType = 'ICUIF' then
lb_SetTypeName.Caption := 'Interface'
else if X_SetType = 'MON' then
lb_SetTypeName.Caption := '모니터링';
// showmessage('2');
if g_Mode = 'I' then
begin
bbt_Delete.Enabled := False;
showmessage('I');
end
else if g_Mode = 'U' then
begin
bbt_Delete.Enabled := True;
showmessage('U');
GetMonitorDayList;
end;
// showmessage('3');
// 전일 내역 조회
//GetDayList;
end;
procedure TMDN110FP.GetDayList;
var
i, RowNo : Integer;
begin
// OK
Clear_Grid(ugd_DayList, ugd_DayList.ColCount);
Clear_Grid(ugd_Monitor, ugd_Monitor.ColCount);
//----------------------------------------------------------------
// 환자별 적용일자 리스트 조회
//----------------------------------------------------------------
Screen.Cursor := crHourglass;
try
mdIcrect := HmdIcrect.Create;
// RowNo := mdIcrect.GetMonitorDayList('1', P_PatNo, P_AdmDate, '', P_Settype);
// SYSTEM ERROR
if RowNo = -1 then
begin
mdIcrect.Free;
ShowErrMsg(stb_Message);
Exit;
end;
// 조회건수 없음
if RowNo = 0 then
begin
mdIcrect.Free;
ed_PreOrdDate.Text := '';
Exit;
end;
ugd_DayList.RowCount := RowNo;
for i := 0 to RowNo - 1 do
begin
with mdIcrect, ugd_DayList do
begin
Cells[0, i] := sActdate[i];
end;
end;
mdIcrect.Free;
if g_Mode = 'I' then
begin
ed_PreOrdDate.Text := CopyByte(ugd_DayList.Cells[0,0],1,4)+'-' +
CopyByte(ugd_DayList.Cells[0,0],5,2)+'-' +
CopyByte(ugd_DayList.Cells[0,0],7,2);
end
else if g_Mode = 'U' then
begin
ed_PreOrdDate.Text := FormatDateTime('yyyy-mm-dd', dtp_RgtDate_Date.date);
end;
// 특정일자 Interface 적용 내역 조회
GetMonitorDayInfo(ed_PreOrdDate.Text);
finally
Screen.Cursor := crDefault;
end;
end;
procedure TMDN110FP.rbt_MoniClick(Sender: TObject);
var
sType1, sType2, sType3, sType4, sType5 : String;
i, RowNo : Integer;
begin
// OK
Clear_Grid(ugd_Monitor, ugd_Monitor.ColCount);
sType1 := '3';
sType2 := '';
sType3 := '';
sType4 := '';
Screen.Cursor := crHourglass;
try
mdIcrect := HmdIcrect.Create;
RowNo := mdIcrect.GetMonitorDayList(sType1, sType2, sType3, sType4, X_Settype);
// SYSTEM ERROR
if RowNo = -1 then
begin
mdIcrect.Free;
ShowErrMsg(stb_Message);
Exit;
end;
// 조회건수 없음
if RowNo = 0 then
begin
mdIcrect.Free;
stb_Message.Panels[0].Text := '조회된 자료가 없습니다.';
//MakeMsg(CF_D420, NF010, NF020, StatusBar1);
Exit;
end;
ugd_Monitor.RowCount := 1;
with mdIcrect, ugd_Monitor do
begin
for i := 0 to RowNo - 1 do
begin
if sUpCode[i] = '' then
begin
Cells[0, RowCount-1] := sSetTitle[i];
Cells[1, RowCount-1] := sSetCode[i];
Cells[2, RowCount-1] := sUpCode[i];
end
else
begin
if CopyByte(sUpCode[i],2,2) = '00' then
Cells[0, RowCount-1] := ' ' + sSetTitle[i]
else
Cells[0, RowCount-1] := ' ' + sSetTitle[i];
Cells[1, RowCount-1] := sSetCode[i];
Cells[2, RowCount-1] := sUpCode[i];
end;
RowCount := RowCount + 1;
end;
end;
ugd_Monitor.RowCount := ugd_Monitor.RowCount - 1;
mdIcrect.Free;
finally
Screen.Cursor := crDefault;
end;
end;
procedure TMDN110FP.ugd_MonitorMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
iCnt, i, j, SelCol, SelRow, BeginRow, EndRow: Integer;
begin
// OK
if ((ssShift in Shift) and (ssDouble in Shift)) or
((ssCtrl in Shift) and (ssDouble in Shift)) or
(ugd_Monitor.Cells[0,0] = '') then Exit;
with ugd_Monitor do
begin
//Mouse위치
ugd_Monitor.MouseToCell(X, Y, SelCol, SelRow);
//(1) [Shift]+Click : 선택범위에 대해 선택표시 설정/해제
if (ssShift in Shift) and (Button = mbLeft) then
begin
//선택범위 Position 설정
BeginRow := 0;
for i := 0 to RowCount - 1 do
begin
if Cells[30,i] = 'Y' then
begin
BeginRow := i;
Break;
end;
end;
if SelRow < 0 then
begin
EndRow := Rowcount - 1;
end
else
begin
if SelRow > BeginRow then
begin
EndRow := SelRow;
end
else
begin
EndRow := BeginRow;
BeginRow := SelRow;
end;
end;
//해당범위 선택표시설정
for i := 0 to Rowcount - 1 do
begin
if (BeginRow <= i) and (i <= EndRow) then
SelectCell(ugd_Monitor,25,i,True ) //선택표시설정
else
SelectCell(ugd_Monitor,25,i,False); //선택표시해제
end;
end
//(2) [Ctrl]+Click : Click한 Row 선택표시 Toggle
else if (ssCtrl in Shift) and (Button = mbLeft) then
begin
//선택표시 설정/해제 Toggle
if (Cells[25,SelRow] = '') then
SelectCell(ugd_Monitor,25,SelRow,True ) //선택표시
else
SelectCell(ugd_Monitor,25,SelRow,False); //선택표시해제
end
//(3) Mouse [Left] Button Click : Click한 Row만 선택표시
else if (Button = mbLeft) then
begin
//Click한 Row만 선택표시, 블럭지정 시작Row로 설정
cbx_All.Checked := False;
for i := 0 to RowCount - 1 do
begin
SelectCell(ugd_Monitor,25,i,False);
Cells[30,i] := '';
end;
SelectCell(ugd_Monitor,25,SelRow,True);
Cells[30,SelRow] := 'Y'; //선택시작Row 표시
ugd_Monitor.Tag := SelRow; //선택시작Row지정(Mouse Drag시 블럭설정하기 위해)
end
//(4) Mouse [Right] Button Click - //Click한 위치로 Position이동후 Popup Menu View
else if (Button = mbRight) then
begin
//선택Row가 여러건인 경우, Exit
iCnt := 0;
for i := 0 to RowCount - 1 do
begin
if (Cells[25,i] = 'Y') then Inc(iCnt);
if (iCnt > 1) then Exit;
end;
//선택Row 1건인 경우, Click 위치로 Position 이동
for i := 0 to RowCount - 1 do
begin
SelectCell(ugd_Monitor,25,i,False);
Cells[30,i] := '';
end;
SelectCell(ugd_Monitor,25,SelRow,True);
Cells[30,SelRow] := 'Y';
Row := SelRow;
end;
ugd_Monitor.Repaint;
end;
end;
//Grid 선택표시 설정/해제
procedure TMDN110FP.SelectCell(Sender:TObject; iCol,iRow:Integer; IsSelect:Boolean);
var
i : Integer;
clGridColor,clGridFontColor : TColor;
begin
// OK
with (Sender as TUltraGrid) do
begin
//선택표시,해제
if (IsSelect) then
begin
Cells[iCol,iRow] := 'Y'; //선택표시설정
clGridColor := $00FEE7CF; //Selected Row Color 지정
clGridFontColor := SelectedRowFontColor;//Selected Row Font Color 지정
end
else
begin
Cells[iCol,iRow] := ''; //선택표시해제
if (iRow mod 2) = 0 then //Grid Base Color 지정
clGridColor := Color
else clGridColor := GridRowColor;
clGridFontColor := Font.Color; //Grid Base Font Color 지정
end;
//Row Color 칠하기
for i := 0 to 15 do
SetColor(i,iRow,clGridColor);
end;
end;
procedure TMDN110FP.cbx_AllClick(Sender: TObject);
var
iRow : integer;
begin
// OK
//전체Row 선택 표시
if (cbx_All.Checked) then
begin
for iRow := 0 to ugd_Monitor.RowCount-1 do
begin
SelectCell(ugd_Monitor, 25, iRow, True ); //Row 선택표시
ugd_Monitor.Cells[30,iRow] := '';
end;
end
//전체Row 선택 해제
else
begin
for iRow := 0 to ugd_Monitor.RowCount-1 do
begin
SelectCell(ugd_Monitor, 25, iRow, False); //Row 선택표시해제
ugd_Monitor.Cells[30,iRow] := '';
end;
end;
ugd_Monitor.Repaint;
end;
procedure TMDN110FP.ugd_MonitorMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
SelCol,SelRow : Integer;
i, iCnt : Integer;
FForm : TForm;
begin
// OK
if Button <> mbLeft then Exit;
//<결과및진행> Cell 선택시 ==> 처방결과조회/처방수행내역 Form Call
ugd_Monitor.MouseToCell(X,Y,SelCol,SelRow);
//선택범위에 대해 선택표시 설정 : <MouseDown시 Row> 부터 <현재Row> 까지
if (Not ((ssShift in Shift) or (ssCtrl in Shift) or (ssDouble in Shift))) and
(ugd_Monitor.Tag <> SelRow) then
ugd_MonitorMouseDown(Sender, Button, [ssShift], X, Y);
end;
procedure TMDN110FP.rbt_MedClick(Sender: TObject);
begin
// OK
Clear_Grid(ugd_Monitor, ugd_Monitor.ColCount);
end;
procedure TMDN110FP.rbt_IOClick(Sender: TObject);
begin
// OK
Clear_Grid(ugd_Monitor, ugd_Monitor.ColCount);
end;
procedure TMDN110FP.sbt_MonitorCopyClick(Sender: TObject);
var
i, j, k, iCnt, MCnt : Integer;
begin
// OK
// ugd_Monitor.Col 0: Title, 1: SetCode, 2: UpCode, 25: 선택여부
// 상위 코드 값이 있을 경우 데이타 처리 하기
for i := 0 to ugd_Monitor.RowCount-1 do
begin
if (ugd_Monitor.Cells[25,i] = 'Y') and (ugd_Monitor.Cells[2, i] <> '') then
begin
for j := 0 to ugd_Monitor.RowCount-1 do
begin
if ugd_Monitor.Cells[2,i] = ugd_Monitor.Cells[1,j] then
SelectCell(ugd_Monitor,25,j,True ); //선택표시설정
if (ugd_Monitor.Cells[25,j] = 'Y') and (ugd_Monitor.Cells[2, j] <> '') then
begin
for k := 0 to ugd_Monitor.RowCount-1 do
begin
if ugd_Monitor.Cells[2,j] = ugd_Monitor.Cells[1,k] then
SelectCell(ugd_Monitor,25,k,True ); //선택표시설정
end;
end;
end;
end;
end;
ugd_Monitor.Repaint;
if trim(ugd_Monitoring.Cells[0,0]) = '' then MCnt := 0
else MCnt := ugd_Monitoring.RowCount;
// 중복 데이타 빼고 데이타 뿌려주기..
for i := 0 to ugd_Monitor.RowCount-1 do
begin
if (ugd_Monitor.Cells[25,i] = 'Y') then
begin
//if GetFindProgress(ugd_Monitor.Cells[1,i], MCnt) then
if GetFindProgress(ugd_Monitor.Cells[1,i], ugd_Monitoring.RowCount-1) then
begin
ugd_Monitoring.Cells[0, MCnt] := ugd_Monitor.Cells[0, i];
ugd_Monitoring.Cells[1, MCnt] := ugd_Monitor.Cells[1, i];
ugd_Monitoring.Cells[2, MCnt] := ugd_Monitor.Cells[2, i];
ugd_Monitoring.Cells[3, MCnt] := 'N'; //New Insert 대상
MCnt := Mcnt + 1;
end;
end;
end;
ugd_Monitoring.RowCount := MCnt;
// 항목에 대한 변경 값이 있을 경우 삭제 못하게..
bbt_Delete.Enabled := False;
//Dispseq 순으로 Sorting..
//QuickSortGrid(대상Grid,시작Row,종료Row,소팅Col,Ascendig/Decending);
QuickSortGrid(ugd_Monitoring,0,ugd_Monitoring.RowCount-1,4,False);
ugd_Monitoring.Repaint;
end;
function TMDN110FP.GetFindProgress(sType1:String; iNum :integer):Boolean;
var
i : integer;
begin
// OK
GetFindProgress := False;
for i := 0 to iNum do
begin
if sType1 = ugd_Monitoring.Cells[1, i] then
begin
GetFindProgress := False;
Break;
end
else
begin
GetFindProgress := True;
end;
end;
end;
procedure TMDN110FP.sbt_MonitorCopyAllClick(Sender: TObject);
begin
// OK
cbx_All.Checked := True;
cbx_AllClick(Nil);
sbt_MonitorCopyClick(Sender);
end;
procedure TMDN110FP.ugd_MonitoringKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
// OK
{ // 일단 임시로 추가하는 항목은 막음. 2006.11.10 김용서비...
if key = VK_RETURN then
begin
with ugd_Monitoring do
begin
if Cells[0,0] <> '' then InsertRow(RowCount);
ed_Input.Top := Top + CellRect(0,RowCount).Top - DefaultRowHeight;
ed_Input.Left := CellRect(0,RowCount).Left + 1;
ed_Input.Clear;
ed_Input.Visible := True;
ed_Input.SetFocus;
end;
end;
}
end;
procedure TMDN110FP.ugd_MonitoringDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
// OK
ReSizeGridCol((Sender as TUltragrid), 1);
ReSizeGridRow(Sender as TUltraGrid,1,ARow);
end;
procedure TMDN110FP.ed_InputEnter(Sender: TObject);
begin
// OK
ed_Input.Tag := 0; //Tag 초기화
if (ugd_Monitoring.Cells[0,ugd_Monitoring.Row] <> '') then
ed_InputExit(Nil);
end;
procedure TMDN110FP.ed_InputExit(Sender: TObject);
begin
// OK
if ed_Input.Tag = 0 then
begin
ed_Input.Tag := 1;
ed_Input.Visible := False;
if (ugd_Monitoring.RowCount > 1 ) and
(ugd_Monitoring.Cells[0,ugd_Monitoring.Row] = '') then
begin
ugd_Monitoring.DeleteRow(ugd_Monitoring.Row);
end;
ugd_Monitoring.SetFocus;
end;
end;
procedure TMDN110FP.ed_InputKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
// OK
if Key = VK_ESCAPE then ed_InputExit(Nil);
end;
procedure TMDN110FP.ed_InputKeyPress(Sender: TObject; var Key: Char);
var
i, iCnt : integer;
ValCheck : Boolean;
sTemp : String;
begin
// OK
//[Enter] Key 아닌경우, Exit
if Key <> #13 then Exit;
if key = #13 then
begin
ValCheck := False;
if ed_Input.Text = '' then ed_InputExit(Nil);
iCnt := 0;
for i := 0 to ugd_Monitoring.RowCount - 1 do
begin
// 기타 항목 타이틀 처리 여부
if ugd_Monitoring.Cells[1, i] = 'T9999' then ValCheck := True;
// upcode에 기타 항목이 있을 경우 맥스값으로 처리
if ugd_Monitoring.Cells[3, i] = 'T9999' then
begin
sTemp := ugd_Monitoring.Cells[0, i];
end;
end;
if ValCheck = False then
begin
ugd_Monitoring.Cells[0, ugd_Monitoring.Row] := '기 타'; // Title
ugd_Monitoring.Cells[1, ugd_Monitoring.Row] := 'T9999'; // sProgcd
ugd_Monitoring.Cells[2, ugd_Monitoring.Row] := ''; // sUpcode
ugd_Monitoring.RowCount := ugd_Monitoring.RowCount + 1;
ugd_Monitoring.Cells[0, ugd_Monitoring.Row+1] := ' ' + ed_Input.Text; // Title
ugd_Monitoring.Cells[1, ugd_Monitoring.Row+1] := 'PT101'; // sProgcd
ugd_Monitoring.Cells[2, ugd_Monitoring.Row+1] := 'T9999'; // sUpcode
end
else
begin
// temp 밑에 추가
ugd_Monitoring.Cells[0, ugd_Monitoring.Row] := ' ' + ed_Input.Text; // Title
ugd_Monitoring.Cells[1, ugd_Monitoring.Row] := 'PT' + Inttostr(Strtoint(CopyByte(ugd_Monitoring.Cells[1, ugd_Monitoring.Row-1],3,3)) + 1); // sProgcd
ugd_Monitoring.Cells[2, ugd_Monitoring.Row] := 'T9999'; // sUpcode
end;
ed_InputExit(Nil);
end;
end;
procedure TMDN110FP.ugd_MonitorDblClick(Sender: TObject);
begin
// OK
sbt_MonitorCopyClick(Nil);
end;
procedure TMDN110FP.bbt_FirstDateClick(Sender: TObject);
var
i : integer;
begin
//OK
// 선택 해제..
for i := 0 to ugd_Monitor.Rowcount - 1 do
begin
SelectCell(ugd_Monitor,25,i,False); //선택표시설정
end;
if ugd_DayList.Cells[0,0] <> '' then
begin
//[Previous] Button Click시
if (Sender = bbt_PrevDate) and (ugd_DayList.Row < ugd_DayList.RowCount-1) then
ugd_DayList.Row := ugd_DayList.Row + 1
//[Next] Button Click시
else if (Sender = bbt_NextDate) and
(ugd_DayList.Row > 0) then
ugd_DayList.Row := ugd_DayList.Row - 1
//[First] Button Click시
else if (Sender = bbt_FirstDate) and
(ugd_DayList.Row <> ugd_DayList.RowCount-1) then
ugd_DayList.Row := ugd_DayList.RowCount-1
//[Last] Button Click시
else if (Sender = bbt_LastDate) and
(ugd_DayList.Row <> 0) then
ugd_DayList.Row := 0
else Exit;
//해당 처방일에 대한 처방상세 List 조회
ed_PreOrdDate.Text := CopyByte(ugd_DayList.Cells[0,ugd_DayList.Row],1,4)+'-' +
CopyByte(ugd_DayList.Cells[0,ugd_DayList.Row],5,2)+'-' +
CopyByte(ugd_DayList.Cells[0,ugd_DayList.Row],7,2);
GetMonitorDayInfo(ed_PreOrdDate.Text);
ugd_Monitor.SetFocus;
end;
end;
//------------------------------------------------------------------------------
// 특정일자 Interface 적용 내역 조회
//
// Author :
// Date :
//------------------------------------------------------------------------------
procedure TMDN110FP.GetMonitorDayInfo(sTemp:String);
var
sType1, sType2, sType3, sType4 : String;
i, RowNo, k : Integer;
tmp_Title : String;
begin
// OK
Clear_Grid(ugd_Monitor, ugd_Monitor.ColCount);
//----------------------------------------------------------------
// Interface 적용 내역 조회
//----------------------------------------------------------------
Screen.Cursor := crHourglass;
try
mdIcrect := HmdIcrect.Create;
//------------------------------------------------
// 1. Set Parameter Value
//------------------------------------------------
sType1 := '2'; // 조회구분('2')
// sType2 := P_Patno; // 환자번호
// sType3 := P_AdmDate; // 입원일자(YYYYMMDD)
sType4 := DelChar(ed_PreOrdDate.text,'-'); // 적용일자
//------------------------------------------------
// 2. Load Data
//------------------------------------------------
// RowNo := mdIcrect.GetMonitorDayList(sType1, sType2, sType3, sType4, P_Settype);
// SYSTEM ERROR
if RowNo = -1 then
begin
mdIcrect.Free;
ShowErrMsg(stb_Message);
Exit;
end;
// 조회건수 없음
if RowNo = 0 then
begin
mdIcrect.Free;
stb_Message.Panels[0].Text := '조회된 자료가 없습니다.';
Exit;
end;
ugd_Monitor.RowCount := 1;
k:=0;
tmp_Title := '';
for i := 0 to RowNo - 1 do
begin
with mdIcrect, ugd_Monitor do
begin
if tmp_Title = sUpTitle[i] then