[613] | 1 | GMTSYTQL ;SLC/JMH & ALB/ASF - MHA ADMINS ; 9/7/07 5:35pm
|
---|
| 2 | ;;2.7;Health Summary;**77**;Oct 20, 1995;Build 47
|
---|
| 3 | ;
|
---|
| 4 | ; External References
|
---|
| 5 | ; DBIA 10035 ^DPT(
|
---|
| 6 | ; DBIA 10103 $$FMTE^XLFDT
|
---|
| 7 | ; DBIA ????? ADMIN^YTQAPI5
|
---|
| 8 | ;
|
---|
| 9 | Q
|
---|
| 10 | EN ; MHA Admin list
|
---|
| 11 | N GMTS1,GMTS2,GMTSCS,GMTSCW,GMTSDAY,GMTSDTM,GMTSLO,GMTSLOC,GMTSLPG
|
---|
| 12 | N GMTSNPG,GMTSOR,GMTSQIT,GMTSTITL,GMTSX,N,GMTSDATA,GMTSGIV
|
---|
| 13 | N GMTSNDM,GMTSI,GMTSJ,GMTSNN,GMTSTN,IOM,MAX
|
---|
| 14 | K ^TMP("GMTSYTQL",$J)
|
---|
| 15 | S MAX=$S(+($G(GMTSNDM))>0:+($G(GMTSNDM)),1:9999999)
|
---|
| 16 | S:+($G(GMTSBEG))'>2700101 GMTSBEG=$$FMADD^XLFDT($P($$NOW^XLFDT,".",1),-1095,0,0,1),GMTSEND=$$FMADD^XLFDT($P($$NOW^XLFDT,".",1),1,0,0,1),GMTS2=9999999-GMTSBEG,GMTS1=9999999-GMTSEND
|
---|
| 17 | S:'$L($P(GMTSBEG,".",2)) GMTSBEG=$$FMADD^XLFDT(GMTSBEG,0,0,0,1)
|
---|
| 18 | S:+($G(GMTSEND))'>2700101!(+($G(GMTSEND))>+($$FMADD^XLFDT($P($$NOW^XLFDT,".",1),+1,0,0,2))) GMTSEND=$$FMADD^XLFDT($P($$NOW^XLFDT,".",1),1,0,0,1),GMTS1=9999999-GMTSEND
|
---|
| 19 | S:'$L($P(GMTSEND,".",2)) GMTSEND=$$FMADD^XLFDT(GMTSEND,0,0,0,1)
|
---|
| 20 | S:+($G(GMTSEND))>0&(+($G(GMTS1))=0) GMTS1=9999999-GMTSEND S:+($G(GMTSBEG))>0&(+($G(GMTS2))=0) GMTS2=9999999-GMTSBEG
|
---|
| 21 | S GMTSLO=+($G(GMTSLO)) S:GMTSLO=0 GMTSLO=3 S GMTSLPG=+($G(GMTSLPG)),GMTSDTM=$G(GMTSDTM) S:'$L(GMTSDTM) GMTSDTM=$$DTM
|
---|
| 22 | S:'$D(GMTSTITL)!('$L($G(GMTSTITL))) GMTSTITL="MHA Administrations"
|
---|
| 23 | S DFN=+($G(DFN)) Q:'$L($P($G(^DPT(DFN,0)),"^",1))
|
---|
| 24 | S GMTSCW(0)=+($G(IOM)) S:GMTSCW(0)=0 GMTSCW(0)=80
|
---|
| 25 | S GMTSCW(1)=5,GMTSCW(2)=10,GMTSCW(3)=20,GMTSCW(4)=GMTSCW(0)-(GMTSCW(1)+GMTSCW(2)+GMTSCW(3)+8)
|
---|
| 26 | S GMTSCW("L")=(GMTSCW(1)+GMTSCW(2)+GMTSCW(3)+GMTSCW(4)+6)
|
---|
| 27 | S GMTSCS(1)=1,GMTSCS(2)=GMTSCS(1)+GMTSCW(1)+2,GMTSCS(3)=GMTSCS(2)+GMTSCW(2)+2,GMTSCS(4)=GMTSCS(3)+GMTSCW(3)+2
|
---|
| 28 | D GET Q:'$D(^TMP("GMTSYTQL",$J)) D OUT
|
---|
| 29 | Q
|
---|
| 30 | OUT ; Output
|
---|
| 31 | N GMTSI,GMTSJ
|
---|
| 32 | S GMTSNN=1
|
---|
| 33 | D HDR
|
---|
| 34 | S GMTSGIV="" F S GMTSGIV=$O(^TMP("GMTSYTQL",$J,GMTSGIV)) Q:GMTSGIV'>0!(GMTSNN>MAX) S GMTSTN="" F S GMTSTN=$O(^TMP("GMTSYTQL",$J,GMTSGIV,GMTSTN)) Q:GMTSTN="" D
|
---|
| 35 | . S GMTSJ=$G(^TMP("GMTSYTQL",$J,GMTSGIV,GMTSTN))
|
---|
| 36 | . S GMTSDAY=$$ITM(GMTSGIV) S:GMTSDAY?.E1"@9".E GMTSDAY=$P(GMTSDAY,"@9")
|
---|
| 37 | . S GMTSOR=$P(GMTSJ,U,5) S:GMTSOR?1N.N GMTSOR=$$EXTERNAL^DILFD(601.84,5,,GMTSOR)
|
---|
| 38 | . S GMTSLOC=$P(GMTSJ,U,14) S:GMTSLOC?1N.N GMTSLOC=$$EXTERNAL^DILFD(601.84,13,,GMTSLOC)
|
---|
| 39 | . D LINE
|
---|
| 40 | . S GMTSNN=GMTSNN+1
|
---|
| 41 | K ^TMP("GMTSYTQL",$J)
|
---|
| 42 | Q
|
---|
| 43 | LINE ; Output One Line
|
---|
| 44 | D CKP^GMTSUP Q:$D(GMTSQIT)
|
---|
| 45 | D:GMTSNPG=1 HDR
|
---|
| 46 | W GMTSDAY
|
---|
| 47 | W ?20,$E(GMTSTN,1,20)
|
---|
| 48 | W $S($L(GMTSTN)>20:"*",1:" ")
|
---|
| 49 | W ?41,$E(GMTSOR,1,20)
|
---|
| 50 | W $S($L(GMTSOR)>20:"*",1:" ")
|
---|
| 51 | W ?61,$E(GMTSLOC,1,20)
|
---|
| 52 | W $S($L(GMTSLOC)>20:"*",1:" ")
|
---|
| 53 | W !
|
---|
| 54 | Q
|
---|
| 55 | HDR ; Header
|
---|
| 56 | N GMTSI S GMTSI="",$P(GMTSI,"-",+($G(GMTSCW("L"))))="-"
|
---|
| 57 | D CKP^GMTSUP Q:$D(GMTSQIT) G:GMTSNPG=1 HDR W "Date",?20,"Instrument",?41,"Ordered by",?61,"Location",!
|
---|
| 58 | Q
|
---|
| 59 | GET ; Get and Format Data
|
---|
| 60 | N %DT,X,Y,GMTSNN,GMTSGIV,GMTSTN
|
---|
| 61 | S GMTSNN=0
|
---|
| 62 | K ^TMP("GMTSYTQL",$J)
|
---|
| 63 | S GMTSX("DFN")=DFN,GMTSX("COMPLETE")="Y" D ADMINS^YTQAPI5(.GMTSDATA,.GMTSX)
|
---|
| 64 | Q:'$D(GMTSDATA(3))
|
---|
| 65 | S N=2 F S N=$O(GMTSDATA(N)) Q:N'>0!(GMTSNN>MAX) D
|
---|
| 66 | . S GMTSTN=$P(GMTSDATA(N),U,2) Q:GMTSTN=""
|
---|
| 67 | . S GMTSGIV=$P($G(GMTSDATA(N)),U,3) Q:GMTSGIV'?7N.E
|
---|
| 68 | . Q:GMTSGIV<GMTSBEG
|
---|
| 69 | . Q:GMTSGIV>GMTSEND
|
---|
| 70 | . S GMTSNN=GMTSNN+1
|
---|
| 71 | . S ^TMP("GMTSYTQL",$J,9999999.999999-GMTSGIV,GMTSTN)=GMTSDATA(N)
|
---|
| 72 | K GMTSDATA
|
---|
| 73 | D GAFGET
|
---|
| 74 | D ASIGET
|
---|
| 75 | Q
|
---|
| 76 | ASIGET ;
|
---|
| 77 | N G,GMTSIEN,GMTSNN,GMTSELS
|
---|
| 78 | S GMTSNN=0
|
---|
| 79 | S GMTSIEN=0
|
---|
| 80 | F S GMTSIEN=$O(^YSTX(604,"C",DFN,GMTSIEN)) Q:GMTSIEN'>0 D
|
---|
| 81 | . S G=^YSTX(604,GMTSIEN,0)
|
---|
| 82 | . S GMTSGIV=$P(G,U,12)
|
---|
| 83 | . S GMTSELS=$P($G(^YSTX(604,GMTSIEN,.5)),U)
|
---|
| 84 | . Q:GMTSELS'=1
|
---|
| 85 | . Q:GMTSGIV<GMTSBEG
|
---|
| 86 | . Q:GMTSGIV>GMTSEND
|
---|
| 87 | . S GMTSNN=GMTSNN+1
|
---|
| 88 | . S ^TMP("GMTSYTQL",$J,9999999.999999-GMTSGIV,"ASI")=GMTSIEN_"^^^^"_$P(G,U,9)
|
---|
| 89 | Q
|
---|
| 90 | GAFGET ;get axis5
|
---|
| 91 | N G,N,GMTSNN
|
---|
| 92 | S GMTSNN=0
|
---|
| 93 | S GMTSX("DFN")=DFN D GAFRET^YTQAPI6(.GMTSDATA,.GMTSX)
|
---|
| 94 | Q:'$D(GMTSDATA(2))
|
---|
| 95 | S N=1 F S N=$O(GMTSDATA(N)) Q:N'>0!(GMTSNN>MAX) D
|
---|
| 96 | . S G=GMTSDATA(N)
|
---|
| 97 | . S GMTSGIV=$P(^YSD(627.8,+G,0),U)
|
---|
| 98 | . Q:GMTSGIV<GMTSBEG
|
---|
| 99 | . Q:GMTSGIV>GMTSEND
|
---|
| 100 | . S GMTSNN=GMTSNN+1
|
---|
| 101 | . S ^TMP("GMTSYTQL",$J,9999999.999999-GMTSGIV,"GAF")=+G_"^^^^"_$P(G,U,3)
|
---|
| 102 | Q
|
---|
| 103 | ITM(X) ; Inverse date to Mental Health formats
|
---|
| 104 | S X=+($G(X)) Q:X=0 "" S X=9999999.999999-X D REGDTM^GMTSU Q X
|
---|
| 105 | DTM(X) ; Current Date and Time (External)
|
---|
| 106 | S X=$$NOW^XLFDT D REGDTM4^GMTSU Q X
|
---|