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

DVBCXFR2.m

Go to the documentation of this file.
DVBCXFR2 ;ALB/AJF-ReRoute C&P REQUESTS ; 9/30/21 3:56pm
 ;;2.7;AMIE;**193,227,250**;;Build 19
 ;Per VHA Directive 2004-038, this routine should not be modified.
 ;
 ;Copy of DVBCXFRB
 ;
EN ;file 2
 N DVBSBRCH,DVBDTYPE,CSPT
 K ^TMP("DVBCXFR",$J),L S X=^DVB(396.3,REQDA,0),DFN=$P(X,U,1)
 S X=^DPT(DFN,0),PNAM=$P(X,U,1),DOB=$P(X,U,3),SEX=$P(X,U,2),SSN=$P(X,U,9),POBC=$P(X,U,11),POBS=$P(X,U,12)
 S X=$S($D(^DPT(DFN,.11)):^(.11),1:""),ADR1=$P(X,U,1),ADR2=$P(X,U,2),ADR3=$P(X,U,3),CITY=$P(X,U,4)
 S STATE=$P(X,U,5),ZIP=$P(X,U,6),CNTY=$P(X,U,7),ZIP4=$P(X,U,12)
 S CNTY=$S($D(^DIC(5,+STATE,1,+CNTY,0)):$P(^(0),U,1),1:""),STATE=$S($D(^DIC(5,+STATE,0)):$P(^(0),U,1),1:"")
 S X=$S($D(^DPT(DFN,.13)):^(.13),1:"") S HOMPHON=$P(X,U,1),BUSPHON=$P(X,U,2)
 S X=$S($D(^DPT(DFN,.3)):^(.3),1:""),SRVCON=$P(X,U,1),SRVPCT=$P(X,U,2)
 S X=$S($D(^DPT(DFN,.31)):^(.31),1:""),CNUM=$P(X,U,3)
 S CFLOC=$$STATION^DVBAUTL1(DFN)
 S:CFLOC=-1 CFLOC=""
 S X=$S($D(^DPT(DFN,.32)):^(.32),1:""),PDSRV=$P(X,U,3),PDSRV=$S($D(^DIC(21,+PDSRV,0)):$P(^(0),U,3),1:"")
 S X=$$SVC^DVBCUTIL(DFN,"I"),SRVEDT=$P(X,U),SRVSDT=$P(X,U,2)
 S X=$$SVC^DVBCUTIL(DFN,"E"),DVBSBRCH=$P(X,U,3),DVBDTYPE=$P(X,U,4)
 S X=$S($D(^DPT(DFN,.36)):^(.36),1:""),ELIGCOD=$P(X,U,1),ELIGCOD=$S($D(^DIC(8,+ELIGCOD,0)):$P(^(0),U,9),1:"")
 S X=$S($D(^DPT(DFN,.361)):^(.361),1:""),ELIGST=$P(X,U,1),ELIGSDT=$P(X,U,2)
 S X=$S($D(^DPT(DFN,.52)):^(.52),1:""),POWSTAT=$P(X,U,5)
 S X=$S($D(^DPT(DFN,"VET")):^("VET"),1:""),VETST=$P(X,U,1)
 S X=$S($D(^DPT(DFN,"TYPE")):^("TYPE"),1:"") S TYPE=$S(X]"":$P(^DG(391,X,0),U,1),1:"")
 S ICN=$$GETICN^MPIF001(DFN),PREFAC=STN,CSPT=0
 I $D(^DGSL(38.1,DFN,0)) S CSPT=$P(^DGSL(38.1,DFN,0),U,2)
 ;
 S LINE(1)="$DEM0 "_PNAM_U_DOB_U_SEX_U_SSN_U_POBC_U_POBS_U_ICN_U_PREFAC_U_CSPT
 S LINE(2)="$DEM1 "_ADR1_U_ADR2_U_ADR3_U_CITY_U_STATE_U_CNTY_U_ZIP_U_HOMPHON_U_BUSPHON_U_ZIP4
 S LINE(3)="$ELIG "_SRVCON_U_SRVPCT_U_CFLOC_U_CNUM_U_PDSRV_U_SRVEDT_U_SRVSDT_U_ELIGCOD_U_ELIGST_U_ELIGSDT_U_POWSTAT_U_VETST_U_TYPE_U_DVBSBRCH_U_DVBDTYPE
 ;
 ;file 396.3
EN1 S X=^DVB(396.3,REQDA,0),RO=$P(X,U,3),RONAM=$P($G(^DIC(4,+RO,99)),U,1),REQDT=$P(X,U,2)
 S FEXM=$P(X,U,9),PRIO=$P(X,U,10),OTHDIS=$P(X,U,11),LREXMDT=$P(X,U,20),DMAS=$P(X,U,5)
 S X=$S($D(^DVB(396.3,REQDA,1)):^(1),1:""),CFREQ=$P(X,U,2),OTHDOC=$P(X,U,3),LREXMDT=$P(X,U,7),OTHDIS1=$P(X,U,9),OTHDIS2=$P(X,U,10)
 S CLTYP=$G(^DVB(396.3,REQDA,9,1,0)),RRDIV=$P($G(^DVB(396.3,REQDA,1)),"^",4),(SPEC,ECF)="",II=0
 I $D(^DVB(396.3,REQDA,5)) S ECF=$P(^DVB(396.3,REQDA,5),"^",3)
 I $D(^DVB(396.3,REQDA,10)) S DVBINF=^DVB(396.3,REQDA,10)
 I $D(^DVB(396.3,REQDA,8)) F  S II=$O(^DVB(396.3,REQDA,8,II)) Q:II=""!(II="B")  D
 . S SPEC=SPEC_$G(^DVB(396.3,REQDA,8,II,0))_"^"
 S LINE(4)="$REQ0 "_REQDA_U_RO_U_PRIO_U_CFLOC_U_LREXMDT_U_CFREQ_U_LREXMDT_U_RONAM_U_RDIV_U_REQDT_U_DMAS
 S LINE(5)="$ODIS "_OTHDIS_U_OTHDIS1_U_OTHDIS2
 S EXAMS="$EXAM "_EXAMS,LINE(6)=EXAMS
 S CINFO=$$SITE^VASITE,RRDT=$$NOW^XLFDT()
 S RRFIEN=$P(CINFO,"^",1),RRF=$P(CINFO,"^",2),RRFSTN=$P(CINFO,"^",3)
 S RRFD=$P(^DIC(4,RRFIEN,6),U,1)
 ; AJF ; Reroute data for MailMan message
 S RR=$$EXTERNAL^DILFD(396.55,.01,,RR)
 S LINE(7)="$RDAT "_REQDA_U_PIEN_U_RRF_U_RR_U_RD_U_INAM_U_RRDT_U_CLTYP_U_ECF_U_RRFD
 S LINE(7)=LINE(7)_U_RRFIEN_U_RRFSTN_U_STN_U_INUM_U_DVBINF
 S LINE(8)="$SPEC "_SPEC
 ;PLE ; CAPRI 1214 2507 Reroute limit $RDAT to 250 char
 I $L($G(LINE(7)))>250 D
 .S LINE(7)="$RDAT "_REQDA_U_PIEN_U_RRF_U_RR_U_""_U_INAM_U_RRDT_U_CLTYP_U_ECF_U_RRFD
 .S LINE(7)=LINE(7)_U_RRFIEN_U_RRFSTN_U_STN_U_INUM_U_DVBINF
 .S LINE(8)="$SPEC "_SPEC
 .S LINE(9)="$RDES "_RD
 ;**NOTE: RONAM is now RO NUMBER
LOAD S L=1,^TMP("DVBCXFR",$J,L,0)="$TRANSFER IN",L=L+1
 F X=1:1 Q:'$D(LINE(X))  S ^TMP("DVBCXFR",$J,L,0)=LINE(X),L=L+1
 F JI=0:0 S JI=$O(^DVB(396.3,REQDA,2,JI)) Q:JI=""  S ^TMP("DVBCXFR",$J,L,0)="$REMK "_^DVB(396.3,REQDA,2,JI,0),L=L+1
 S SITE=$P(^XMB(1,1,0),U,1),SITE1=$P(^DIC(4.2,SITE,0),U,1)
 S USERNM=$P(^VA(200,DUZ,0),U,1),^TMP("DVBCXFR",$J,L,0)="$USER "_USERNM_U_SITE_U_SITE1,L=L+1
 S ^TMP("DVBCXFR",$J,L,0)="$END "
 N XMNODE
 S XMNODE=0
 F X=(L+1):1:(L+XMCNT) DO
 .S XMNODE=XMNODE+1
 .S ^TMP("DVBCXFR",$J,X,0)=XMVAR(XMNODE)
 S ^TMP("DVBCXFR",$J,X+1,0)="$END1 "
 ;
SEND K XMZ
 ;S XMY("POSTMASTER@"_DOMNAM)=DOMNUM
 N RRIF
 S RRXM=0
 ;Check for reroute within VAMC
 I RRF'=INAM D
 .S XMY(DUZ)="",XMY("S.DVBA C PROCESS MAIL MESSAGE@"_DOMNAM)=DOMNUM,XMSUB="Transfer of C&P Exams",XMTEXT="^TMP(""DVBCXFR"",$J,",XMDUZ=DUZ
 .D ^XMD
 .I $D(XMZ) S RTN="1^Transmitted as message # "_XMZ_" from this site to "_DOMNAM
 .I '$D(XMZ) S RTN="0^Message transmission error! Request WILL NOT be rerouted!",RRXM=1
 ;if all ok, update main, sub-file
 I RRXM=1 D VKILL Q
 I RRF=INAM S RTN="1^Rerouted to another division within "_RRF
 F III=0:0 S III=$O(XEXAMS(III)) Q:III=""  D
 .S DIE="^DVB(396.4,",DA=III,DR=".04///T;62///"_DOMNAM_";60////"_DT_";61///"_USERNM
 .D ^DIE
 ;patch 227 introducing new status 
 K DIE,DA,DR S DIE="^DVB(396.3,",DA=REQDA,DR="17///16"
 ;
 ; ajf - Defect #2 - 02/17/2017
 S CSITE=+$$SITE^VASITE
 I CSITE=RRFIEN&(CSITE=INUM) S DR=DR_";24////"_$P(^DVB(396.15,RDIV,0),"^")
 D ^DIE ;set transfer items
 ;
 S RRIF=$$UPRR^DVBCUTL8(REQDA,RRDT)
 S DA=$P(RRIF,"^")
 S DIE="^DVB(396.3,"_REQDA_",6,",DA(1)=REQDA
 S DR="1////"_REQDA_";2////"_PIEN_";3////"_RRF_";4////"_RR_";5////"_RD
 S DR=DR_";.02////"_INAM_";8////"_RRDIV_";7////"_DUZ
 S DR=DR_";9////"_INUM_";10////"_STN_";11////"_RRFIEN_";12////"_RRFSTN
 D ^DIE ;set Reroute fields
 S RRIEN=DA,RRST="N",RRR=""
 D UPRS^DVBCUTL8(REQDA,RRIEN,RRDT,RRST,RRR) ; Update the status
 ; Send Reroute message to Requestor
 D SENDMSG^DVBAB1C(REQDA)
 ;
 ;  REQDA = 2507 Request IEN
 ;  INUM = Institution IEN
 ;  PIEN = Patient IEN
 ;  DIEN = Division IEN
 ;  RR = Reroute Reason
 ;  RD = Reroute Description
 ;
 ;
 ;
 K LINE,DOMNUM,DOMNUM1,^TMP("DVBCXFR",$J),XMDUZ,III,L,JI,JY,XMY,XMZ,XMSUB,XMTEXT,XMDUZ,DIE,DA,DR,TYPE
 ;
VKILL ; Kill varables from process
 ;
 K XMERR,ADR1,ADR2,ADR3,BUSPHON,CFLOC,CFREQ,CITY,CLTYP,CNTY,CNUM
 K CSITE,DFN,DOB,DOMNAM,ECF,ELIGCOD,ELIGSDT,ELIGST,EXAMS,FEXM
 K HOMPHON,II,INUM,LREXMDT,MDIV,OTDIS,OTHDIS,OTHDIS1,OTHDIS2,OTHDOC,PDSRV
 K PIEN,PNAM,POWSTAT,PRIO,RD,RDIV,REQDA,REQDT,RR,RONAM,RO,RRDT,RRDIV
 K RRFD,RRIEN,RRR,RRF,RRST,RRXM,SEX,SITE,SITE1,SPEC,SRVCON,SRVEDT,SRVSDT,DVBINF
 K SRVPCT,SSN,STATE,USERNM,VETST,X,XEXAMS,XMCNT,XMVAR,ZIP,ZIP4,DMAS,INAM
 D KILL^DVBCUTIL,KILL^DVBCUTL2,KILL^DVBCUTL3
 Q