source: FOIAVistA/trunk/r/MEDICINE-MC/MCARDCN1.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 4.0 KB
Line 
1MCARDCN1 ;WISC/TJK-MODIFIED DICN1 ROUTINE FOR MEDICINE SCREENS ;7/22/96 08:12
2 ;;2.3;Medicine;;09/13/1996
3 K DICRS,Y,MCARDRCR
4 F Y="I","J","X","DO","DC","DA","DE","DG","DIE","DR","DIC","D","D0","D1","D2","D3","D4","D5","D6","DI","DH","DIA","DICR","DK","DIK","DL","DLAYGO","DM","DP","DQ","DU","DW","DIEL","DOV","DIOV","DIEC","DB","DV","DIFLD" S MCARDRCR(Y)=""
5 S DZ="W !?3,$S("""_$P(DO,U,1)_"""'=$P(DQ(DQ),U,1):"""_$P(DO,U,1)_""",1:"""")_"" ""_$P(DQ(DQ),U,1)_"": """
6 I $D(DIC("DR")) S DD=DIC("DR")
7 E S DD="",MCPCT=0 F Y=0:0 S Y=$O(^DD(+DO(2),0,"ID",Y)) S:Y="" Y=-1 Q:Y'>0 D CKID I '$D(MCPCT) D G BAD
8 . ; Naked Reference in DENTCN1+8 ref to DENTDCN1+6
9 . W !,"SORRY! A VALUE FOR '"_$P(^(0),U,1)_"' MUST BE ENTERED,"
10 . W !?6,"BUT YOU DON'T HAVE 'WRITE ACCESS' FOR THIS FIELD"
11 . S MCARDRCR="D^MCARDCN1"
12 . D STORLIST
13 . Q
14 ;END IF
15 ;
16 S MCARDRCR="RCR^MCARDCN1" D STORLIST G D^MCARDCN:$D(Y)<9
17BAD S:$D(D)#2 DA=D K Y I '$D(DO(1)) S Y=-1 G Q^MCARDC
18 K DO G A^MCARDC
19 ;
20CKID I $D(DUZ(0)),DUZ(0)'="@",$D(^DD(+DO(2),Y,9)),^(9)]"" F MCPCT=1:1 I DUZ(0)[$E(^(9),MCPCT) Q:$L(^(9))'<MCPCT K:$P(^(0),U,2)["R" MCPCT G Q
21 S DD=DD_Y_";"
22Q Q
23 ;
24RCR ;
25 K DR,DQ,DG,DE,DO S DIE=DIC,DR=DD,DIE("W")=DZ K DIC I $D(DIE("NO^")) S MCARDRCR("DIE(""NO^"")")=DIE("NO^")
26 S DIE("NO^")="OUTOK" D ^DIE K DIE("W"),DIE("NO^") I '$D(DA) S Y(0)=0 Q
27 Q:$D(Y)<9
28ZAP S DIK=DIE W !?6,"<'",*7,$P(@(DIK_"DA,0)"),U,1),"' DELETED>" D ^DIK S Y(0)=0 K DIK Q
29D S DIE=DIC G ZAP
30 ;
31RIX ;
32 K MCARDRCR F MCPCT="D0","Y","DIC","DIU","DIV","DO","D","DD","DICR","X" S MCARDRCR(MCPCT)=""
33 S MCARDRCR="RR^MCARDCN1",DZ=^DD(+DO(2),.01,1,1) D STORLIST G IX^MCARDCN
34 ;
35RR X DZ Q
36 ;
37NUM ;
38 I '$D(DD),DIC="^DIC(",$D(^DD("SITE",1)),X\1000'=^(1) S X=^(1)*1000 G F2^MCARDCN
39 S MCPCT=$P(^DD(+Y,.001,0),U,2),X=$S(MCPCT'["N"!(MCPCT["O"):0,1:X),MCPCTY=X I X F MCPCT=1:1 D N Q:$D(X) S X=0 Q:MCPCT>50 S X=MCPCTY+DIY,MCPCTY=X
40 W !?3,$P(DO,U,1)_" "_$P(^DD(+Y,.001,0),U,1),": " W:X X,"// " R Y:DTIME E S DTOUT=1,Y=U W *7
41 I Y="?" W:$D(^DD(+$P(D0,U,2),.001,3)) !,^(3) X:$D(^(4)) ^(4) G F1^MCARDCN
42 G BAD^MCARDC1:Y[U S:Y]"" X=Y D N I '$D(X) W *7,"??" W:$D(^DD(+DO(2),.001,3)) !,^(3) X:$D(^(4)) ^(4) G F1^MCARDCN
43 G LOCK^MCARDCN
44 ;
45N X:$D(^DD(+$P(DO,U,2),.001,0)) $P(^(0),U,5,99) I $D(X),$L(X)<15,+X=X,X>0,X>1!(DIC'="^DIC(") Q
46 K X
47STORLIST ;
48 D INIT
49O S MCARDJD=$O(MCARDRCR(MCARDJD)) S:MCARDJD="" MCARDJD=-1 G CALL:MCARDJD<0
50 I $D(@MCARDJD)#2 S @(MCARDJE_")="_MCARDJD) G O:$D(@MCARDJD)=1
51 S MCARDJX=MCARDJD_"(" D MCARDJXY G O
52 ;
53CALL S MCARDJE=MCARDRCR K MCARDRCR,MCARDJX,MCARDJY D @MCARDJE
54 S MCARDJE="^TMP(""MCARDRCR"",$J,"_^TMP("MCARDRCR",$J)_",MCARDJD",^($J)=^($J)-1,MCARDJD=0,MCARDJX=MCARDJE_","
55G S MCARDJD=$O(@(MCARDJE_")")) S:MCARDJD="" MCARDJD=-1
56 ; Naked reference in next line is to ^TMP("MCARDRCR",$J,
57 I MCARDJD<0 K MCARDJD,MCARDJE,MCARDJX,MCARDJY,^($J,^TMP("MCARDRCR",$J)+1) Q
58 K:$D(MCARDJD) @MCARDJD
59 ; Naked reference in next line is to ^TMP("MCARDRCR",$J,
60 I $D(^(MCARDJD))#2 S @MCARDJD=^(MCARDJD) G G:$D(^(MCARDJD))=1
61 S MCARDJY=MCARDJD_"(" D MCARDJXY G G
62 ;
63MCARDJXY ;
64 S MCARDJZ=1,MCARDJA="",MCARDJC(0)=0
65S S MCARDJB=-1
66N1 S MCARDJB=$O(@(MCARDJX_MCARDJA_"MCARDJB)")) S:MCARDJB="" MCARDJB=-1 S MCARDJC(MCARDJZ)=MCARDJC(MCARDJZ-1)
67 I MCARDJB["," F MCARDJC=0:0 S MCARDJC=$F(MCARDJB,",",MCARDJC) Q:'MCARDJC S MCARDJC(MCARDJZ)=MCARDJC(MCARDJZ)+1
68 I MCARDJB=-1 G Q1:MCARDJZ=1 S MCARDJZ=MCARDJZ-1,@("MCARDJB="_$P(MCARDJA,",",MCARDJZ+MCARDJC(MCARDJZ-1),MCARDJZ+MCARDJC(MCARDJZ))),MCARDJA=$P(MCARDJA,",",1,MCARDJZ-1+MCARDJC(MCARDJZ-1))_$E(",",MCARDJZ>1) G N1
69 I $D(@(MCARDJX_MCARDJA_"MCARDJB)"))#10=1 S @(MCARDJY_MCARDJA_"MCARDJB)="_MCARDJX_MCARDJA_"MCARDJB)")
70 I $D(@(MCARDJX_MCARDJA_"MCARDJB)"))<9 G N1
71 G DOWN:+MCARDJB=MCARDJB F MCARDJC=0:0 S MCARDJC=$F(MCARDJB,"""",MCARDJC) Q:'MCARDJC S MCARDJB=$E(MCARDJB,1,MCARDJC-1)_""""_$E(MCARDJB,MCARDJC,999),MCARDJC=MCARDJC+1
72 S MCARDJB=""""_MCARDJB_""""
73DOWN S MCARDJA=MCARDJA_MCARDJB_",",MCARDJZ=MCARDJZ+1 G S
74 ;
75Q1 K MCARDJA,MCARDJB,MCARDJC,MCARDJZ Q
76 ;
77INIT I $D(^TMP("MCARDRCR",$J))[0 S ^TMP("MCARDRCR",$J)=0
78 S ^TMP("MCARDRCR",$J)=^($J)+1,MCARDJD="MCPCTZ",MCARDJE="^TMP(""MCARDRCR"",$J,"_^($J)_",MCARDJD",MCARDJY=MCARDJE_"," K ^($J,^($J))
79 Q
Note: See TracBrowser for help on using the repository browser.