VistA-WorldVistAEHR/r/HEALTH_SUMMARY-GMTS/GMTSRAI.m

51 lines
2.3 KiB
Mathematica

GMTSRAI ; SLC/JER,KER - Radiology Impression Comp ; 09/21/2001
;;2.7;Health Summary;**28,37,47**;Oct 20, 1995
;
; External References
; DBIA 3125 ^RADPT( file 70
; DBIA 2056 $$GET1^DIQ (file 70)
; DBIA 10011 ^DIWP
;
ENSRA ; Controls branching
Q:+($G(DFN))=0 Q:+($G(DFN))'=+($$RP(+($G(DFN))))
K ^TMP("RAE",$J)
N GMDATA,GMTSCP D MAIN^GMTSRAE(1) Q:'$D(^TMP("RAE",$J))
D LOOP K ^TMP("RAE",$J)
Q
LOOP ; Loops through ^TMP("RAE",$J,
N GMTSIDT,GMTSPN,GMTSPC S (GMTSIDT,GMTSPC)=0 F S GMTSIDT=$O(^TMP("RAE",$J,GMTSIDT)) Q:GMTSIDT'>0 D Q:$D(GMTSQIT)
. S GMTSPN=0 F S GMTSPN=$O(^TMP("RAE",$J,GMTSIDT,GMTSPN)) Q:GMTSPN'>0 D WRT Q:$D(GMTSQIT)
Q
WRT ; Writes component data
Q:$D(GMTSQIT) N X,GMTSEDT S GMDATA=1,X=+^TMP("RAE",$J,GMTSIDT,GMTSPN,0) D REGDT4^GMTSU S GMTSEDT=X
D HD S GMTSPC=+($G(GMTSCP))+1 Q:$D(GMTSQIT) D HD Q:$D(GMTSQIT) W GMTSEDT D PRO,IMP Q
Q
PRO ; Procedure
N GMTSPRO,GMTSEST,GMTSTA,GMTSCPT,GMTSI,GMTSCN
S GMTSPRO=$P(^TMP("RAE",$J,GMTSIDT,GMTSPN,0),"^",2),GMTSEST=$P(^(0),"^",3),GMTSTA=$P(^(0),"^",4),GMTSCPT=$P(^(0),"^",7),GMTSCN=$P(^(0),"^",9)
S GMTSTA=$S(GMTSTA="RELEASED/NOT VERIFIED":"REL/NOT VER",GMTSTA="PROBLEM DRAFT":"PROB DRAFT",1:GMTSTA)
S GMTSTA=$S(GMTSEST["CANCEL":"CANCELLED",1:GMTSTA)
S GMTSTA=$$EN2^GMTSUMX(GMTSTA)
I $L(GMTSPRO)>31 S GMTSPRO=$$WRAP^GMTSORC(GMTSPRO,31)
D HD Q:$D(GMTSQIT)
W ?12,$P(GMTSPRO,"|"),?46,GMTSCPT,?52,$E(GMTSTA,1,11),?64,$G(GMTSCN),!
F GMTSI=2:1:$L(GMTSPRO,"|") D Q:$D(GMTSQIT)
. D HD Q:$D(GMTSQIT) W:$P(GMTSPRO,"|",GMTSI)]"" ?14,$P(GMTSPRO,"|",GMTSI),!
Q
IMP ; Impression
Q:$D(GMTSQIT) N GMTSI,GMTST,DIWF,DIWL,DIWR
S GMTST=12 Q:'$D(^TMP("RAE",$J,GMTSIDT,GMTSPN,"I")) K ^UTILITY($J,"W")
S DIWF="C"_(78-GMTST),DIWL=0,DIWR=0,GMTSI=0
F S GMTSI=$O(^TMP("RAE",$J,GMTSIDT,GMTSPN,"I",GMTSI)) Q:+GMTSI=0 D Q:$D(GMTSQIT)
. S X=$G(^TMP("RAE",$J,GMTSIDT,GMTSPN,"I",GMTSI)) D ^DIWP
S GMTSI=0 F S GMTSI=$O(^UTILITY($J,"W",0,GMTSI)) Q:+GMTSI=0 D Q:$D(GMTSQIT)
. D HD Q:$D(GMTSQIT) W ?GMTST,$G(^UTILITY($J,"W",0,GMTSI,0)),!
K ^UTILITY($J,"W")
Q
HD ; Header/Page Check
Q:$D(GMTSQIT) D CKP^GMTSUP Q:$D(GMTSQIT) Q:+($G(GMTSNPG))=0&(+($G(GMTSPC))>0)
W "Date",?12,"Procedure",?46,"CPT",?52,"Status",?64,"Case #",!
Q
RP(X) ; Radiology Patient
N Y S X=+($G(X)) S Y=$$GET1^DIQ(70,X,.01,"I") S X=Y Q X