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

BDW10P5.m

Go to the documentation of this file.
BDW10P5 ;ihs/cmi/maw - BDW Patch 5
 ;;1.0;IHS DATA WAREHOUSE;**5**;MAY 28, 2018;Build 32
 ;
ENV ;-- environment check
 I '$$INSTALLD("GIS*3.01*16") D SORRY(2)
 I '$$INSTALLD("BDW*1.0*4") D SORRY(2)
 I '$$INSTALLD("AG*7.1*13") D SORRY(2)
 Q
 ;
INSTALLD(BDGSTAL) ;EP - Determine if patch BDGSTAL was installed, where
 ; BDGSTAL is the name of the INSTALL.  E.g "AG*6.0*11".
 ;
 NEW BDGY,DIC,X,Y
 S X=$P(BDGSTAL,"*",1)
 S DIC="^DIC(9.4,",DIC(0)="FM",D="C"
 D IX^DIC
 I Y<1 D IMES Q 0
 S DIC=DIC_+Y_",22,",X=$P(BDGSTAL,"*",2)
 D ^DIC
 I Y<1 D IMES Q 0
 I $P(BDGSTAL,"*",3)="" D IMES Q 1
 S DIC=DIC_+Y_",""PAH"",",X=$P(BDGSTAL,"*",3)
 D ^DIC
 S BDGY=Y
 D IMES
 Q $S(BDGY<1:0,1:1)
IMES ;
 D MES^XPDUTL($$CJ^XLFSTR("Patch """_BDGSTAL_""" is"_$S(Y<1:" *NOT*",1:"")_" Present.",IOM))
 Q
SORRY(X) ;
 KILL DIFQ
 I X=3 S XPDQUIT=2 Q
 S XPDQUIT=X
 W *7,!,$$CJ^XLFSTR("Sorry....FIX IT!",IOM)
 Q
 ;
POST ;post init
 N BDWST
 S BDWST=$O(^BDWSITE("B",DUZ(2),0))
 I '$G(^BDWSITE(BDWST,9999999)) D RXPORT
 Q:$O(^INTHL7S("B","HL IHS DW1ALPMR OBX IFC",0))  ;segment already there dont add again
 S KFM="K DIE,DR,DIC,DA,DD,DO,DIK"
 D ADDFLD
 D ADDSEG
 D ADDFSEG
 D ADDIFC
 K KFM
 Q
 ;
ADDFLD ;-- add fields to INTHL7F
 N I,FLD01,FLD02,FLD03,FLD3,FLD5,ADD
 F I="HL IHS DW1ALPMR OBX IFC-1","HL IHS DW1ALPMR OBX IFC-2","HL IHS DW1ALPMR OBX IFC-5" D
 . S FLD01=I
 . S FLD02="STRING"
 . S FLD03=999
 . S FLD3="@BDW1IFC"_$P(I,"-",2)
 . S FLD5=""
 . S ADD=$$CHKF^INMPORT(FLD01,FLD02,FLD03,FLD3,FLD5)
 Q
 ;
ADDSEG ;-- add the segment
 N SEG
 S SEG="HL IHS DW1ALPMR OBX IFC"
 S SEGADD=$$CHKS^INMPORT(SEG,"OBX")
 Q
 ;
ADDFSEG ;-- add the fields to the segment
 N J,SEGI,SEGA
 S SEGI=$O(^INTHL7S("B","HL IHS DW1ALPMR OBX IFC",0))
 Q:'SEGI
 F J="HL IHS DW1ALPMR OBX IFC-1","HL IHS DW1ALPMR OBX IFC-2","HL IHS DW1ALPMR OBX IFC-5" D
 . S SEGA=$$SFADD^INMPORT(SEGI,J,$P(J,"-",2),"")
 Q
 ;
ADDIFC  ;-add the ifc segment to the message
 N MESS,SEG
 S MESS=$O(^INTHL7M("B","HL IHS DW1 A08",0))
 Q:'MESS
 S SEG=$O(^INTHL7S("B","HL IHS DW1ALPMR OBX IFC",0))
 Q:'SEG
 Q:$O(^INTHL7M(MESS,1,"B",SEG,0))
 N FDA,FIENS,FERR
 S FIENS="+2,"_MESS_","
 S FDA(4011.01,FIENS,.01)=SEG
 S FDA(4011.01,FIENS,.02)=230
 S FDA(4011.01,FIENS,.03)=1
 S FDA(4011.01,FIENS,.07)="P"
 S FDA(4011.01,FIENS,.12)="IFC"
 D UPDATE^DIE("","FDA","FIENS","FERR(1)")
 D COMPILE^BHLU(MESS)
 Q
 ;
RXPORT ;-- mark IFC for export
 N RDA,RIEN,ST
 S RDA=3150430.9999 F  S RDA=$O(^AUPNVSIT("B",RDA)) Q:'RDA  D
 . S RIEN=0 F  S RIEN=$O(^AUPNVSIT("B",RDA,RIEN)) Q:'RIEN  D
 .. Q:'$O(^AUPNVIF("AD",RIEN,0))
 .. S ^AUPNVSIT("ADWO",DT,RIEN)=""
 S ST=$O(^BDWSITE("B",DUZ(2),0))
 Q:'ST
 S ^BDWSITE(ST,9999999)=1
 Q
 ;