source: WorldVistAEHR/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRAPER2.m@ 1080

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

initial load of WorldVistAEHR

File size: 3.5 KB
Line 
1GMRAPER2 ;HIRMFO/WAA CENTRAL ENTRY FOR REACTIONS ; 1/7/93
2 ;;4.0;Adverse Reaction Tracking;;Mar 29, 1996
3EN1(GMRAIEN,GMRAFILE,GMRAOUT,GMRAODT) ; ENTRY TO EDIT THE OBSERVED A/AR DATA
4 ; INPUT
5 ; GMRAPIEN = THE INTERNAL ENTRY NUMBER FOR THE REACTION
6 ; GMRAFILE = THE FILE NUMBER OF THE ENTRY IE 120.9 OR 120.85
7 ; GMRAODT = THE OBSERVED DATE OF THE REACTION (OPTIONAL)
8 ;OUTOUT
9 ; GMRAOUT = IF 0 USER EXITED NORMALY
10 ;
11 N DFN,GMRAOTH,GMRAX,GMRAY,GMRASITE,GMRANDT,GMRAREAC,GMRARECN
12 N GMRARPR,GMRACHC,GMRAR10,GMRAASK,GMRADATE
13 S GMRAODT=$G(GMRAODT)
14 ; v--> define other entry
15 D SITE^GMRAUTL S GMRAY=GMRASITE ; Get site parameters
16SITE ; v--> Load predefined sign and symptoms from SITE FILE
17 F GMRAX=1:1:10 D
18 .S X=$S($D(^GMRD(120.84,GMRAY,1,GMRAX,0)):$P(^(0),U),1:"")
19 .S Y=$S($D(^GMRD(120.83,+X,0)):^(0),1:""),GMRAR10(GMRAX)=$S(X'=""!(Y'=""):X_U_Y,1:"")
20 .Q
21 S GMRAOTH=$G(GMRAOTH,$O(^GMRD(120.83,"B","OTHER REACTION",0)))
22 ;Process what file
23 I GMRAFILE=120.8 S GMRAND=10 D PAT
24 I GMRAFILE=120.85 S GMRAND=2 D ADR
25 D LOAD(GMRAIEN,GMRAFILE,GMRAND)
26 S GMRADATE=""
27 D EN1^GMRAPER0 G:GMRAOUT EXIT
28 N GMRAFLG S GMRAFLG=0
29 S:'$D(^GMR(GMRAFILE,GMRAIEN,GMRAND,0)) ^(0)=$S(GMRAFILE="120.8":"^120.81P^^",1:"^120.8502P^^")
30 ; v--Add S/S that are in file 120.82
31 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
32 ; v--Add Other S/S Freetext
33 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
34 ; v--Delete a S/S
35 S DA(1)=GMRAIEN,DIK="^GMR("_GMRAFILE_","_DA(1)_","_GMRAND_","
36 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
37 ; v--delete other S/S entries
38 S DA(1)=GMRAIEN,DIK="^GMR("_GMRAFILE_","_DA(1)_","_GMRAND_","
39 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
40 I GMRAFLG D:GMRAFILE'=120.85 EN1^GMRAPTB
41 Q
42ADREAC ; ADD ENTRY TO SIGNS/SYMPTOMS MULTIPLE
43 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))
44 S ^GMR(GMRAFILE,GMRAIEN,GMRAND,DA,0)=X
45 S DA(1)=GMRAIEN
46 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)
47 Q
48PAT ;This is to process entries in file 120.8 on the 10 mutli.
49 S GMRAPA=GMRAIEN
50 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
51 S GMRAPA(0)=^GMR(120.8,GMRAPA,0)
52 Q
53ADR ;This is to load the data in 120.85 on the 2 Multi.
54 S GMRANDT=1
55 S GMRAPA1=GMRAIEN
56 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
57 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
58 Q
59LOAD(GMRAIEN,GMRAFILE,GMRAND) ;
60 ;Load existing entries in the given file
61 ;INPUT:
62 ; GMRAIEN IS THE IEN OF THE FILE THAT IS BEING EDITED
63 ; GMRAFILE IS THE FILE NUMBER
64 ; GMRAND IS THE NODE MULTI
65 ;OUTPUT
66 ;
67 S GMRAX=0 F S GMRAX=$O(^GMR(GMRAFILE,GMRAIEN,GMRAND,GMRAX)) Q:GMRAX<1 D
68 .S Y=$S($D(^GMR(GMRAFILE,GMRAIEN,GMRAND,GMRAX,0)):^(0),1:"")
69 .S X=$S(+Y=GMRAOTH:$P(Y,U,2),$D(^GMRD(120.83,+Y,0)):$P(^GMRD(120.83,+Y,0),U),1:"")
70 .I X'="",Y'="" S GMRARPR(X,+Y)=X_U_$P(Y,U,3)_U_$P(Y,U,4)
71 .Q
72 Q
73EXIT ;KILL CLEAN
74 Q
Note: See TracBrowser for help on using the repository browser.