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

DVBCPUSH.m

Go to the documentation of this file.
DVBCPUSH ;ALB/AKG - CAPRI PUSH UTILITY RPC; APR 25, 2022@9:30am ; 5/19/23 9:07am
 ;;2.7;AMIE;**238,242,248**;Apr 10, 1995;Build 6
 ;Per VHA Directive 6402 this routine should not be modified
 ;ICR #2263 Supports all calls to Parameter File and XPAR usage
 ;
 Q
 ;
PARAMS(DVBLIST) ;returns data on the entire DVBA parameter list
 ;rpc returns all CAPRI namespaced Paramaters
 K DVBLIST
 N DVBCNT,DVBPARAM,DVBVAL,DVBPAR
 S DVBCNT=0
 S DVBPARAM="" F  S DVBPARAM=$O(^XTV(8989.51,"B",DVBPARAM)) Q:DVBPARAM=""  D
 .S DVBPAR="" F  S DVBPAR=$O(^XTV(8989.51,"B",DVBPARAM,DVBPAR)) Q:DVBPAR=""  D
 ..I $P($P(DVBPARAM,U,1)," ")'["DVBA" Q
 ..S DVBVAL=$$GET^XPAR("PKG",DVBPARAM,1,"Q")
 ..S DVBLIST(DVBCNT)=DVBPAR_U_DVBPARAM_U_DVBVAL
 ..S DVBCNT=DVBCNT+1
 Q
 ;
PARAMED(DVBMSG,DVBNAME,DVBVAL) ;
 ;edits exiting paramater value from CAPRI Push Utility
 I $G(DVBNAME)="" S DVBMSG="Missing parameter name" Q
 I $G(DVBVAL)="" S DVBMSG="Missing new value" Q
 K DVBMSG S DVBMSG=""
 N DVBERR,DVBINFO,DVBOLD
 S DVBOLD=$$GET^XPAR("PKG",DVBNAME,1,"Q")
 D EN^XPAR("PKG.AUTOMATED MED INFO EXCHANGE",DVBNAME,1,DVBVAL,.DVBERR)
 I DVBERR S DVBMSG="Failed to update because "_DVBERR_U_0  Q
 S DVBINFO=$$GET^XPAR("PKG",DVBNAME,1,"Q")
 S DVBMSG=DVBNAME_" value updated successfully from "_DVBOLD_" to "_DVBINFO_U_1
 Q
 ;
PARADESC(DVBRTN,DVBIEN) ;
 ;returns description for selected parameter
 N DVBX,DVBTWP,DVBERR,DVBCT,DVBRT,DVBIENS,DVBTMP
 I $G(DVBIEN)="" S DVBRTN="Missing Parameter IEN" Q
 D GETS^DIQ(8989.51,DVBIEN,20,"","DVBTWP","DVBERR")
 I $D(DVBERR) S DVBRTN=DVBERR Q
 K DVBTMP M DVBTMP=DVBTWP
 S DVBIENS=""_DVBIEN_","
 I $D(DVBTMP) D
 .S DVBCT="",DVBX="" F  S DVBX=$O(DVBTMP(8989.51,DVBIENS,20,DVBX)) Q:DVBX=""  D
 ..S DVBCT=DVBCT+1
 ..S DVBRT(DVBCT)=DVBTMP(8989.51,DVBIENS,20,DVBX)
 M DVBRTN=DVBRT
 K DVBRT,DVBTWP
 Q
 ;
EFOLDMET(DVBRTN,DVBAUTH,DVBPIEN,DVBTRANS,DVBSTAT,DVBERR,DVBRPD) ;
 ;Input: DVBAUTH=Authorized User IEN
 ;       DVBPIEN=Patient IEN
 ;       DVBTRANS=Transmission Path
 ;       DVBSTAT=Transmission Status
 ;       DVBERR=Transmission Error Code
 ;       DVBRPD=Report Details
 ;Output: RTN=0 for Failure and 1 for Success
 ;
 N DVBDT,DIC,X,Y,DA,DTOUT,DUOUT,DLAYGO,DVBI,DVBRPC,DVBN1,DVBAIEN,DVBNUM
 I DVBAUTH="" S DVBRTN="0^MISSING AUTHORIZED USER IEN" Q
 I DVBPIEN="" S DVBRTN="0^MISSING PATIENT IEN" Q
 I DVBTRANS="" S DVBRTN="0^MISSING TRANSMISSION PATH" Q
 I DVBSTAT="" S DVBRTN="0^MISSING TRANSMISSION STATUS" Q
 S DVBDT=$$NOW^XLFDT()
 K DIC,DIE,DR,DA
 S (DIC,DIE)="^DVB(396.21,",DIC(0)="L",DLAYGO=396.21 S X=DVBDT
 D ^DIC S DA=+Y K DIC
 I DA=-1 S DVBRTN=0 Q
 S DVBRTN=1
 S DR=".02////"_DVBAUTH_";.03////"_DVBPIEN_";1////"_DVBTRANS D ^DIE
 S DR="1.1////"_DVBSTAT_";1.2////"_DVBERR D ^DIE
 S DVBNUM=DA
 S DVBI="" F  S DVBI=$O(DVBRPD(DVBI)) Q:DVBI=""  D
 .S DA(1)=DVBNUM
 .S DIC="^DVB(396.21,"_DA(1)_",2,",DIC(0)="L"
 .D ^DIC S DA=+Y
 .S DIE=DIC
 .S DVBRPC=$P(DVBRPD(DVBI),U),DVBAIEN=$P(DVBRPD(DVBI),U,2)
 .S DVBN1=$P(DVBRPD(DVBI),U,3,100)
 .S DR=".01////"_DVBRPC_";.02////"_DVBAIEN_";.03////"_DVBN1
 .D ^DIE
 K DIC,DIE,DA,DR,DIRUT
 Q
 ;
PURGEMET(DVBRTN,DUZ,DVBDTP) ;
 ;
 ;input: DUZ user must have the DVBA METRICS DATA PURGE key
 ;     : Date to purge up to
 N DVBDT,DVBDA,DVBKEY,DVBDATE
 I DUZ="" S DVBRTN="0^Missing DUZ" Q
 I DVBDTP="" S DVBRTN="0^Missing Date" Q
 S X=DVBDTP D ^%DT S DVBDATE=Y
 D OWNSKEY^XUSRB(.DVBKEY,"DVBA CAPRI METRICS PURGE",DUZ)
 I DVBKEY(0)=0 S DVBRTN="0^Missing security key" Q
 S DVBDT="" F  S DVBDT=$O(^DVB(396.21,"B",DVBDT)) Q:DVBDT=""  D
 .S DVBDA="" F  S DVBDA=$O(^DVB(396.21,"B",DVBDT,DVBDA)) Q:DVBDA=""  D
 ..I $P(DVBDT,".")>DVBDATE Q
 ..K DIC,DA,DIK
 ..S DIC="^DVB(396.21,",DA=DVBDA
 ..S DIK=DIC D ^DIK K DIK,DIC
 ..S DVBRTN=1
 I $G(DVBRTN)'=1 S DVBRTN="-1"
 Q
PURGEOPT ;
 W !!,"CAPRI CLINICAL DOCUMENTS EFOLDER METRIC DATA PURGE",!!
 S DIR("?")="Enter date to purge CAPRI Clinical Documents EFolder Metrics file up to.  For Example,to purge from today and older enter today's date"
 S DIR("A")="Enter date to purge CAPRI Clinical Documents EFolder Metrics file."
 S DIR(0)="D" D ^DIR K DIR Q:$D(DIRUT)!($D(DTOUT))
 D PURGEMET(.DVBRTN,DUZ,Y)
 I DVBRTN["Miss" W !!,"Missing Security Key, please check with your manager for additional assistance" Q
 I DVBRTN'=1 W !!,"No records were purged",!! D PURGEOPT Q
 I DVBRTN=1 W !!,"Purge completed"
 Q
ALL(DVBLIST) ;
 K DVBLIST
 N DVBCNT,DVBPARAM,DVBVAL,DVBPAR,DVBSIY,DVBSIEN,DVBZ,DVBERR
 S DVBCNT=0
 S DVBPARAM="" F  S DVBPARAM=$O(^XTV(8989.51,"B",DVBPARAM)) Q:DVBPARAM=""  D
 .S DVBPAR="" F  S DVBPAR=$O(^XTV(8989.51,"B",DVBPARAM,DVBPAR)) Q:DVBPAR=""  D
 ..S DVBZ="30*" K DVBSIY D GETS^DIQ(8989.51,DVBPAR,DVBZ,"I","DVBSIY","DVBERR") I $D(DVBERR) Q
 ..S DVBSIEN="" F  S DVBSIEN=$O(DVBSIY(8989.513,DVBSIEN)) Q:DVBSIEN=""  D
 ...N DVBENT S DVBENT=DVBSIY(8989.513,DVBSIEN,.02,"I") I DVBENT'=9.4 Q
 ...I DVBPARAM["XPAR" Q
 ...S DVBVAL=$$GET^XPAR("ALL",DVBPARAM,1,"Q")
 ...S DVBLIST(DVBCNT)=DVBPARAM_U_DVBVAL
 ...S DVBCNT=DVBCNT+1
 Q
SPECADD(DVBMSG,DVBNAME) ; 
 ;adds entry to Special Considerations
 I $G(DVBNAME)="" S DVBMSG="0^Missing Special Considerations name" Q
 K DVBMSG S DVBMSG="",DVBIEN=0
 F  S DVBIEN=$O(^DVB(396.25,DVBIEN)) Q:DVBIEN=""!('DVBIEN)  D
 .I $P(^DVB(396.25,DVBIEN,0),U,1)=DVBNAME S DVBMSG="0^Duplicate"
 .Q
 I DVBMSG="" D
 .K DIC,DO,DIE,DA,DR,DLAYGO,X,Y
 .N DIERR
 .S DIC=396.25,DIC(0)="Z",X=DVBNAME D FILE^DICN
 .S (DA)=+Y,DIE=DIC
 .S DR=".02////1" D ^DIE
 .I $D(DIERR) S DVBMSG="0^Record not added"
 .I '$D(DIERR) S DVBMSG="1^Record added"
 .K DIC,DO,DIE,DA,DR,DLAYGO,X,Y
 .Q
 Q
SPECDIS(DVBMSG,DVBIEN,DVBSTAT) ; 
 ;disables entry in Special Considerations
 N DIERR
 K DIC,DIE,DA,DR,DLAYGO,X,Y
 I $G(DVBIEN)="" S DVBMSG="0^Missing IEN" Q
 I $G(DVBSTAT)="" S DVBMSG="0^Missing Status" Q
 S DA=DVBIEN,(DLAYGO,DIE)="^DVB(396.25,",DIC(0)="L"
 S DR=".02////"_DVBSTAT D ^DIE
 I $D(DIERR) S DVBMSG="0^Record not disabled"
 I '$D(DIERR) S DVBMSG="1^Record disabled"
 K DIC,DIE,DA,DR,DLAYGO,X,Y
 Q
LISTSC(DVBMSG) ;
 ;list inactive Special Considerations
 N DVBIEN,DVBCNT,DVBRET
 K ^TMP("DVBLSTSC",$J)
 S DVBIEN=0,DVBCNT=0
 F  S DVBIEN=$O(^DVB(396.25,DVBIEN)) Q:DVBIEN=""!('DVBIEN)  D
 .Q:$G(^DVB(396.25,DVBIEN,0))=""
 .Q:$P($G(^DVB(396.25,DVBIEN,0)),U,2)'=0
 .S DVBRET(DVBCNT)=$P(^DVB(396.25,DVBIEN,0),"^",1)_"^"_DVBIEN
 .M ^TMP("DVBLSTSC",$J,DVBCNT)=DVBRET(DVBCNT)
 .S DVBCNT=DVBCNT+1
 S DVBMSG=$NA(^TMP("DVBLSTSC",$J))
 Q