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

BSTS10P1.m

Go to the documentation of this file.
  1. BSTS10P1 ;GDIT/HS/BEE-Version 1.0 Patch 1 Post (and Pre) Install ; 19 Nov 2012 9:41 AM
  1. ;;1.0;IHS STANDARD TERMINOLOGY;**1**;Sep 10, 2014;Build 7
  1. ;
  1. ENV ;EP - Environmental Checking Routine
  1. ;
  1. ;Check for Version 1.0
  1. I $$VERSION^XPDUTL("BSTS")<1 D BMES^XPDUTL("Version 1.0 of BSTS is required!") S XPDQUIT=2 Q
  1. ;
  1. ;Make sure a refresh is not running already
  1. L +^BSTS(9002318.1,0):0 E D BMES^XPDUTL("A Local BSTS Cache Refresh is Already Running. Please Try Later") S XPDQUIT=2 Q
  1. L -^BSTS(9002318.1,0)
  1. ;
  1. ;Make sure an ICD9 to SNOMED compile isn't running
  1. L +^TMP("BSTSICD2SMD"):0 E D BMES^XPDUTL("An ICD9 to SNOMED Background Compile is Running. Please Try later") S XPDQUIT=2 Q
  1. L -^TMP("BSTSICD2SMD")
  1. ;
  1. ;Make sure another install isn't running
  1. L +^TMP("BSTSINSTALL"):3 E D BMES^XPDUTL("A BSTS Install is Already Running") S XPDQUIT=2 Q
  1. L -^TMP("BSTSINSTALL")
  1. ;
  1. Q
  1. ;
  1. EN ;EP - Patch 1 post installation process front end
  1. ;
  1. ;Adapted from Lori's APCDPLFH routine which will run on 10/1/15 and convert ICD9
  1. ;entries to ICD10 entries in the problem and family history files. Due to incorrect
  1. ;mappings delivered with BSTS v1.0, problem and family history entries may have
  1. ;incorrect ICD9 values. This conversion will look at each file entry, pull the correct
  1. ;ICD9 value from BSTS and use that instead.
  1. ;
  1. NEW APCDX
  1. ;
  1. ;Do not perform conversion if after 9/30/2015
  1. I DT>3150930 G EN1
  1. ;
  1. S APCDX=0
  1. F S APCDX=$O(^AUPNPROB(APCDX)) Q:APCDX'=+APCDX D
  1. . NEW APCDCI,APCDICDS,APCDO01,APCDOA,X,Y,APCDN01,APCDNA,APCDLOGE
  1. . NEW APCDZ,APCDFNUM,APCDNODE,APCDY
  1. . Q:'$D(^AUPNPROB(APCDX,0))
  1. . S APCDCI=$P($G(^AUPNPROB(APCDX,800)),U) ;only snomed coded problems
  1. . Q:APCDCI=""
  1. . Q:$P(^AUPNPROB(APCDX,0),U,12)="D" ;SKIP DELETED PROBLEMS
  1. . S APCDICDS=$P($$CONC^BSTSAPI(APCDCI_"^^^1"),U,5) ;ALL ICD CODES
  1. . S APCDO01=$P(^AUPNPROB(APCDX,0),U,1) ;old .01
  1. . S APCDOA="" ;old additional, ":" delimited
  1. . S X=0 F S X=$O(^AUPNPROB(APCDX,12,X)) Q:X'=+X D
  1. .. S Y=$P($G(^AUPNPROB(APCDX,12,X,0)),U)
  1. .. Q:'Y
  1. .. S Y=$P($$ICDDX^ICDCODE(Y),U,2)
  1. .. S APCDOA=APCDOA_Y_":"
  1. . ;update PROBLEM entry
  1. . S APCDN01=$P(APCDICDS,";")
  1. . I APCDN01="" S APCDN01=".9999" ;Default to .9999 if no map
  1. . S APCDN01=+$$CODEN^ICDCODE(APCDN01,80)
  1. . I 'APCDN01 Q
  1. . I APCDN01=-1 Q ;Can't change it if it isn't in file 80
  1. . S APCDNA=$P(APCDICDS,";",2,999) ;new additional codes
  1. . ;now set AUPNPROB
  1. . K DIE,DA,DR S DA=APCDX,DR=".01////"_APCDN01,DIE="^AUPNPROB(" D ^DIE K DIE,DA,DR
  1. . ;ADDITIONAL MULTIPLE
  1. . ;DELETE OUT OLD ADDITIONAL MULTIPLE
  1. . S APCDZ=0 F S APCDZ=$O(^AUPNPROB(APCDX,12,APCDZ)) Q:APCDZ'=+APCDZ D
  1. .. NEW DIE,DA,DR
  1. .. S DIE="^AUPNPROB("_APCDX_",12,",DA=APCDZ,DA(1)=APCDX,DR=".01///@" D ^DIE
  1. . ;SET 12 NODES
  1. . S APCDFNUM=9000011.12
  1. . S APCDNODE=12
  1. . F APCDZ=1:1 S APCDY=$P(APCDNA,";",APCDZ) Q:APCDY="" D
  1. .. NEW APCDP,APCDFDA,ERR
  1. .. S APCDP=+$$CODEN^ICDCODE(APCDY,80)
  1. ..Q:'APCDP
  1. ..Q:APCDP=-1
  1. ..S APCDFDA(APCDFNUM,"+2,"_APCDX_",",.01)=APCDP
  1. ..D UPDATE^DIE("","APCDFDA","","ERR")
  1. ;
  1. FH ;
  1. S APCDX=0
  1. F S APCDX=$O(^AUPNFH(APCDX)) Q:APCDX'=+APCDX D
  1. . NEW APCDCI,APCDICDS,APCDO01,APCDOA,X,Y,APCDN01,APCDNA,APCDLOGE
  1. . NEW APCDZ,APCDFNUM,APCDY
  1. . Q:'$D(^AUPNFH(APCDX,0))
  1. . S APCDCI=$P($G(^AUPNFH(APCDX,0)),U,13) ;only snomed coded fh ENTRIES
  1. . Q:APCDCI=""
  1. . S APCDICDS=$P($$CONC^BSTSAPI(APCDCI_"^^^1"),U,5) ;ALL ICD CODES
  1. . S APCDO01=$P(^AUPNFH(APCDX,0),U,1)
  1. . S APCDOA=""
  1. . S X=0 F S X=$O(^AUPNFH(APCDX,11,X)) Q:X'=+X D
  1. .. S Y=$P($G(^AUPNFH(APCDX,11,X,0)),U)
  1. .. Q:'Y
  1. .. S Y=$P($$ICDDX^ICDCODE(Y),U,2)
  1. .. S APCDOA=APCDOA_Y_":"
  1. . ;update fh entry
  1. . S APCDN01=$P(APCDICDS,";")
  1. . I APCDN01="" S APCDN01=".9999" ;Default to .9999 if no map
  1. . S APCDN01=+$$CODEN^ICDCODE(APCDN01,80)
  1. . I 'APCDN01 Q
  1. . I APCDN01=-1 Q
  1. . S APCDNA=$P(APCDICDS,";",2,999)
  1. . ;now set AUPNFH
  1. . K DIE,DA,DR S DA=APCDX,DR=".01////"_APCDN01,DIE="^AUPNFH(" D ^DIE K DIE,DA,DR
  1. . S APCDZ=0 F S APCDZ=$O(^AUPNFH(APCDX,11,APCDZ)) Q:APCDZ'=+APCDZ D
  1. .. S DIE="^AUPNFH("_APCDX_",11,",DA=APCDZ,DA(1)=APCDX,DR=".01///@" D ^DIE K DIE,DA,DR
  1. . ;SET 11 NODES
  1. . S APCDFNUM=9000014.11
  1. . F APCDZ=1:1 S APCDY=$P(APCDNA,";",APCDZ) Q:APCDY="" D
  1. .. NEW APCDP,APCDFDA,ERR
  1. .. S APCDP=+$$CODEN^ICDCODE(APCDY,80)
  1. .. Q:'APCDP
  1. .. Q:APCDP=-1
  1. .. S APCDFDA(APCDFNUM,"+2,"_APCDX_",",.01)=APCDP
  1. .. D UPDATE^DIE("","APCDFDA","","ERR")
  1. ;
  1. ;Unlock installation entry
  1. EN1 L -^TMP("BSTSINSTALL")
  1. ;
  1. ;Clear out the ICD9 to SNOMED JOB flag and kick off process
  1. D
  1. . NEW BSTSUPD,ERR,NMIEN
  1. . ;
  1. . ;Make sure we have a codeset (namespace)
  1. . S NMIEN=$O(^BSTS(9002318.1,"B",36,"")) Q:NMIEN=""
  1. . S BSTSUPD(9002318.1,NMIEN_",",.09)="@"
  1. . D FILE^DIE("","BSTSUPD","ERR")
  1. . Q:$D(ERR)
  1. . ;
  1. . ;Kick off the background process
  1. . D PLOAD^BSTSUTIL(NMIEN)
  1. ;
  1. Q
  1. ;
  1. PRE ;Pre-Install Front End
  1. ;
  1. NEW DIU,WSIEN
  1. ;
  1. ;Perform Lock so only one install can run and DTS calls will be switched to local
  1. L +^TMP("BSTSINSTALL"):3 E W !!,"A BSTS Install is Already Running - Aborting Installation" H 10 S XPDABORT=1 Q
  1. ;
  1. ;Check Web Service entries - convert old ports to new ports
  1. NEW WSIEN,APCDX,STS
  1. ;
  1. S WSIEN=0 F S WSIEN=$O(^BSTS(9002318.2,WSIEN)) Q:'WSIEN D
  1. . NEW URL,PORT,NWPORT
  1. . ;
  1. . ;Get the port - Quit it old DITDTS1 or Production port not found
  1. . S PORT=$$GET1^DIQ(9002318.2,WSIEN_",",.03,"E") Q:PORT=""
  1. . I PORT'=443,PORT'=8080 Q
  1. . S NWPORT=PORT
  1. . ;
  1. . ;Get URL - If Production or DITDTS1 change the port
  1. . S URL=$$GET1^DIQ(9002318.2,WSIEN_",",.02,"E")
  1. . I $$LOW^XLFSTR(URL)="https://dtsservices.ihs.gov" S NWPORT=444
  1. . I $$LOW^XLFSTR(URL)="http://ditdts1" S NWPORT=8081
  1. . ;
  1. . ;Update the port
  1. . I NWPORT'=PORT D
  1. .. NEW BSTSUPD,ERR
  1. .. S BSTSUPD(9002318.2,WSIEN_",",.03)=NWPORT
  1. .. D FILE^DIE("","BSTSUPD","ERR")
  1. ;
  1. ;Perform version check - to see if DTS works with the possible new ports
  1. S STS=$$VERSIONS^BSTSAPI("VAR",36)
  1. I +STS'=2 D W !!,"DTS is not working properly. Please contact the BSTS Support Group - Aborting Installation" H 10 S XPDABORT=1 L -^TMP("BSTSINSTALL") Q
  1. . ;
  1. . ;Allow logins again
  1. . NEW LIEN,LOG,ERR
  1. . S LIEN=$O(^%ZIS(14.5,0)) Q:'+LIEN
  1. . S LOG(14.5,LIEN_",",1)="N"
  1. . D FILE^DIE("","LOG","ERR")
  1. ;
  1. ;Clear out existing entries
  1. S DIU="^BSTS(9002318.1,",DIU(0)="DST" D EN^DIU2
  1. S DIU="^BSTS(9002318.3,",DIU(0)="DST" D EN^DIU2
  1. S DIU="^BSTS(9002318.4,",DIU(0)="DST" D EN^DIU2
  1. Q