source: WorldVistAEHR/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YTQAPI12.m@ 1154

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

initial load of WorldVistAEHR

File size: 4.2 KB
Line 
1YTQAPI12 ;ASF/ALB MHQ IMPORT PROCEEDURES ; 4/3/07 11:14am
2 ;;5.01;MENTAL HEALTH;**85**;Dec 30, 1994;Build 49
3 Q
4IMPORT(YSATA,YS) ;
5 K ^TMP($J)
6 N YSERR,YSMS,%X,%Y,DA,DIK,N,X,Y,YSCP,YSEND,YSFILE,YSFL,YSFLD,YSGL,YSNEW,YSNVAL,YSOVAL,YSPF
7 S YSMS=$G(YS("MESSAGE"))
8 I YSMS="" S YSDATA(1)="[ERROR]",YSDATA(2)="no msg #" Q ;-->out
9 I YSMS'?1N.N S YSDATA(1)="[ERROR]",YSDATA(2)="bad msg #" Q ;-->out
10 S X=$$GET1^DIQ(3.9,YSMS_",",3,,"^TMP($J,""YSM"")","YSERR")
11 I $D(YSERR) S YSDATA(1)="[ERROR]",YSDATA(2)="no load" Q ;-->out
12 S N=0,YSEND=0 F D Q:YSEND S @X=Y
13 . S N=N+1,X=$G(^TMP($J,"YSM",N))
14 . S:X="" YSEND=1
15 . S N=N+1,Y=$G(^TMP($J,"YSM",N))
16 K ^TMP($J,"YSM")
17 D RAWLOAD ;load into 601 files
18 D POINT ;re point foreign keys
19 Q
20RAWLOAD ; load into new iens
21 F YSFL=71,72,73,75,751,76,79,81,82,83,86,87,88,89,91 D
22 . S YSFILE="601."_YSFL
23 . S N=0 F S N=$O(^TMP($J,"YSI",YSFILE,N)) Q:N'>0 D
24 .. S YSNEW=$$NEW^YTQLIB(YSFILE)
25 .. S ^TMP($J,"YSOLD",YSFILE,N)=YSNEW
26 .. S %X="^TMP($J,""YSI"","_YSFILE_","_N_","
27 .. S %Y="^YTT("_YSFILE_","_YSNEW_","
28 .. D %XY^%RCR
29 .. I (YSFILE'=601.71)&(YSFILE'=601.751) S $P(^YTT(YSFILE,YSNEW,0),U)=YSNEW
30 .. S DA=YSNEW,DIK="^YTT("_YSFILE_"," D IX^DIK ;xref
31 Q
32POINT ; set relational keys
33 S YSFILE=601.72,YSFLD=2,YSPF=601.73 D FK ;quest intro
34 ;S YSFILE=601.751,YSFLD=2,YSPF=601.75 D FK ;
35 S YSFILE=601.76,YSFLD=7,YSPF=601.88 D FK ;
36 S YSFILE=601.76,YSFLD=8,YSPF=601.88 D FK ;
37 S YSFILE=601.76,YSFLD=9,YSPF=601.88 D FK ;
38 S YSFILE=601.76,YSFLD=3,YSPF=601.72 D FK ;
39 S YSFILE=601.76,YSFLD=1,YSPF=601.71 D FK ;
40 S YSFILE=601.79,YSFLD=3,YSPF=601.72 D FK ;
41 S YSFILE=601.79,YSFLD=2,YSPF=601.82 D FK ;
42 S YSFILE=601.79,YSFLD=1,YSPF=601.71 D FK ;
43 S YSFILE=601.81,YSFLD=1,YSPF=601.71 D FK ;
44 S YSFILE=601.81,YSFLD=2,YSPF=601.72 D FK ;
45 S YSFILE=601.81,YSFLD=6,YSPF=601.88 D FK ;
46 S YSFILE=601.82,YSFLD=1,YSPF=601.72 D FK ;
47 S YSFILE=601.82,YSFLD=6,YSPF=601.72 D FK ;
48 S YSFILE=601.83,YSFLD=2,YSPF=601.72 D FK ;
49 S YSFILE=601.83,YSFLD=3,YSPF=601.82 D FK ;
50 S YSFILE=601.83,YSFLD=1,YSPF=601.73 D FK ;
51 S YSFILE=601.86,YSFLD=1,YSPF=601.71 D FK ;
52 S YSFILE=601.87,YSFLD=1,YSPF=601.86 D FK ;
53 S YSFILE=601.91,YSFLD=2,YSPF=601.72 D FK ;
54 S YSFILE=601.91,YSFLD=1,YSPF=601.87 D FK ;
55 Q
56FK ;foreign keys
57 S N=0 F S N=$O(^TMP($J,"YSI",YSFILE,N)) Q:N'>0 D
58 . S YSNEW=^TMP($J,"YSOLD",YSFILE,N)
59 . S YSGL=$P(^DD(YSFILE,YSFLD,0),U,4),YSCP=$P(YSGL,";",2),YSGL=+YSGL
60 . Q:YSCP=""
61 . S YSOVAL=$P($G(^YTT(YSFILE,YSNEW,YSGL)),U,YSCP)
62 . Q:YSOVAL'?1N.E
63 . S YSNVAL=$G(^TMP($J,"YSOLD",YSPF,YSOVAL))
64 . ;I YSNVAL'?1N.N W !,"YSFILE= ",YSFILE," YSGL= ",YSGL," YSCP= ",YSCP," TMPOLD= ",$G(^TMP($J,"YSOLD",YSPF,YSOVAL)) Q
65 . S $P(^YTT(YSFILE,YSNEW,YSGL),U,YSCP)=YSNVAL
66 . S DA=YSNEW,DIK="^YTT("_YSFILE_",",DIK(1)=YSFLD D EN^DIK
67 Q
68MLIST(YSDATA) ;LISTMSGS^XMXAPIB(XMDUZ,XMK,XMFLDS,XMFLAGS,XMAMT,.XMSTART,.XMCRIT,XMTROOT)
69 ;returns list of exported tests in mailbox
70 ;input: none
71 ;output : msg #^subject^date
72 N XMCRIT,N
73 K ^TMP("XMLIST",$J)
74 K ^TMP("YSMAIL",$J) S YSDATA=$NA(^TMP("YSMAIL",$J))
75 S XMCRIT("SUBJ")="EXPORT OF"
76 D LISTMSGS^XMXAPIB(DUZ,"*","SUBJ;DATE","B",,,.XMCRIT)
77 I $D(^TMP("XMERR",$J)) S ^TMP("YSMAIL",$J,1)="[ERROR]",^TMP("YSMAIL",$J,2)="LISTMSG err" Q ;-->out
78 S ^TMP("YSMAIL",$J,1)="[DATA]"
79 S N=0 F S N=$O(^TMP("XMLIST",$J,N)) Q:N'>0 D
80 . S ^TMP("YSMAIL",$J,N+1)=^TMP("XMLIST",$J,N)_U_$G(^TMP("XMLIST",$J,N,"SUBJ"))_U_$P($G(^TMP("XMLIST",$J,N,"DATE")),U,1)
81 Q
82LISTASI(YSDATA,YS) ;ASI LISTER
83 ;REQUIRES: DFN
84 ;RETURNS: IEN=DATE OF INTERVIEW^CLASS^SPECIAL^ESIGNED^INTERVIEWER(E)^INTERVIWER(I)
85 ;0 RETURNED IF NO ADMINS
86 N DFN,YSIEN,YSN
87 K ^TMP("YSDATA",$J) S YSDATA=$NA(^TMP("YSDATA",$J))
88 S DFN=$G(YS("DFN"))
89 I DFN<1 S ^TMP("YSDATA",$J,1)="[ERROR]^bad DFN" Q ;--->OUT
90 S YSN=1
91 S YSIEN=0
92 S ^TMP("YSDATA",$J,1)="[DATA]^0"
93 F S YSIEN=$O(^YSTX(604,"C",DFN,YSIEN)) Q:YSIEN'>0 D S ^TMP("YSDATA",$J,1)="[DATA]^"_(YSN-1)
94 . S YSN=YSN+1
95 . S ^TMP("YSDATA",$J,YSN)=YSIEN_"="_$$FMTE^XLFDT($$GET1^DIQ(604,YSIEN_",",.05,"I"),"5ZD")_U_$$GET1^DIQ(604,YSIEN_",",.04,"E")_U_$$GET1^DIQ(604,YSIEN_",",.11,"E")_U_$$GET1^DIQ(604,YSIEN_",",.51,"E")
96 . S ^TMP("YSDATA",$J,YSN)=^TMP("YSDATA",$J,YSN)_U_$$GET1^DIQ(604,YSIEN_",",.09,"E")_U_$$GET1^DIQ(604,YSIEN_",",.09,"I")
97 . S ^TMP("YSDATA",$J,YSN)=^TMP("YSDATA",$J,YSN)_U_$$GET1^DIQ(604,YSIEN_",",.09,"E")_U_$$GET1^DIQ(604,YSIEN_",",.09,"I")
98 Q
Note: See TracBrowser for help on using the repository browser.