source: FOIAVistA/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YTQPXRM7.m@ 811

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

initial load of FOIAVistA 6/30/08 version

File size: 4.1 KB
Line 
1YTQPXRM7 ;ALB/ASF- PSYCH TEST API FOR CLINICAL REMINDERS ; 7/12/07 5:07pm
2 ;;5.01;MENTAL HEALTH;**85**;Dec 30, 1994;Build 48
3 ;Reference to ^PXRMINDX(601.2, supported by DBIA #4114
4SET(X) ;
5 S N=N+1
6 S YSDATA(N)=X
7 Q
8DASASI ;
9 K YSSONE
10 S N=0,N2=0,IFN=$P(DAS,";",5)
11 I '$D(^YSTX(604,IFN,0)) S YSDATA(1)="[ERROR]",YSDATA(2)="no asi match" Q
12 D SET("[DATA]")
13 S YSADATE=$P(^YSTX(604,IFN,0),U,5)
14 S X=$P(^DPT(DFN,0),U)_"^ASI^--- Addiction Severity Index ---^"_YSADATE_U_$$FMTE^XLFDT(YSADATE,"5ZD")_U_$$GET1^DIQ(604,IFN_",",.09,"E")
15 D SET(X)
16 S YSDATA("S",1)="S1^Medical^"_$$GET1^DIQ(604,IFN_",",8.12)_U_$$GET1^DIQ(604,IFN_",",.61)
17 S YSDATA("S",2)="S2^Employment^"_$$GET1^DIQ(604,IFN_",",9.34)_U_$$GET1^DIQ(604,IFN_",",.62)
18 S YSDATA("S",3)="S3^Alcohol^"_$$GET1^DIQ(604,IFN_",",11.18)_U_$$GET1^DIQ(604,IFN_",",.63)
19 S YSDATA("S",4)="S4^Drug^"_$$GET1^DIQ(604,IFN_",",11.185)_U_$$GET1^DIQ(604,IFN_",",.635)
20 S YSDATA("S",5)="S5^Legal^"_$$GET1^DIQ(604,IFN_",",14.34)_U_$$GET1^DIQ(604,IFN_",",.64)
21 S YSDATA("S",6)="S6^Family^"_$$GET1^DIQ(604,IFN_",",18.29)_U_$$GET1^DIQ(604,IFN_",",.65)
22 S YSDATA("S",7)="S7^Psychiatric^"_$$GET1^DIQ(604,I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YSCODE'?1N.N D ERR("bad test code") Q ;-->OUT
33 S YSCODEN=$P(^YTT(601,YSCODE,0),U)
34 S DFN=$P(DAS,";")
35 I DFN'?1N.N D ERR("bad dfn") Q ;--> OUT
36 S (IFN,YSADATE)=$P(DAS,";",5)
37 I IFN'>0 D ERR("bad IFN") Q ;-->out
38 I YSCODEN="GAF" D GAF Q ;--> out
39 I YSCODEN="ASI" D DASASI Q ;-->out
40 I YSADATE'?7N.E D ERR("bad date") Q ;-->OUT
41 ;;score me
42SCOR1 S (YSTEST,YSET)=YSCODE
43 S YSED=YSADATE
44 S YSDFN=DFN
45 S YSSX=$P(^DPT(DFN,0),U,2)
46 S YSTN=YSCODEN
47 IF '$D(^YTD(601.2,YSDFN,1,YSET,1,YSED)) S YSDATA(1)="[ERROR SCORE1 NEW]",YSDATA(2)="no administration found" Q
48 D PRIV ;check it
49 Q:YSPRIV=0
50 S YSR(0)=$G(^YTT(601.6,YSET,0))
51 I $P(YSR(0),U,2)="Y" S X=^YTT(601.6,YSET,1) X X
52 Q:$G(YSDATA(1))?1"[ERROR".E
53 ;;
54SCORSET ;;heading data name^code^title^comp date^ordered by
55 S N=0 D SET("[DATA]")
56 S X=$P($G(^YTD(601.2,YSDFN,1,YSET,1,YSED,0)),U,3)
57 S X=$S(X?1N.N:$P($G(^VA(200,X,0)),U,1),1:"")
58 S X=$P(^DPT(DFN,0),U)_U_YSCODE_U_$P($G(^YTT(601,YSET,"P")),U)_U_YSED_U_$$FMTE^XLFDT(YSADATE,"5ZD")_U_X
59 D SET(X)
60 I YSPRIV=0 D SET("no privilege") Q
61 ;no return of responses for legacy tests ASF 2/22/07
62 ;S G=$G(^YTD(601.2,DFN,1,YSET,1,YSED,1)) F I=1:1 S A=$E(G,I) Q:A="" S N1=N1+1,YSDATA("R",N1)="^^^^"_A_U_A
63 D:YSPRIV SF^YTAPI2
64 S N1=0
65 F S N1=$O(YSSONE(N1)) Q:N1'>0 S YSDATA("S",N1)=YSSONE(N1)
66 Q
67GAF ;score gafs
68 I '$D(^YSD(627.8,IFN,60)) D ERR("no ax5 ifn") Q ;-->out
69 S N=0,G=^YSD(627.8,IFN,0) D SET("[DATA]")
70 S X=$P($G(^DPT(DFN,0)),U)_"^GAF^GAF^"_$P(G,U,3)_U_$$EXTERNAL^DILFD(627.8,.03,"",$P(G,U,3))_U_$$EXTERNAL^DILFD(627.8,.04,"",$P(G,U,4)) ;asf 2/13/04
71 D SET(X)
72 ;S YSDATA("R",1)="^^^^^"_$P($G(^YSD(627.8,IFN,60)),U,3)
73 S YSDATA("S",1)="S1^GAF^"_$P($G(^YSD(627.8,IFN,60)),U,3)_U_$G(^YSD(627.8,IFN,80,1,0))
74 Q
75ERR(YSX) ;errors
76 S YSDATA(0)="[ERROR]",YSDATA(1)=YSX
77 Q
78PRIV ;check privileges
79 N YS71,YSKEY
80 S YSPRIV=0
81 S YS71=$O(^YTT(601.71,"B",YSCODEN,0))
82 Q:YS71="" ;-->out error
83 S YSKEY=$$GET1^DIQ(601.71,YS71_",",9)
84 I YSKEY="" S YSPRIV=1 Q ;-->out exempt
85 I $D(^XUSEC(YSKEY,DUZ)) S YSPRIV=1 Q ;-->out has key
86 Q
Note: See TracBrowser for help on using the repository browser.