Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: GMRAPER2

GMRAPER2.m

Go to the documentation of this file.
GMRAPER2 ;HIRMFO/WAA CENTRAL ENTRY FOR REACTIONS ; 1/7/93
 ;;4.0;Adverse Reaction Tracking;;Mar 29, 1996
EN1(GMRAIEN,GMRAFILE,GMRAOUT,GMRAODT) ; ENTRY TO EDIT THE OBSERVED A/AR DATA
 ; INPUT
 ;   GMRAPIEN = THE INTERNAL ENTRY NUMBER FOR THE REACTION
 ;   GMRAFILE = THE FILE NUMBER OF THE ENTRY IE 120.9 OR 120.85
 ;    GMRAODT = THE OBSERVED DATE OF THE REACTION (OPTIONAL)
 ;OUTOUT
 ;    GMRAOUT = IF 0 USER EXITED NORMALY
 ;
 N DFN,GMRAOTH,GMRAX,GMRAY,GMRASITE,GMRANDT,GMRAREAC,GMRARECN
 N GMRARPR,GMRACHC,GMRAR10,GMRAASK,GMRADATE
 S GMRAODT=$G(GMRAODT)
 ; v--> define other entry
 D SITE^GMRAUTL S GMRAY=GMRASITE ; Get site parameters
SITE ; v--> Load predefined sign and symptoms from SITE FILE
 F GMRAX=1:1:10 D
 .S X=$S($D(^GMRD(120.84,GMRAY,1,GMRAX,0)):$P(^(0),U),1:"")
 .S Y=$S($D(^GMRD(120.83,+X,0)):^(0),1:""),GMRAR10(GMRAX)=$S(X'=""!(Y'=""):X_U_Y,1:"")
 .Q
 S GMRAOTH=$G(GMRAOTH,$O(^GMRD(120.83,"B","OTHER REACTION",0)))
 ;Process what file
 I GMRAFILE=120.8 S GMRAND=10 D PAT
 I GMRAFILE=120.85 S GMRAND=2 D ADR
 D LOAD(GMRAIEN,GMRAFILE,GMRAND)
 S GMRADATE=""
 D EN1^GMRAPER0 G:GMRAOUT EXIT
 N GMRAFLG S GMRAFLG=0
 S:'$D(^GMR(GMRAFILE,GMRAIEN,GMRAND,0)) ^(0)=$S(GMRAFILE="120.8":"^120.81P^^",1:"^120.8502P^^")
 ; v--Add S/S that are in file 120.82
 F GMRAREC=0:0 S GMRAREC=$O(GMRARAD(GMRAREC)) Q:GMRAREC'>0  S X=GMRAREC_"^^"_DUZ_U_$P(GMRARAD(GMRAREC),U,2) D ADREAC S GMRAFLG=1
 ; v--Add Other S/S Freetext
 S GMRAREC="" F GMRAX=0:0 S GMRAREC=$O(GMRAROT(GMRAREC)) Q:GMRAREC=""  S X=GMRAOTH_U_GMRAREC_U_DUZ_U_$P(GMRAROT(GMRAREC),U,2) D ADREAC S GMRAFLG=1
 ; v--Delete a S/S
 S DA(1)=GMRAIEN,DIK="^GMR("_GMRAFILE_","_DA(1)_","_GMRAND_","
 S GMRAREC=0 F  S GMRAREC=$O(GMRARDL(GMRAREC)) Q:GMRAREC'>0  S DA=0 F  S DA=$O(^GMR(GMRAFILE,DA(1),GMRAND,"B",GMRAREC,DA)) Q:DA<1  D ^DIK S GMRAFLG=1
 ; v--delete other S/S entries
 S DA(1)=GMRAIEN,DIK="^GMR("_GMRAFILE_","_DA(1)_","_GMRAND_","
 S GMRAREC="" F  S GMRAREC=$O(GMRAROTD(GMRAREC)) Q:GMRAREC=""  S DA=0 F  S DA=$O(^GMR(GMRAFILE,DA(1),GMRAND,"B",GMRAOTH,DA)) Q:DA'>0  I $D(^GMR(GMRAFILE,DA(1),GMRAND,DA,0)),$P(^(0),U,2)=GMRAREC D ^DIK S GMRAFLG=1
 I GMRAFLG D:GMRAFILE'=120.85 EN1^GMRAPTB
 Q
ADREAC ; ADD ENTRY TO SIGNS/SYMPTOMS MULTIPLE
 S GMRAZN=$P(^GMR(GMRAFILE,GMRAIEN,GMRAND,0),U,3,4),DA=$P(GMRAZN,U)+1 F DA=DA:1 Q:'$D(^GMR(GMRAFILE,GMRAIEN,GMRAND,DA,0))
 S ^GMR(GMRAFILE,GMRAIEN,GMRAND,DA,0)=X
 S DA(1)=GMRAIEN
 S DIK="^GMR("_GMRAFILE_",DA(1),"_GMRAND_","  D IX1^DIK S $P(^GMR(GMRAFILE,GMRAIEN,GMRAND,0),U,3,4)=DA_U_($P(GMRAZN,U,2)+1)
 Q
PAT ;This is to process entries in file 120.8 on the 10 mutli.
 S GMRAPA=GMRAIEN
 N DFN S DFN=$P($G(^GMR(120.8,GMRAPA,0)),U) I 'DFN W !,"BAD DATA CONTACT IRM",$C(7) S GMRAOUT=1 Q  ; Validate entry
 S GMRAPA(0)=^GMR(120.8,GMRAPA,0)
 Q
ADR ;This is to load the data in 120.85 on the 2 Multi.
 S GMRANDT=1
 S GMRAPA1=GMRAIEN
 S GMRAPA1(0)=$G(^GMR(120.85,GMRAPA1,0)) I GMRAPA1(0)="" W !,"BAD DATA CONTACT IRM",$C(7) S GMRAOUT=1 Q  ; Validate entry
 S GMRAPA=$P(GMRAPA1(0),U,15),GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0))  I GMRAPA="" W !,"BAD DATA CONTACT IRM",$C(7) S GMRAOUT=1 Q  ; Validate entry
 Q
LOAD(GMRAIEN,GMRAFILE,GMRAND) ;
 ;Load existing entries in the given file
 ;INPUT:
 ;     GMRAIEN IS THE IEN OF THE FILE THAT IS BEING EDITED
 ;     GMRAFILE IS THE FILE NUMBER
 ;     GMRAND IS THE NODE MULTI
 ;OUTPUT
 ;
 S GMRAX=0  F  S GMRAX=$O(^GMR(GMRAFILE,GMRAIEN,GMRAND,GMRAX)) Q:GMRAX<1  D
 .S Y=$S($D(^GMR(GMRAFILE,GMRAIEN,GMRAND,GMRAX,0)):^(0),1:"")
 .S X=$S(+Y=GMRAOTH:$P(Y,U,2),$D(^GMRD(120.83,+Y,0)):$P(^GMRD(120.83,+Y,0),U),1:"")
 .I X'="",Y'="" S GMRARPR(X,+Y)=X_U_$P(Y,U,3)_U_$P(Y,U,4)
 .Q
 Q
EXIT ;KILL CLEAN
 Q