source: WorldVistAEHR/trunk/r/ADVERSE_REACTION_TRACKING-GMRA-GMA/GMRAY36.m@ 724

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

initial load of WorldVistAEHR

File size: 4.3 KB
RevLine 
[613]1GMRAY36 ;SLC/DAN Post-install for patch 36 ;2/1/07 13:46
2 ;;4.0;Adverse Reaction Tracking;**36**;Mar 29, 1996;Build 9
3 ;DBIA SECTION
4 ;10063 - %ZTLOAD
5 ; 3744 - $$TESTPAT^VADPT
6 ;10018 - DIE
7 ;10103 - XLFDT
8 ;10070 - XMD
9 ;10141 - XPDUTL
10 ; 4631 - $$SCREEN^XTID
11 ;
12Q ;Entry point to queue process during install
13 N ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK
14 S ZTRTN="DQ^GMRAY36",ZTDESC="GMRA*4*36 POST INSTALL ROUTINE",ZTIO="",ZTDTH=$H
15 D ^%ZTLOAD I '$G(ZTSK) D BMES^XPDUTL("POST INSTALL NOT QUEUED - RUN DQ^GMRA36 AFTER INSTALL FINISHES") Q
16 D BMES^XPDUTL("Post-install queued as task # "_$G(ZTSK))
17 Q
18 ;
19DQ ;Dequeue
20 N FIX,FTBP
21 D ^GMRAY36A ;Set up new style xref in file 120.82
22 D POST,MAIL
23 Q
24 ;
25POST ;Post-install for patch 36
26 N IEN,GMRA0,DIE,DA,DR,DFN,GMRAFT
27 S GMRAFT=$O(^GMRD(120.82,"B","OTHER ALLERGY/ADVERSE REACTION",0))
28 S IEN=0 F S IEN=$O(^GMR(120.8,IEN)) Q:'+IEN D
29 .S GMRA0=$G(^GMR(120.8,IEN,0)) ;Set GMRA0 to zero node
30 .Q:GMRA0="" ;Quit if no zero node
31 .Q:+$G(^GMR(120.8,IEN,"ER")) ;Quit if entered in error
32 .S DFN=$P(GMRA0,U) Q:'+DFN ;Quit if no patient identifier
33 .Q:$$TESTPAT^VADPT(DFN) ;Quit if test patient
34 .Q:$$DECEASED^GMRAFX(DFN) ;Quit if patient is deceased
35 .I $P(GMRA0,U,3)=(GMRAFT_";GMRD(120.82,") S FTBP=$G(FTBP)+1 ;Count existing free text entries
36 .I '+$P(GMRA0,U,12),$P(GMRA0,U,16) S DIE=120.8,DA=IEN,DR="15///1" D ^DIE ;If not signed off and verified then mark signed off
37 .I $P(GMRA0,U,3)["GMRD",+$P(GMRA0,U,3)'=GMRAFT D TYPENAME,INACT ;Check allergy type and reactant name of 120.82 entries and then check if inactive
38 .I $P(GMRA0,U,3)["PSDRUG" D FILE50 ;If file 50 check for ing/drug class
39 .I $D(^GMR(120.8,IEN,10)) D CHKSIGNS ;If reactions exist check for semi-colons in free text entries
40 Q
41 ;
42MAIL ;Send message indicating post install is finished
43 N XMSUB,XMTEXT,XMDUZ,XMY,XMZ,GMRATXT
44 S XMDUZ="PATCH GMRA*4*36 POST-INSTALL",XMY(.5)="" S:$G(DUZ) XMY(DUZ)=""
45 S XMY("DAVID.NABER@VA.GOV")="",XMY("CATHERINE.HOANG2@VA.GOV")="",XMY("THOMAS.CAMPBELL2@VA.GOV")="",XMY("HULET.LEE_ANN@FORUM.VA.GOV")=""
46 S XMY("VHAOIHSITESHDRIM@MED.VA.GOV")=""
47 S GMRATXT(1)="The post-install routine for patch GMRA*4*36"
48 S GMRATXT(2)="finished on "_$$FMTE^XLFDT($$NOW^XLFDT)_"."
49 S GMRATXT(3)=""
50 S GMRATXT(4)="Number of free text entries before patch 36 : "_+$G(FTBP)
51 S GMRATXT(5)="Allergies converted to free text by patch 36 : "_+$G(FIX)
52 S GMRATXT(6)="Total number of free text allergies at site : "_($G(FTBP)+$G(FIX))
53 S GMRATXT(7)=""
54 S GMRATXT(8)="Please note that patch GMRA*4*29, when installed, will automatically"
55 S GMRATXT(9)="convert free text entries to a standardized entry.",GMRATXT(10)="As a result, you do not need to take any action at this point."
56 S XMTEXT="GMRATXT(",XMSUB="PATCH GMRA*4*36 Post Install COMPLETED"
57 D ^XMD
58 Q
59 ;
60INACT ;If 120.82 is inactive then convert 120.8 entry to free text
61 N DA,DIE,DR,GMRAAR,COM
62 Q:'$$SCREEN^XTID(120.82,,(+$P(GMRA0,U,3)_",")) ;Stop if term is active
63 S GMRAAR=GMRAFT_";GMRD(120.82,"
64 S DA=IEN,DIE=120.8,DR="1////^S X=GMRAAR" D ^DIE
65 S FIX=$G(FIX)+1 ;Increment counter
66 S COM="Changed from "_$P($G(GMRA0),U,2)_" (File 120.82) to free text by patch GMRA*4*36" D ADCOM^GMRAFX(IEN,"O",COM)
67 Q
68 ;
69TYPENAME ;Synch up allergy type
70 N DA,DIE,DR
71 Q:$$SCREEN^XTID(120.82,,(+$P(GMRA0,U,3)_",")) ;Stop if term is inactive
72 I $P($G(^GMRD(120.82,+$P(GMRA0,U,3),0)),U,2)'=$P(GMRA0,U,20) S DR="3.1///"_$P($G(^GMRD(120.82,+$P(GMRA0,U,3),0)),U,2)
73 I $P(GMRA0,U,2)'=$P($G(^GMRD(120.82,+$P(GMRA0,U,3),0)),U) S DR=$G(DR)_$S($G(DR)'="":";",1:"")_".02////"_$P($G(^GMRD(120.82,+$P(GMRA0,U,3),0)),U)
74 I $D(DR) S DIE=120.8,DA=IEN D ^DIE
75 Q
76 ;
77FILE50 ;Update to free text if no ing/drug class on file
78 N DA,DIE,DR,GMRAAR,COM
79 I '$O(^GMR(120.8,IEN,2,0))&('$O(^GMR(120.8,IEN,3,0))) D
80 .S GMRAAR=GMRAFT_";GMRD(120.82,"
81 .S DIE=120.8,DA=IEN,DR="1////^S X=GMRAAR" D ^DIE
82 .S FIX=$G(FIX)+1
83 .S COM="Changed from "_$P($G(GMRA0),U,2)_" (File 50) to free text by patch GMRA*4*36" D ADCOM^GMRAFX(IEN,"O",COM)
84 Q
85 ;
86CHKSIGNS ;Check free text reactions for semicolons. If present substitute a comma to avoid display problems
87 N SUB,NAME,DR,DA,DIE
88 S SUB=0 F S SUB=$O(^GMR(120.8,IEN,10,SUB)) Q:'+SUB D
89 .I $P($G(^GMR(120.8,IEN,10,SUB,0)),U,2)[";" D
90 ..S NAME=$TR($P(^(0),U,2),";",",") ;Replace ; with , naked reference to above line
91 ..S DA(1)=IEN,DA=SUB,DIE="^GMR(120.8,DA(1),10,",DR="1////"_NAME D ^DIE
92 Q
Note: See TracBrowser for help on using the repository browser.