source: WorldVistAEHR/trunk/r/MENTAL_HEALTH-YS-RUCL-YI-YT/YSGAFAPI.m@ 1005

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

initial load of WorldVistAEHR

File size: 1.0 KB
Line 
1YSGAFAPI ;ALB/ASF- GAF API ;2/7/02 15:57
2 ;;5.01;MENTAL HEALTH;**53,71,82**;Dec 30, 1994;Build 3
3GAFHX(YSDATA,YS) ;
4 N YSBEG,YSEND,YSLIMIT
5 K YSDATA
6 D PARSE(.YS)
7 I DFN'>0 S YSDATA(1)="[ERROR]",YSDATA(2)="No dfn" Q
8 S YSDATA(1)="[DATA]"
9 S N=1
10 D HXLP
11 Q
12PARSE(YS) ; -- array parsing
13 N X,Y,%DT
14 S DFN=$G(YS("DFN"),0)
15 S YSBEG=$G(YS("BEGIN"),"01/01/1970") S X=YSBEG D ^%DT S YSBEG=Y
16 S YSEND=$G(YS("END"),"01/01/2500") S X=YSEND D ^%DT S YSEND=Y
17 S YSLIMIT=$G(YS("LIMIT"),9999)
18 Q
19HXLP ;
20 N YSJJ,YSDD,X,Y,YSX,YSN
21 S YSDD=9999999-YSEND-.00001
22 F YSJJ=1:1:YSLIMIT S YSDD=$O(^YSD(627.8,"AX5",DFN,YSDD)) Q:YSDD'>0!(YSDD>(9999999-YSBEG)) D
23 . S YSN=0 F S YSN=$O(^YSD(627.8,"AX5",DFN,YSDD,YSN)) Q:YSN'>0 D
24 .. S YSX=$P($G(^YSD(627.8,YSN,60)),U,3)
25 .. S Y=$P($G(^YSD(627.8,YSN,0)),U,3)
26 .. S YSX=Y_U_$$FMTE^XLFDT(Y,"5TZ")_"^GAF^GAF^"_YSX
27 .. S YSX=YSX_U_YSN_U_$$EXTERNAL^DILFD(627.8,.04,"",$P($G(^YSD(627.8,YSN,0)),U,4)) ;ASF 2/7/02
28 .. S YSX=YSX_U_$G(^YSD(627.8,YSN,80,1,0))
29 .. D SET(YSX)
30 Q
31SET(X) ;
32 S N=N+1
33 S YSDATA(N)=X
34 Q
Note: See TracBrowser for help on using the repository browser.