source: WorldVistAEHR/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YTQAPI.m@ 1474

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

initial load of WorldVistAEHR

File size: 3.9 KB
Line 
1YTQAPI ;ASF/ALB MHQ REMOTE PROCEEDURES ; 4/3/07 10:36am
2 ;;5.01;MENTAL HEALTH;**85**;Dec 30, 1994;Build 49
3 Q
4TSLIST(YSDATA) ;list tests and surveys
5 ;Input: none
6 ;Output: TEST NAME = LAST EDIT DATE^OPERATIONAL^REQUIRES LISCENCE^LISCENCE CURRENT^IS LEGACY^IEN^R PRIVILEGE^IS NATIONAL^HAS BEEN OPERATIONAL
7 N YSTESTN,YSTEST,N,G,G1,G2,G3,G4,G5,G6,G7
8 K ^TMP($J,"YSTL")
9 S YSDATA=$NA(^TMP($J,"YSTL"))
10 S N=1,^TMP($J,"YSTL",N)="[DATA]"
11 S YSTEST="" F S YSTEST=$O(^YTT(601.71,"B",YSTEST)) Q:YSTEST="" D
12 . S YSTESTN=$O(^YTT(601.71,"B",YSTEST,0))
13 . S N=N+1
14 . S G=$$GET1^DIQ(601.71,YSTESTN_",",18,"I")
15 . S G1=$$GET1^DIQ(601.71,YSTESTN_",",10,"E")
16 . S G2=$$GET1^DIQ(601.71,YSTESTN_",",11,"E")
17 . S G3=$$GET1^DIQ(601.71,YSTESTN_",",20,"E")
18 . S G4=$$GET1^DIQ(601.71,YSTESTN_",",23,"E")
19 . S G5=$$GET1^DIQ(601.71,YSTESTN_",",9,"E")
20 . S G6=$$GET1^DIQ(601.71,YSTESTN_",",19,"E")
21 . S G7=$$GET1^DIQ(601.71,YSTESTN_",",10.5,"E")
22 . S ^TMP($J,"YSTL",N)=YSTEST_"="_G_U_G1_U_G2_U_G3_U_G4_U_YSTESTN_U_G5_U_G6_U_G7
23 Q
24TSLIST1(YSDATA,YS) ;list questions for a single test
25 ;input: CODE as test name
26 ;output: Field^Value
27 N YSTESTN,YSTEST,YSF,YSV,N,I,YSEI
28 S YSTEST=$G(YS("CODE"))
29 I YSTEST="" S YSDATA(1)="[ERROR]",YSDATA(2)="NO code" Q ;-->out
30 S YSTESTN=$O(^YTT(601.71,"B",YSTEST,0))
31 I YSTESTN'>0 S YSDATA(1)="[ERROR]",YSDATA(2)="bad code" Q ;-->out
32 S N=2,YSDATA(1)="[DATA]",YSDATA(2)="IEN="_YSTESTN
33 S I=0 F S I=$O(^DD(601.71,I)) Q:I'>0 D
34 . S N=N+1
35 . S YSEI=$S(I=18:"I",1:"E")
36 . D FIELD^DID(601.71,I,"","LABEL","YSF")
37 . S YSV=$$GET1^DIQ(601.71,YSTESTN_",",I,YSEI)
38 . S YSDATA(N)=YSF("LABEL")_"="_YSV
39 Q
40CHOICES(YSDATA,YS) ;list choices for a question
41 ;input: CODE as test name
42 ;output: 601.75(1) CHOICETYPE ID^SEQUENCE^CHOICE IFN^CHOICE TEXT^LEGACY VALUE
43 N YSCDA,YSIC,YSQN,YSN,YSN1,YSTESTN,YSTEST,YSF,YSV,N,G,YSCTYP,YSCTYPID,G,G1,X
44 S YSTEST=$G(YS("CODE"))
45 S YSTESTN=$O(^YTT(601.71,"B",YSTEST,0))
46 I YSTESTN'>0 S YSDATA(1)="[ERROR]",YSDATA(2)="bad code" Q ;-->out
47 S N=1,YSDATA(1)="[DATA]"
48 ;
49 S YSIC=0
50 F S YSIC=$O(^YTT(601.76,"AC",YSTESTN,YSIC)) Q:YSIC'>0 S YSQN=$P(^YTT(601.76,YSIC,0),U,4) D
51 . S YSCTYP=$P($G(^YTT(601.72,YSQN,2)),U,3)
52 . S:YSCTYP'="" YSCTYPID(YSCTYP)=""
53C2 ;
54 S YSN=0
55 F S YSN=$O(YSCTYPID(YSN)) Q:YSN'>0 D
56 . S YSN1=0 F S YSN1=$O(^YTT(601.751,"AC",YSN,YSN1)) Q:YSN1'>0 D
57 .. S YSCDA=0 F S YSCDA=$O(^YTT(601.751,"AC",YSN,YSN1,YSCDA)) Q:YSCDA'>0 D
58 ... S N=N+1
59 ... S YSDATA(N)=YSN_U_YSN1_U_YSCDA_U_$G(^YTT(601.75,YSCDA,1))_U_$P($G(^YTT(601.75,YSCDA,0)),U,2)
60 Q
61SKIPPED(YSDATA,YS) ; skipped questions for an instrument
62 ;input: CODE as test name
63 ;output: QUESTIONID^SKIPQUESTIONID
64 ; for single test in question,skipped order
65 N YSTESTN,YSTEST,N,N1,N2,YSQ,YSK,G
66 S YSTEST=$G(YS("CODE"))
67 S YSTESTN=$O(^YTT(601.71,"B",YSTEST,0))
68 I YSTESTN'>0 S YSDATA(1)="[ERROR]",YSDATA(2)="bad code" Q ;-->out
69 I '$D(^YTT(601.79,"AC",YSTESTN)) S YSDATA(1)="[ERROR]",YSDATA(2)="no entries for this code" Q ;--> out
70 S N=1,YSDATA(1)="[DATA]"
71 ;
72 S N1=0 F S N1=$O(^YTT(601.79,"AC",YSTESTN,N1)) Q:N1'>0 D
73 . S G=^YTT(601.79,N1,0),YSQ=$P(G,U,3),YSK=$P(G,U,4)
74 . S:(YSQ?1N.N)&(YSK?1N.N) G(YSQ,YSK)=""
75 S N1=0 F S N1=$O(G(N1)) Q:N1'>0 S N2=0 F S N2=$O(G(N1,N2)) Q:N2'>0 S N=N+1,YSDATA(N)=N1_U_N2
76 Q
77SECTION(YSDATA,YS) ;section captions
78 ;input: CODE as test name
79 ;output: FIRSTQUESTIONID^TABCAPTION^SECTIONCAPTION^DISPLAYID
80 ; for single test in questionID order
81 N YSTESTN,YSTEST,N,N1,G,YSQ
82 S YSTEST=$G(YS("CODE"))
83 S YSTESTN=$O(^YTT(601.71,"B",YSTEST,0))
84 I YSTESTN'>0 S YSDATA(1)="[ERROR]",YSDATA(2)="bad code" Q ;-->out
85 I '$D(^YTT(601.81,"AC",YSTESTN)) S YSDATA(1)="[DATA]" Q ;-->out no entries for this code
86 S N=1,YSDATA(1)="[DATA]"
87 ;
88 S N1=0 F S N1=$O(^YTT(601.81,"AC",YSTESTN,N1)) Q:N1'>0 D
89 . S G=^YTT(601.81,N1,0),YSQ=$P(G,U,3)
90 . S:(YSQ?1N.N) G(YSQ)=$P(G,U,3,6)
91 S N1=0 F S N1=$O(G(N1)) Q:N1'>0 D
92 . S N=N+1,YSDATA(N)=G(N1)
93 . S N=N+1,YSDATA(N)="DISPLAY=" S:$P(G(N1),U,4)?1N.N YSDATA(N)=YSDATA(N)_$$DISPEXT^YTQAPI5($P(G(N1),U,4))
94 Q
95 ;
Note: See TracBrowser for help on using the repository browser.