source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPTR2.m@ 1297

Last change on this file since 1297 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.6 KB
RevLine 
[613]1DGPTR2 ;ALB/JDS/MJK/MTC/ADL - ALB/BOK PTF TRANSMISSION ; 6/6/05 11:48am
2 ;;5.3;Registration;**183,338,423,510,636,729**;Aug 13, 1993;Build 59
3 ;;ADL;Update for CSV Project;;Mar 27,2003
4501 ; -- setup 501 transactions
5 ; DG*636
6 N DGPTMVDT
7 K DGCMVT I T2'=9999999 S DGCMVT=$O(^DGPT(J,"M","AM",+$P(T2,".")_".2359")),DGCMVT=$S('DGCMVT:1,$O(^(DGCMVT,0)):$O(^(0)),1:1)
8 F I=0:0 S I=$O(^DGPT(J,"M",I)) G 535:I'>0 I $D(^(I,0)) D
9 . S DGM=^(0),DGSC=$P(DGM,U,18),DGAO=$P(DGM,U,26),DGIR=$P(DGM,U,27),DGEC=$P(DGM,U,28),DGMST=$P(DGM,U,29),DGHNC=$P(DGM,U,30),DGTD=$P(DGM,U,10),DGPTMVDT=$P(DGM,U,10)
10 . S:$D(DGCMVT) DGTD=$S(I=DGCMVT:$P(T2,".")_".2359",1:DGTD)
11 . I $P(DGM,U,17)'="n",DGTD,DGTD'<T1,DGTD'>T2 D MOV
12MOV S DGCDR=$P(DGM,U,16),DGM=$P(DGM,U,1,9)_U_$P(DGM,U,11,15),L=1 F Z=5:1:14 S:'$P(DGM,U,Z) DGM=$P(DGM,U,1,Z-1)_U_$P(DGM,U,Z+1,99) S:'$P(DGM,U,Z) Z=Z-1 S L=L+1 Q:L=10
13 S Y=$S(T1:"C",1:"N")_"501"_DGHEAD,X=$P(DGTD,".")_" ",Y=Y_$E(X,4,5)_$E(X,6,7)_$E(X,2,3)_$E($P(DGTD,".",2)_"0000",1,4)
14 S Z=DGCDR D CDR
15 ;replace specialty pointer (ien) with ptf code (alpha-numeric)
16 N DGARRX,DGARRY ;DG729
17 S DGARRX=$$TSDATA^DGACT(42.4,$P(DGM,U,2),.DGARRY)
18 S $P(DGM,U,2)=$G(DGARRY(7))
19 S L=2,X=DGM,Z=2 D ENTER0
20 ; convert pass, leave days >999 to 999
21 S L=3 F Z=3,4 S:$P(X,U,Z)>999 $P(X,U,Z)=999 D ENTER0
22 S L=1,X=DG57,Z=4 D ENTER S:I=1 DG502=Y
23 F Z=5:1:9 S DGPTTMP=$$ICDDX^ICDCODE($P(DGM,U,Z),$G(DGPTMVDT)) D
24 . S F=$S(+DGPTTMP>0&($P(DGPTTMP,U,10)):$P(DGPTTMP,U,2),1:" ."),F=$P(F,".",1)_$E($P(F,".",2)_" ",1,3),F=F_$E(" ",1,7-$L(F)),Y=Y_F
25 S Y=Y_" "
26 S X=""
27 I 'T1 S Z=$S(I=1:+$O(^DGPT(J,535,"ADC",0)),1:+$O(^DGPT(J,535,"AM",DGTD-.0000001))) I $D(^DGPT(J,535,+$O(^(Z,0)),0)) S X=^(0)
28 I T1 S Z=+$O(^DGPT(J,535,"AM",DGTD-.0000001)) S:'Z Z=+$O(^DGPT(J,535,"ADC",0)) I $D(^DGPT(J,535,+$O(^(Z,0)),0)) S X=^(0)
29 S Z=$P(X,U,16) D CDR
30 ;replace specialty pointer (ien) with ptf code (alpha-numeric)
31 N DGARRX,DGARRY ;DG729
32 S DGARRX=$$TSDATA^DGACT(42.4,$P(X,U,2),.DGARRY)
33 S $P(X,U,2)=$G(DGARRY(7))
34 S L=2,Z=2 D ENTER0
35 ; bed occupant
36 I T1 S Y=Y_$S(I=1:$E($P(DG70,U,14)_" "),$P(+DGTD,".")=$P(T2,"."):5,1:1)
37 I 'T1 S Y=Y_$S(I=1:$E($P(DG70,U,14)_" "),1:" ")
38 ;-- additional ptf questions
39 S DGAUX=$S($D(^DGPT(J,"M",I,300)):^(300),1:"")
40 D ADDQUES
41 ;-- sc related care
42 S Y=Y_$E(DGSC_" ")
43 ;-- ao related care
44 S Y=Y_$E(DGAO_" ")
45 ;-- ir related care
46 S Y=Y_$E(DGIR_" ")
47 ;-- ec related care
48 S Y=Y_$E(DGEC_" ")
49 ;-- mst related care
50 S Y=Y_$E(DGMST_" ")
51 ;-- Head/Neck CA related care
52 S Y=Y_$E(DGHNC_" ")
53 K DGAUX,DGDRUG,DGSC,DGAO,DGIR,DGEC,DGMST,DGHNC
54 D FILL^DGPTR2,SAVE
55 Q
56535 ; -- do 535's
57 D 535^DGPTR3
58 ;
59PROC ; -- setup 601 transactions
60 K ^UTILITY($J,"PROC") S I=0
61601 S I=$O(^DGPT(J,"P",I)) G 701:I'>0 S (X,DGPROC)=^(I,0) G 601:'DGPROC
62 G 601:DGPROC<T1!(DGPROC>T2) S DGPROCD=+^DGPT(J,"P",I,0),^UTILITY($J,"PROC",DGPROCD)=$S($D(^UTILITY($J,"PROC",DGPROCD)):^(DGPROCD),1:0)+1
63 I ^UTILITY($J,"PROC",DGPROCD)>1 W !,"More than one procedure record on same date/time" S DGERR=1 Q
64 S Y=$S('T1:"N",1:"C")_"60"_^(DGPROCD)_DGHEAD_$E(DGPROCD,4,7)_$E(DGPROCD,2,3)_$E($P(+X,".",2)_"0000",1,4)
65 ;replace specialty pointer (ien) with ptf code (alpha-numeric)
66 N DGARRX,DGARRY ;DG729
67 S DGARRX=$$TSDATA^DGACT(42.4,$P(X,U,2),.DGARRY)
68 S $P(X,U,2)=$G(DGARRY(7))
69 S L=2,Z=2 D ENTER0
70 S L=1,Z=3 S $P(X,U,Z)="" D ENTER ;null dialysis type. DG729
71 S L=3,Z=4 D ENTER0
72 S L=1 F K=5:1:9 S:'$P(DGPROC,U,K) DGPROC=$P(DGPROC,U,1,K-1)_U_$P(DGPROC,U,K+1,99),K=K-1 S L=L+1 Q:L=5
73 F K=5:1:9 S DGPTTMP=$$ICDOP^ICDCODE(+$P(DGPROC,U,K),$$GETDATE^ICDGTDRG(J)) D
74 . S Y=Y_$S(+DGPTTMP>0&($P(DGPTTMP,U,10)):$J($P($P(DGPTTMP,U,2),".",1),2)_$E($P($P(DGPTTMP,U,2),".",2)_" ",1,3),1:" ")_" "
75 D FILL,SAVE G 601
76 Q
77 ;
78701 ; -- setup 701 transaction
79 D 701^DGPTR4 Q
80 ;
81ENTER S Y=Y_$J($P(X,U,Z),L)
82 Q
83 ;
84ENTER0 S Y=Y_$S($P(X,U,Z)]"":$E("00000",$L($P(X,U,Z))+1,L)_$P(X,U,Z),1:$J($P(X,U,Z),L))
85 Q
86 ;
87SAVE D START^DGPTR1 S:'DGERR ^XMB(3.9,DGXMZ,2,DGCNT,0)=Y,DGCNT=DGCNT+1
88 I DGERR'>0 S DGACNT=DGACNT+1,^TMP("AEDIT",$J,$E(Y,1,4),DGACNT)=Y
89Q Q
90 ;
91FILL F K=$L(Y):1:124 S Y=Y_" "
92 Q
93 ;
94CDR S Y=Y_$E($P(Z,".")_"0000",1,4)_$E($P(Z,".",2)_"00",1,2)
95 Q
96ADDQUES ;-- additional PTF questions load records for trans 501/701
97 N DGADDQ
98 F DGADDQ=2,3,4 D ;null results if discharge>inactive date. DG/729
99 . I +$P($G(^DIC(45.88,DGADDQ,0)),U,3) S $P(DGAUX,U,DGADDQ)=$S((+$G(^DGPT(J,70))<$P(^DIC(45.88,DGADDQ,0),U,3)):$P(DGAUX,U,DGADDQ),1:"")
100 S DGDRUG=$S($D(^DIC(45.61,+$P(DGAUX,U,4),0)):$P(^(0),U,2),1:" ")
101 S Y=Y_$E($P(DGAUX,U,3)_" ")_$E($P(DGAUX,U,2)_" ")_$J($P(DGDRUG,U),4)
102 S Y=Y_$E($P(DGAUX,U,5)_" ")
103 S DGT=0,X=$P(DGAUX,U,6) I X]"" S DGT=1,Z=1,L=2 D ENTER0
104 I 'DGT S Y=Y_" "
105 S DGT=0,X=$P(DGAUX,U,7) I X]"" S DGT=1,Z=1,L=2 D ENTER0
106 I 'DGT S Y=Y_" "
107 Q
Note: See TracBrowser for help on using the repository browser.