source: FOIAVistA/tag/r/MEDICINE-MC/MCARDCM2.m@ 1193

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

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1MCARDCM2 ;WISC/TJK-MODIFIED DICM2 ROUTINE FOR MEDICINE SCREENS ;8/22/96 15:21
2 ;;2.3;Medicine;;09/13/1996
3 ;VAR PNTR
4 S DIVDO=+DO(2),DIVDS=DS,DIVDIC=DIC F MCPCT="DR","S","A","V" I $D(DIC(MCPCT)) S @("DIV"_MCPCT)=DIC(MCPCT)
5 K DIC("W"),DIC("S"),DIC("DR"),DO,DUOUT S DIEX=X G ALL:X'["." I $P(X,".",2)="" S Y=-1 G Q
6V S DIVP=$P(DIEX,".",1),X=$P(DIEX,".",2) I DIVP]"",$D(^DD(DIVDO,.01,"V","P",DIVP)) S (DIVP,DIVPDIC)=+$O(^(DIVP,0)),DIVPDIC=$S($D(^DD(DIVDO,.01,"V",DIVP,0)):^(0),1:"") G Q:'DIVPDIC D DIC G Q
7 S X="",DIVP=$P(DIEX,".",1) F MCPCT=0:0 S X=$O(^DD(DIVDO,.01,"V","M",X)) Q:X="" I $P(X,DIVP,1)="" S (DIVP,DIVPDIC)=+$O(^(X,0)),DIVPDIC=$S($D(^DD(DIVDO,.01,"V",DIVP,0)):^(0),1:""),X=$P(DIEX,".",2) G Q:'DIVPDIC D DIC G Q:Y>0 S X=DIEX
8 F DIVP=0:0 S DIVP=$O(^DD(DIVDO,.01,"V",DIVP)) S:DIVP="" DIVP=-1 Q:DIVP'>0 I $D(^(DIVP,0)) S DIVPDIC=^(0) I $D(^DIC(+DIVPDIC,0)) S MCPCT=$P(^(0),U,1) I $P(MCPCT,$P(DIEX,".",1),1)="" S X=$P(DIEX,".",2) D DIC G Q:Y>0 S X=DIEX
9 K X G Q
10ALL F DIVP1=0:0 S DIVP1=$O(^DD(DIVDO,.01,"V","O",DIVP1)) S:DIVP1="" DIVP1=-1 Q:DIVP1'>0 S DIVP=$O(^(DIVP1,0)) S:DIVP="" DIVP=-1 I $D(^DD(DIVDO,.01,"V",DIVP,0)) S DIVPDIC=^(0) D DIC G Q:Y>0!(MCPCT<0)!$D(DUOUT) S X=DIEX
11 G Q:DICR>1!$D(DICR(DICR,"V")) S DICR(DICR,"V")=1 K DIVP G ALL
12 ;
13DIC ;
14 Q:$D(DIVP(+DIVPDIC)) I $D(DIC("V")) S Y=DIVP,Y(0)=DIVPDIC X DIC("V") I '$T K Y S Y=-1 G DQ
15 I '$D(^DIC(+DIVPDIC,0,"GL")) S Y=-1 G DQ
16 S DIC=^DIC(+DIVPDIC,0,"GL"),MCPCT="DIC"_DICR
17 IF DIC(0)'["L"!'$D(DICR(DICR,"V")) D
18 . S DIC("S")="X ""I 0"" F "_MCPCT_"=0:0 S "_MCPCT_"=$O("_DIVDIC_"""B"",(+Y_"";"_$E(DIC,2,99)_"""),"_MCPCT_")) S:"_MCPCT_"="""" "_MCPCT_"=-1 Q:"_MCPCT_"'>0 I $D("_DIVDIC_MCPCT_",0))"
19 . S DIC("S")=DIC("S")_$S($D(DIVS):"S MCPCTYV=Y,Y="_MCPCT_" X DIVS S Y=MCPCTYV I ",1:"")_" Q"
20 . Q
21 ;END IF
22 ;
23 S MCPCT=DIC(0),DIC(0)="DM"_$E("E",MCPCT["E")_$E("O",MCPCT["O") I $P(DIVPDIC,U,6)="y",$D(DICR(DICR,"V")),MCPCT["L" S DIC(0)=DIC(0)_"L"
24 I $D(DICR(DICR,"V")),$P(DIVPDIC,U,5)="y",$D(^DD(DIVDO,.01,"V",DIVP,1)),^(1)]"" S MCPCT=$S($D(DIC("S")):DIC("S"),1:"") X ^(1) S DIC("S")=DIC("S")_" "_MCPCT
25 I DIC(0)["E",$D(DIVP1),$D(DICR(DICR,"V")) W !!?5,"Searching for a "_$P(DIVPDIC,U,2)
26 I X?."?" S DZ=X_$E("?",'$D(DICR(DICR,"V"))) D DQ^MCARDCQ S X=$S($D(DZ):DZ,1:"?"),Y=-1 G DQ
27 D DO^MCARDC1,X^MCARDC G DQ:$D(DUOUT) S X=+Y_";"_$E(DIC,2,99),MCPCT=1 K:Y<0 X I '$D(DICR(DICR,"V")) K DICR("^",+DIVPDIC) S DIVP(+DIVPDIC)=0
28 I Y>0,$D(DIVP1),DIC(0)["E",'$P(Y,U,3),$P(^DIC(+DIVPDIC,0),U,2)'["O" W !?9,"...OK" D YN^MCARDCN S:MCPCT=2!(MCPCT<0) Y=-1
29DQ K DIC,DO S DIC=DIVDIC,D=$S($D(DICR(DICR,4)):DICR(DICR,4),1:"B"),DIC(0)=DICR(DICR,0) I $D(DIVV) S DIC("V")=DIVV
30 Q
31 ;
32Q I '$D(DUOUT),Y<0,DICR<2,'$D(DICR(DICR,"V")) S DICR(DICR,"V")=1 K DIVP G V
33 K:Y<0 X S DS=DIVDS,DICR(DICR,"V")=1 S:$D(DIVDR) DIC("DR")=DIVDR S:$D(DIVA) DIC("A")=DIVA S:$D(DIVS) DIC("S")=DIVS
34QQ K:Y DICR(DICR,6) K DUOUT,DIVV,DIVP,DIVDIC,DO,DIVDO,DIVDS,DIVS,DIVPDIC,DIEX,DIVP1,DIVDR,DIVA Q
35 ;
36NAME ;DETERMINE EXTERNAL FORM FROM INTERNAL FOR VP
37 S DINAME=DIY Q:'DIY S MCPCT=$P(DIY,";",2),DINAME="^"_MCPCT_+DIY_",0)",DINAME=$S($D(@DINAME)#2:$P(^(0),U,1),1:DIY),MCPCT=$S($D(@("^"_MCPCT_"0)")):$P(^(0),U,2),1:"") Q:MCPCT=""
38 I MCPCT["P"!(MCPCT["S")!(MCPCT["D") S DJC=MCPCT,MCPCTYYY=DIY,MCPCTYY=Y,Y=DINAME D Y K DJC S DINAME=Y,DIY=MCPCTYYY,Y=MCPCTYY,C="," K MCPCTYY,MCPCTYYY
39 Q
40Y S C=$P(^DD(+DJC,.01,0),U,2) I C["O",$D(^(2)) X ^(2) Q
41S I C["S" S C=";"_$P(^DD(+DJC,.01,0),U,3),MCPCT=$F(C,";"_Y_":") S:MCPCT Y=$P($E(C,MCPCT,999),";",1) Q
42 I C["P",$D(@("^"_$P(^DD(+DJC,.01,0),U,3)_"0)")) S (C,DJC)=$P(^(0),U,2) I $D(^(+Y,0)) S Y=$P(^(0),U,1) I $D(^DD(+C,.01,0)) S C=$P(^(0),U,2) G S
43 I C["V",+Y,$D(@("^"_$P(Y,";",2)_"0)")) S C=$P(^(0),U,2) I $D(^(+Y,0)) S Y=$P(^(0),U,1) I $D(^DD(+C,.01,0)) S C=$P(^(0),U,2) G S
44 Q:C'["D" Q:'Y
45D S MCPCT=$E(Y,4,5)*3,Y=$E("JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC",MCPCT-2,MCPCT)_" "_$S($E(Y,6,7):$J(+$E(Y,6,7),2)_", ",1:"")_($E(Y,1,3)+1700)_$S(Y[".":" "_$E(Y_0,9,10)_":"_$E(Y_"000",11,12),1:"") Q
Note: See TracBrowser for help on using the repository browser.