source: WorldVistAEHR/trunk/r/HEALTH_SUMMARY-GMTS/GMTSPDX.m@ 1211

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

initial load of WorldVistAEHR

File size: 5.0 KB
Line 
1GMTSPDX ;SLC/JER,SBW - PDX Health Summary Driver ; 08/27/2002
2 ;;2.7;Health Summary;56;Oct 20, 1995
3 ;
4 ; External References
5 ; DBIA 298 ^VAT(394.61
6 ; DBIA 820 ^VAT(394.71
7 ; DBIA 819 $$ENCDSP^VAQHSH
8 ; DBIA 818 $$NCRYPTON^VAQUTL2
9 ; DBIA 817 $$TRANENC^VAQUTL3
10 ; DBIA 3587 ^XMB(3.51
11 ; DBIA 2056 $$GET1^DIQ (file 3.51)
12 ; DBIA 3588 ^XMBS(3.519
13 ; DBIA 999 ^DD(142.99
14 ; DBIA 10035 ^DPT(
15 ; DBIA 10086 ^%ZIS
16 ; DBIA 10089 ^%ZISC
17 ; DBIA 10004 Y^DIQ
18 ; DBIA 1092 DSD^ZISPL
19 ; DBIA 1092 DSDOC^ZISPL
20 ;
21GET(TRAN,DFN,SEGPTR,ROOT,GMTSLCNT,GMTSDLM,GMTSNDM) ; Get HS for PDX
22 ;
23 ; Data retrieved from HS is return in ROOT parameter
24 ; reference passing. Function returns 2 piece
25 ; variable delimited with "^".
26 ;
27 ; Piece 1 = tot line cnt of data extract to ROOT.
28 ; Piece 2 = contains entry line cnt (GMTSLCNT) + Piece 1
29 ;
30 ; Note: Currently Data begins with GMTSLCNT + 1 and
31 ; Piece 2 is last node # of ROOT
32 ;
33 ; If TRAN is passed
34 ; The patient pointer of the transaction will be used
35 ; Encryption will be based on the transaction
36 ;
37 ; If DFN is passed
38 ; Encryption will be based on the site parameter
39 ;
40 ; Pointer to transaction takes precedence over DFN ... if
41 ; TRAN>0 the DFN will be based on the transaction
42 ;
43 ; Determin true DFN
44 S TRAN=+$G(TRAN),DFN=+$G(DFN)
45 Q:(('TRAN)&('DFN)) "-1^Did not pass pointer to transaction or patient"
46 I (TRAN) Q:('$D(^VAT(394.61,TRAN))) "-1^Did not pass valid pointer to VAQ - TRANSACTION file"
47 I (TRAN) S DFN=+$P($G(^VAT(394.61,TRAN,0)),"^",3) Q:('DFN) "-1^Transaction did not contain pointer to PATIENT file"
48 Q:('$D(^DPT(DFN))) "-1^Did not pass valid pointer to PATIENT file"
49 ; NEW variables not cleaned up by %ZIS SPOOLER call
50 N C,D0,DA,DI,DIE,DIC,DQ,DR,GMTS,GMTS1,GMTS2,GMTSAGE,GMTSDOB,GMTSDTM
51 N GMTSDUZ,GMTSLO,GMTSLPG,GMTSPNM,GMTSRB,GMTSSN,GMTSSPL,GMTSWARD,GMTSY
52 N SEX,SPLDOC,VADM,VAERR,VAIN,X,Y,ZISIOST,LINES,INCOMP
53 N %,%X,%XX,%Y,%YY,%Z4,%ZDA,%ZS,%ZY,POP,Y,C
54 S GMTSDUZ=$G(DUZ),DUZ=.5
55 S Y=$P($G(^GMT(142.99,1,0)),U,4),C=$P(^DD(142.99,.04,0),U,2)
56 D Y^DIQ
57 S GMTSSPL=Y
58 I GMTSSPL']"" S GMTSY="-1^No Spool Device allocated" G GETX
59 ; Convert SEGPTR to entry in file 142.1
60 S X=+$P($G(^VAT(394.71,SEGPTR,0)),"^",4)
61 I ('X) S GMTSY="-1^Unable to convert PDX data segment to Health Summary component" G GETX
62 S SEGPTR=X
63 ; Determin if Component has benn disabled
64 S X=$G(^GMT(142.1,SEGPTR,0))
65 I (($P(X,"^",6)="T")!($P(X,"^",6)="P")) D G GETX
66 .S GMTSY=$P(X,"^",8)
67 .I (GMTSY'="") S GMTSY="-1^"_GMTSY Q
68 .S GMTSY="-1^Component has been disabled "
69 .S GMTSY=GMTSY_$S($P(X,"^",6)="T":"(temporary)",1:"(permanent)")
70 ; Open SPOOL Device
71 S IOP=GMTSSPL_";HSPDX"_DFN D ^%ZIS
72 I POP S GMTSY="-1^Spool open failed" G GETX
73 ; Write Component
74 D ONECOMP(DFN,SEGPTR,$G(GMTSDLM),$G(GMTSNDM))
75 S SPLDOC=$G(IO("SPOOL")) D ^%ZISC
76 I +SPLDOC D
77 . N SPLSTAT,SPLPTR,LINES,INCOMP
78 . ; Wait until document is "ready" (Check every 5 seconds)
79 . F Q:$$GET1^DIQ(3.51,(+SPLDOC_","),2,"I")="r" H 5
80 . S SPLPTR=$$GET1^DIQ(3.51,(+SPLDOC_","),9,"I")
81 . S LINES=$$GET1^DIQ(3.51,(+SPLDOC_","),8,"I")
82 . S INCOMP=+($$GET1^DIQ(3.51,(+SPLDOC_","),10,"I"))
83 . I '+SPLPTR!('+LINES) S GMTSY="-1^No data available" Q
84 . S GMTSY=$$XFER(SPLPTR,ROOT,INCOMP,+$G(GMTSLCNT))
85 . D DSDOC^ZISPL(SPLDOC),DSD^ZISPL(SPLPTR)
86 . ; Check to see if Encryption is ON
87 . S:(TRAN) X=$$TRANENC^VAQUTL3(TRAN,0)
88 . S:('TRAN) X=$$NCRYPTON^VAQUTL2(0)
89 . S:(X) X=$$ENCDSP^VAQHSH(TRAN,ROOT,X,(GMTSLCNT+1),+GMTSY)
90 E S GMTSY="-1^Spool document not created"
91GETX ; End Getting HS for PDX
92 S DUZ=+$G(GMTSDUZ)
93 Q $G(GMTSY)
94 ;
95ONECOMP(DFN,SEGPTR,GMTSDLM,GMTSNDM) ; Print a single HS component to IO
96 N GMTSEG,GMTSEGI,GMTSEGC,GMTSTITL
97 S GMTSTITL="PDX TRANSMISSION"
98 S GMTSEG(1)=1_U_SEGPTR_U_$G(GMTSNDM)_U_$G(GMTSDLM)_U_U_"N"_U_"L"_U_"Y"
99 S (GMTSEGI(SEGPTR),GMTSEGC)=1
100 D EN^GMTS1
101 Q
102 ;
103XFER(SPLDAT,ROOT,INCOMP,GMTSLCNT) ; Transfer text from SPOOL DOC to ROOT
104 N GMTSI,GMTSL,GMTSREC,GMTSPRT,GMTSX S (GMTSI,GMTSL)=0,GMTSPRT=1
105 F S GMTSI=$O(^XMBS(3.519,SPLDAT,2,GMTSI)) Q:+GMTSI'>0 D Q:$E(GMTSREC,1,7)="*** END"
106 . S GMTSREC=$G(^XMBS(3.519,SPLDAT,2,GMTSI,0))
107 . ;
108 . ; Don't transfer data until a line with 3 hyphens or
109 . ; ** DECEASED ** is found nor after "*** END" is found
110 . ;
111 . I (GMTSL=0&($E(GMTSREC,1,3)="---")!(GMTSREC["** DECEASED **"))!((GMTSL>0)&($E(GMTSREC,1,7)'="*** END")) D
112 . . I GMTSREC["|TOP|" S GMTSPRT=0
113 . . S:GMTSPRT GMTSL=GMTSL+1,GMTSLCNT=GMTSLCNT+1,@ROOT@("DISPLAY",GMTSLCNT,0)=GMTSREC
114 . . I GMTSREC["(continued)" S GMTSPRT=1
115 ; Incomplete Report Indicator
116 I +GMTSL,+($G(INCOMP)) D
117 . S GMTSL=GMTSL+1,@ROOT@("DISPLAY",GMTSL,0)="*** Data is incomplete ***"
118 ; Transfer Failed
119 I '+GMTSL S GMTSL="-1^Text transfer from Spool Document failed"
120 Q $G(GMTSL)_U_$G(GMTSLCNT)
Note: See TracBrowser for help on using the repository browser.