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

GMRAY36.m

Go to the documentation of this file.
  1. GMRAY36 ;SLC/DAN Post-install for patch 36 ;2/1/07 13:46
  1. ;;4.0;Adverse Reaction Tracking;**36**;Mar 29, 1996;Build 9
  1. ;DBIA SECTION
  1. ;10063 - %ZTLOAD
  1. ; 3744 - $$TESTPAT^VADPT
  1. ;10018 - DIE
  1. ;10103 - XLFDT
  1. ;10070 - XMD
  1. ;10141 - XPDUTL
  1. ; 4631 - $$SCREEN^XTID
  1. ;
  1. Q ;Entry point to queue process during install
  1. N ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSK
  1. S ZTRTN="DQ^GMRAY36",ZTDESC="GMRA*4*36 POST INSTALL ROUTINE",ZTIO="",ZTDTH=$H
  1. D ^%ZTLOAD I '$G(ZTSK) D BMES^XPDUTL("POST INSTALL NOT QUEUED - RUN DQ^GMRA36 AFTER INSTALL FINISHES") Q
  1. D BMES^XPDUTL("Post-install queued as task # "_$G(ZTSK))
  1. Q
  1. ;
  1. DQ ;Dequeue
  1. N FIX,FTBP
  1. D ^GMRAY36A ;Set up new style xref in file 120.82
  1. D POST,MAIL
  1. Q
  1. ;
  1. POST ;Post-install for patch 36
  1. N IEN,GMRA0,DIE,DA,DR,DFN,GMRAFT
  1. S GMRAFT=$O(^GMRD(120.82,"B","OTHER ALLERGY/ADVERSE REACTION",0))
  1. S IEN=0 F S IEN=$O(^GMR(120.8,IEN)) Q:'+IEN D
  1. .S GMRA0=$G(^GMR(120.8,IEN,0)) ;Set GMRA0 to zero node
  1. .Q:GMRA0="" ;Quit if no zero node
  1. .Q:+$G(^GMR(120.8,IEN,"ER")) ;Quit if entered in error
  1. .S DFN=$P(GMRA0,U) Q:'+DFN ;Quit if no patient identifier
  1. .Q:$$TESTPAT^VADPT(DFN) ;Quit if test patient
  1. .Q:$$DECEASED^GMRAFX(DFN) ;Quit if patient is deceased
  1. .I $P(GMRA0,U,3)=(GMRAFT_";GMRD(120.82,") S FTBP=$G(FTBP)+1 ;Count existing free text entries
  1. .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
  1. .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
  1. .I $P(GMRA0,U,3)["PSDRUG" D FILE50 ;If file 50 check for ing/drug class
  1. .I $D(^GMR(120.8,IEN,10)) D CHKSIGNS ;If reactions exist check for semi-colons in free text entries
  1. Q
  1. ;
  1. MAIL ;Send message indicating post install is finished
  1. N XMSUB,XMTEXT,XMDUZ,XMY,XMZ,GMRATXT
  1. S XMDUZ="PATCH GMRA*4*36 POST-INSTALL",XMY(.5)="" S:$G(DUZ) XMY(DUZ)=""
  1. S XMY("DAVID.NABER@DOMAIN.EXT")="",XMY("CATHERINE.HOANG2@DOMAIN.EXT")="",XMY("THOMAS.CAMPBELL2@DOMAIN.EXT")="",XMY("HULET.LEE_ANN@DOMAIN.EXT")=""
  1. S XMY("VHAOIHSITESHDRIM@DOMAIN.EXT")=""
  1. S GMRATXT(1)="The post-install routine for patch GMRA*4*36"
  1. S GMRATXT(2)="finished on "_$$FMTE^XLFDT($$NOW^XLFDT)_"."
  1. S GMRATXT(3)=""
  1. S GMRATXT(4)="Number of free text entries before patch 36 : "_+$G(FTBP)
  1. S GMRATXT(5)="Allergies converted to free text by patch 36 : "_+$G(FIX)
  1. S GMRATXT(6)="Total number of free text allergies at site : "_($G(FTBP)+$G(FIX))
  1. S GMRATXT(7)=""
  1. S GMRATXT(8)="Please note that patch GMRA*4*29, when installed, will automatically"
  1. 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."
  1. S XMTEXT="GMRATXT(",XMSUB="PATCH GMRA*4*36 Post Install COMPLETED"
  1. D ^XMD
  1. Q
  1. ;
  1. INACT ;If 120.82 is inactive then convert 120.8 entry to free text
  1. N DA,DIE,DR,GMRAAR,COM
  1. Q:'$$SCREEN^XTID(120.82,,(+$P(GMRA0,U,3)_",")) ;Stop if term is active
  1. S GMRAAR=GMRAFT_";GMRD(120.82,"
  1. S DA=IEN,DIE=120.8,DR="1////^S X=GMRAAR" D ^DIE
  1. S FIX=$G(FIX)+1 ;Increment counter
  1. 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)
  1. Q
  1. ;
  1. TYPENAME ;Synch up allergy type
  1. N DA,DIE,DR
  1. Q:$$SCREEN^XTID(120.82,,(+$P(GMRA0,U,3)_",")) ;Stop if term is inactive
  1. 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)
  1. 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)
  1. I $D(DR) S DIE=120.8,DA=IEN D ^DIE
  1. Q
  1. ;
  1. FILE50 ;Update to free text if no ing/drug class on file
  1. N DA,DIE,DR,GMRAAR,COM
  1. I '$O(^GMR(120.8,IEN,2,0))&('$O(^GMR(120.8,IEN,3,0))) D
  1. .S GMRAAR=GMRAFT_";GMRD(120.82,"
  1. .S DIE=120.8,DA=IEN,DR="1////^S X=GMRAAR" D ^DIE
  1. .S FIX=$G(FIX)+1
  1. .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)
  1. Q
  1. ;
  1. CHKSIGNS ;Check free text reactions for semicolons. If present substitute a comma to avoid display problems
  1. N SUB,NAME,DR,DA,DIE
  1. S SUB=0 F S SUB=$O(^GMR(120.8,IEN,10,SUB)) Q:'+SUB D
  1. .I $P($G(^GMR(120.8,IEN,10,SUB,0)),U,2)[";" D
  1. ..S NAME=$TR($P(^(0),U,2),";",",") ;Replace ; with , naked reference to above line
  1. ..S DA(1)=IEN,DA=SUB,DIE="^GMR(120.8,DA(1),10,",DR="1////"_NAME D ^DIE
  1. Q