source: WorldVistAEHR/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRAXNKA.m@ 1361

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

initial load of WorldVistAEHR

File size: 2.6 KB
RevLine 
[613]1GMRAXNKA ;HIRMFO/WAA- No Known Allergies Conversion ; 8/27/93
2 ;;4.0;Adverse Reaction Tracking;;Mar 29, 1996
3EN1 ; Data conversion of Patient Allergies file from v3.0 -> v4.0
4 ; This conversion does two things:
5 ; 1) Moves those records which represent whether a patient
6 ; has been asked about allergies (NKA nodes) from the
7 ; Patient Allergies (120.8) to Adverse Reaction Assessment
8 ; (120.86) file.
9 ; 2) Converts the set of codes of Comment Type (1.5) sub-field
10 ; of the Comments (26) field from old values to new values.
11 ; Old New
12 ; --- ---
13 ; y V
14 ; n O
15 ;
16 K GMRATXT S GMRATXT(1)="Move 120.8 NKA Cross Reference to 120.86...." D BMES^XPDUTL(.GMRATXT) K GMRATXT
17 S GMRAPA=0 F S GMRAPA=$O(^GMR(120.8,GMRAPA)) Q:GMRAPA'>0 D
18 . S GMRAPA(0)=$G(^GMR(120.8,GMRAPA,0)) Q:GMRAPA(0)=""
19 . S GMAYN=$P(GMRAPA(0),U,22)
20 . I $L($P(GMRAPA(0),U,2)) D ; convert comments.
21 . . D COMMENTS(GMRAPA)
22 . . Q
23 . E I GMAYN'="" D ; Move NKA entry out of file 120.8
24 . . D NKA(.GMRAPA)
25 . . Q
26 . Q
27 S DA(1)=120.8,DA=.03,DIK="^DD("_DA(1)_"," D ^DIK ; delete .03 field.
28 K ^GMR(120.8,"ANKA") ; Kill off any remaining "ANKA" xrefs.
29 Q
30NKA(GMAPA) ; Move No Known Allergies field from 120.8 file to 120.86 file.
31 G:+$G(^GMR(120.8,GMAPA,"ER")) ERR ; if node E/E don't move to 120.86
32 N DFN,GMAYNN,GMAX
33 S DFN=$P(GMAPA(0),U) G:DFN'>0 ERR ; if no patient, dont move to 120.86
34 I '$D(^GMR(120.86,DFN,0)) D ; Add a new 120.86 file entry.
35 . S GMAX=$G(^GMR(120.86,0)) S:GMAX="" GMAX="ADVERSE REACTION ASSESSMENT^120.86P^0^0"
36 . S $P(GMAX,U,3,4)=$S(DFN>$P(GMAX,U,3):DFN,1:$P(GMAX,U,3))_U_($P(GMAX,U,4)+1)
37 . S ^GMR(120.86,DFN,0)=DFN
38 . S DIK="^GMR(120.86,",DA=DFN D IX1^DIK
39 . S ^GMR(120.86,0)=GMAX
40 . Q
41 S GMAYNN=$P($G(^GMR(120.86,DFN,0)),U,2),GMAYN=$P(GMAPA(0),U,22)
42 I GMAYNN'="y",GMAYNN=""!(GMAYNN="n"&(GMAYN="y")) D ; update file 120.86
43 . N GMRAYN S GMRAYN=$S($P(GMAPA(0),U,22)="y":"1",1:"0")
44 . S DR="1////"_GMRAYN_";2////"_$P(GMAPA(0),U,5)_";3////"_$P(GMAPA(0),U,4)
45 . S DIE="^GMR(120.86," D ^DIE
46 . Q
47ERR ; jump here if this NKA node was entered in error, or no patient found
48 S DIK="^GMR(120.8,",DA=GMAPA D ^DIK ; delete old entry
49 W:'$D(ZTQUEUED)&'$R(100) "."
50 Q
51COMMENTS(GMAPA) ; Convert comments
52 Q:'$D(^GMR(120.8,GMAPA,26,0)) ; no comments to convert
53 N GMAPC,GMAX,GMAY,GMAZ
54 S GMAPC=0 F S GMAPC=$O(^GMR(120.8,GMAPA,26,GMAPC)) Q:GMAPC<1 D
55 .S GMAY=$G(^GMR(120.8,GMAPA,26,GMAPC,0)) Q:GMAY=""
56 .S GMAX=$P(GMAY,U,3) Q:"^y^n^"'[(U_GMAX_U)
57 .S GMAZ=$S(GMAX="y":"V",1:"O")
58 .S DA(1)=GMAPA,DA=GMAPC,DIE="^GMR(120.8,"_DA(1)_",26,",DR="1.5////"_GMAZ
59 .D ^DIE W:'$D(ZTQUEUED)&'$R(50) "."
60 .Q
61 Q
Note: See TracBrowser for help on using the repository browser.