VistA-WorldVistAEHR/r/MEDICINE-MC/MCOBGA.m

82 lines
4.3 KiB
Mathematica

MCOBGA ; GENERATED FROM 'MCARGIBRPR' PRINT TEMPLATE (#1026) ; 10/04/96 ; (FILE 699, MARGIN=80)
G BEGIN
N W !
T W:$X ! I '$D(DIOT(2)),DN,$D(IOSL),$S('$D(DIWF):1,$P(DIWF,"B",2):$P(DIWF,"B",2),1:1)+$Y'<IOSL,$D(^UTILITY($J,1))#2,^(1)?1U1P1E.E X ^(1)
S DISTP=DISTP+1,DILCT=DILCT+1 D:'(DISTP#100) CSTP^DIO2
Q
DT I $G(DUZ("LANG"))>1,Y W $$OUT^DIALOGU(Y,"DD") Q
I Y W $P("JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC",U,$E(Y,4,5))_" " W:Y#100 $J(Y#100\1,2)_"," W Y\10000+1700 W:Y#1 " "_$E(Y_0,9,10)_":"_$E(Y_"000",11,12) Q
W Y Q
M D @DIXX
Q
BEGIN ;
S:'$D(DN) DN=1 S DISTP=$G(DISTP),DILCT=$G(DILCT)
I $D(DXS)<9 F X=0:0 S X=$O(^DIPT(1026,"DXS",X)) Q:'X S Y=$O(^(X,"")) F X=X:0 Q:Y="" S DXS(X,Y)=^(Y),Y=$O(^(Y))
W ?0 W "APPT DATE/TIME: "
S X=$G(^MCAR(699,D0,0)) D N:$X>16 Q:'DN W ?16 S Y=$P(X,U,1) D DT
D N:$X>39 Q:'DN W ?39 W "MEDICAL PATIENT: "
S Y=$P(X,U,2) S Y=$S(Y="":Y,$D(^MCAR(690,Y,0))#2:$P(^(0),U,1),1:Y) S Y=$S(Y="":Y,$D(^DPT(Y,0))#2:$P(^(0),U,1),1:Y) W $E(Y,1,30)
D T Q:'DN D N D N:$X>4 Q:'DN W ?4 W "INDICATED THERAPY: "
S I(1)=2,J(1)=699.17 F D1=0:0 Q:$O(^MCAR(699,D0,2,D1))'>0 X:$D(DSC(699.17)) DSC(699.17) S D1=$O(^(D1)) Q:D1'>0 D:$X>25 T Q:'DN D A1
G A1R
A1 ;
S X=$G(^MCAR(699,D0,2,D1,0)) S DIWL=1,DIWR=55 S Y=$P(X,U,1) S Y=$S(Y="":Y,$D(^MCAR(699.6,Y,0))#2:$P(^(0),U,1),1:Y) S X=Y D ^DIWP
D A^DIWW
Q
A1R ;
D T Q:'DN D N D N:$X>4 Q:'DN W ?4 W "SIGNS AND SYMPTOMS: "
S I(1)=3,J(1)=699.18 F D1=0:0 Q:$O(^MCAR(699,D0,3,D1))'>0 X:$D(DSC(699.18)) DSC(699.18) S D1=$O(^(D1)) Q:D1'>0 D:$X>26 T Q:'DN D B1
G B1R
B1 ;
S X=$G(^MCAR(699,D0,3,D1,0)) S DIWL=1,DIWR=55 S Y=$P(X,U,1) S Y=$S(Y="":Y,$D(^MCAR(695.5,Y,0))#2:$P(^(0),U,1),1:Y) S X=Y D ^DIWP
D A^DIWW
Q
B1R ;
D T Q:'DN D N D N:$X>4 Q:'DN W ?4 W "DISEASE FOLLOWUP: "
S I(1)=5,J(1)=699.35 F D1=0:0 Q:$O(^MCAR(699,D0,5,D1))'>0 X:$D(DSC(699.35)) DSC(699.35) S D1=$O(^(D1)) Q:D1'>0 D:$X>24 T Q:'DN D C1
G C1R
C1 ;
S X=$G(^MCAR(699,D0,5,D1,0)) S DIWL=1,DIWR=55 S Y=$P(X,U,1) S Y=$S(Y="":Y,$D(^MCAR(699.84,Y,0))#2:$P(^(0),U,1),1:Y) S X=Y D ^DIWP
D A^DIWW
Q
C1R ;
D T Q:'DN D N D N:$X>4 Q:'DN W ?4 W "FOLLOWUP DEVICE OR THERAPY: "
S I(1)=6,J(1)=699.36 F D1=0:0 Q:$O(^MCAR(699,D0,6,D1))'>0 X:$D(DSC(699.36)) DSC(699.36) S D1=$O(^(D1)) Q:D1'>0 D:$X>34 T Q:'DN D D1
G D1R
D1 ;
S X=$G(^MCAR(699,D0,6,D1,0)) S DIWL=1,DIWR=55 S Y=$P(X,U,1) S Y=$S(Y="":Y,$D(^MCAR(699.85,Y,0))#2:$P(^(0),U,1),1:Y) S X=Y D ^DIWP
D A^DIWW
Q
D1R ;
D T Q:'DN D N D N:$X>4 Q:'DN W ?4 W "SURVEILLANCE: "
S I(1)=7,J(1)=699.37 F D1=0:0 Q:$O(^MCAR(699,D0,7,D1))'>0 X:$D(DSC(699.37)) DSC(699.37) S D1=$O(^(D1)) Q:D1'>0 D:$X>20 T Q:'DN D E1
G E1R
E1 ;
S X=$G(^MCAR(699,D0,7,D1,0)) S DIWL=1,DIWR=55 S Y=$P(X,U,1) S Y=$S(Y="":Y,$D(^MCAR(699.86,Y,0))#2:$P(^(0),U,1),1:Y) S X=Y D ^DIWP
D A^DIWW
Q
E1R ;
D N:$X>4 Q:'DN W ?4 S DIP(1)=$S($D(^MCAR(699,D0,31)):^(31),1:"") S X="PROTOCOL: "_$P(DIP(1),U,1) K DIP K:DN Y W X
D N:$X>4 Q:'DN W ?4 S DIP(1)=$S($D(^MCAR(699,D0,31)):^(31),1:"") S X="EGD SIMPLE PRIMARY EXAM: "_$P(DIP(1),U,2) K DIP K:DN Y W X
D N:$X>4 Q:'DN W ?4 S DIP(1)=$S($D(^MCAR(699,D0,31)):^(31),1:"") S X="LAB OR XRAY: "_$P(DIP(1),U,3) K DIP K:DN Y W X
D N:$X>4 Q:'DN W ?4 S DIP(1)=$S($D(^MCAR(699,D0,32)):^(32),1:"") S X="OCCULT BLOOD: "_$P(DIP(1),U,1) K DIP K:DN Y W X
D N:$X>4 Q:'DN W ?4 S DIP(1)=$S($D(^MCAR(699,D0,32)):^(32),1:"") S X="SPECIMEN COLLECTION: "_$P(DIP(1),U,2) K DIP K:DN Y W X
D N:$X>2 Q:'DN W ?2 W "COMMENT: "
S X=$G(^MCAR(699,D0,0)) D N:$X>12 Q:'DN S DIWL=13,DIWR=80 S Y=$P(X,U,6) S X=Y D ^DIWP
D A^DIWW
D N:$X>1 Q:'DN W ?1 W "ENDOSCOPIST: "
S X=$G(^MCAR(699,D0,0)) D N:$X>15 Q:'DN W ?15 S Y=$P(X,U,8) S Y=$S(Y="":Y,$D(^VA(200,Y,0))#2:$P(^(0),U,1),1:Y) W $E(Y,1,35)
D N:$X>44 Q:'DN W ?44 W "FELLOW: "
S X=$G(^MCAR(699,D0,200)) S Y=$P(X,U,1) S Y=$S(Y="":Y,$D(^VA(200,Y,0))#2:$P(^(0),U,1),1:Y) W $E(Y,1,35)
W ?54 D:MCARGNAM="COL" COL^MCARGS K DIP K:DN Y
W ?65 D:MCARGNAM="LAP" LAP^MCARGS K DIP K:DN Y
D T Q:'DN D N D N:$X>4 Q:'DN W ?4 W "SUMMARY: "
S X=$G(^MCAR(699,D0,.2)) S Y=$P(X,U,1) W:Y]"" $S($D(DXS(7,Y)):DXS(7,Y),1:Y)
D T Q:'DN D N D N:$X>2 Q:'DN W ?2 W "LOCATION: "
S I(1)=30,J(1)=699.01 F D1=0:0 Q:$O(^MCAR(699,D0,30,D1))'>0 X:$D(DSC(699.01)) DSC(699.01) S D1=$O(^(D1)) Q:D1'>0 D:$X>14 T Q:'DN D F1
G F1R^MCOBGA1
F1 ;
S X=$G(^MCAR(699,D0,30,D1,0)) W ?14 S Y=$P(X,U,1) S Y=$S(Y="":Y,$D(^MCAR(697,Y,0))#2:$P(^(0),U,1),1:Y) W $E(Y,1,30)
D N:$X>2 Q:'DN W ?2 W "DESCRIPTION: "
G ^MCOBGA1