VistA-WorldVistAEHR/r/ADVERSE_REACTION_TRACKING-G.../GMRAGUI.m

90 lines
3.7 KiB
Mathematica

GMRAGUI ;SLC/DAN - CPRS GUI support ;12/22/04 10:16
;;4.0;Adverse Reaction Tracking;**21**;Mar 29, 1996
;
GETREC(GMRAIEN,GMRARRAY) ;
;GMRAIEN = IEN of object record from file 120.8
;GMRARRAY = array specifier ie.^TMP($J,"ART")
K @GMRARRAY
N ND,STRING,SSNODE,GMRA,GMRACA,GMRAT,GMRANOR,SSLIM,SSNUM,GMRASSI,GMRASS,GMRADT,Y,GMRAODUZ,COMFLAG,COMNUM,I
N COMMENTS,GMRACODT,GMRACDUZ,GMRACUS,PREFIX,COMLINE,IDMNOD,IDMLIM,IDMNUM,GMRAIDB,CHMNOD,CHMLIM,CHMNUM,GMRACHM,GMRAVDUZ,GMRAVYN,GMRAOBS,OBSIEN,USRNAM,USR,SEVCOD,SEVER
S ND=1
I '$D(GMRAIEN)!('+GMRAIEN) Q
S GMRA(0)=$G(^GMR(120.8,+GMRAIEN,0)) Q:'$L(GMRA(0))
S STRING="~CAUSATIVE AGENT" D NEXT
S GMRACA=$P(GMRA(0),U,2)
S STRING="d"_GMRACA D NEXT
S STRING="~ALLERGY TYPE" D NEXT
S GMRAT=$P(GMRA(0),U,20)
S STRING="d"_GMRAT_"^"_$TR($$OUTTYPE^GMRAUTL(GMRAT)," ","") D NEXT
S STRING="~NATURE OF REACTION" D NEXT
S GMRANOR=$P(GMRA(0),U,14)
S STRING="d"_GMRANOR_U_$S(GMRANOR="A":"ALLERGY",GMRANOR="R":"ADVERSE REACTION",GMRANOR="P":"PHARMACOLOGICAL",1:"UNKNOWN") D NEXT
S STRING="~SIGN/SYMPTOMS" D NEXT
S SSNODE=$G(^GMR(120.8,GMRAIEN,10,0)),SSLIM=$P(SSNODE,U,3),SSNUM=0
I SSLIM<1 G ORIG
SSLOOP S SSNUM=$O(^GMR(120.8,GMRAIEN,10,SSNUM))
I SSNUM<1!(SSNUM>SSLIM) G ORIG
S GMRASSI=$P($G(^GMR(120.8,GMRAIEN,10,SSNUM,0)),U,1),GMRASS=$P($G(^GMRD(120.83,GMRASSI,0)),U,1),GMRADT=$P($G(^GMR(120.8,GMRAIEN,10,SSNUM,0)),U,4)
S Y=$$FMTE^XLFDT(GMRADT,"D")
S STRING="i"_GMRASSI_"^"_GMRASS_"^"_GMRADT_"^ "_Y D NEXT G SSLOOP
ORIG S STRING="~ORIGINATOR" D NEXT
S GMRAODUZ=$P(GMRA(0),U,5)
S STRING="d"_GMRAODUZ_"^"_$S(GMRAODUZ:$$GET1^DIQ(200,GMRAODUZ_",",".01"),1:"") D NEXT
S STRING="~ORIGINATED" D NEXT
S STRING="d"_$P(GMRA(0),U,4) D NEXT
S COMFLAG=0,COMNUM=0
S STRING="~COMMENTS" D NEXT
S COMMENTS=$G(^GMR(120.8,GMRAIEN,26,0)) S:COMMENTS'="" COMFLAG=1
CLOOP1 I COMFLAG D ;
.S COMNUM=$O(^GMR(120.8,GMRAIEN,26,COMNUM))
.Q:COMNUM<1
.S GMRACODT=$P($G(^GMR(120.8,GMRAIEN,26,COMNUM,0)),U,1)
. S Y=$$FMTE^XLFDT(GMRACODT,"D")
. S STRING="tComment Date: "_Y
.D NEXT
.S GMRACDUZ=$P($G(^GMR(120.8,GMRAIEN,26,COMNUM,0)),U,2) S GMRACUS=$S('GMRACDUZ:"",1:$$GET1^DIQ(200,GMRACDUZ_",",".01"))
.S STRING="tEntered By : "_GMRACUS
.D NEXT
.S PREFIX="tComments : "
.S COMLINE=$O(^GMR(120.8,GMRAIEN,26,COMNUM,2,0))
CLOOP2 .D:COMLINE ;
..S STRING=PREFIX_$G(^GMR(120.8,GMRAIEN,26,COMNUM,2,COMLINE,0)) D NEXT
..S PREFIX="t "
.S COMLINE=$O(^GMR(120.8,GMRAIEN,26,COMNUM,2,COMLINE))
.I COMLINE>0 G CLOOP2
.S STRING="t"
.F I=1:1:60 S STRING=STRING_"-"
.D NEXT
I COMNUM>0 G CLOOP1
IDBM S STRING="~ID BAND MARKED" D NEXT
S IDMNOD=$G(^GMR(120.8,GMRAIEN,14,0)),IDMLIM=$P(IDMNOD,U,3),IDMNUM=0
I IDMLIM<1 G CHM
IDBLOOP S IDMNUM=$O(^GMR(120.8,GMRAIEN,14,IDMNUM))
I IDMNUM<1!(IDMNUM>IDMLIM) G CHM
S GMRAIDB=$P($G(^GMR(120.8,GMRAIEN,14,IDMNUM,0)),U,1)
S STRING="i"_GMRAIDB D NEXT G IDBLOOP
CHM S STRING="~CHART MARKED" D NEXT
S CHMNOD=$G(^GMR(120.8,GMRAIEN,13,0)),CHMLIM=$P(CHMNOD,U,3),CHMNUM=0
I CHMLIM<1 G VER
CHMLOOP S CHMNUM=$O(^GMR(120.8,GMRAIEN,13,CHMNUM))
I CHMNUM<1!(CHMNUM>CHMLIM) G VER
S GMRACHM=$P($G(^GMR(120.8,GMRAIEN,13,CHMNUM,0)),U,1)
S STRING="i"_GMRACHM D NEXT G CHMLOOP
VER S STRING="~VERIFIER" D NEXT
S GMRAVDUZ=$P(GMRA(0),U,18) I GMRAVDUZ<1 G VFD
S STRING="d"_GMRAVDUZ_"^"_$$GET1^DIQ(200,GMRAVDUZ_",",".01") D NEXT
VFD S STRING="~VERIFIED" D NEXT
S GMRAVYN=$P(GMRA(0),U,16)
S STRING="d"_$S(GMRAVYN=1:"YES",1:"NO")_"^"_$P(GMRA(0),U,17) D NEXT
ERR S STRING="~ENTERED IN ERROR" D NEXT
S STRING="d"_$S(+$G(^GMR(120.8,GMRAIEN,"ER"))=1:"YES",1:"NO") D NEXT
OBSHIST S STRING="~OBS/HIST" D NEXT
S GMRAOBS=$P(GMRA(0),U,6)
S STRING="d"_GMRAOBS_"^"_$S(GMRAOBS="o":"OBSERVED",GMRAOBS="h":"HISTORICAL",1:"") D NEXT
I GMRAOBS'="o" G EXIT
D EN1^GMRAGUI1
EXIT Q
NEXT ;SET ARRAY NODE AND INCREMENT ARRAY COUNTER
S @GMRARRAY@(ND)=STRING,ND=ND+1,STRING=""
Q