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

BDPPASS.m

Go to the documentation of this file.
BDPPASS ; IHS/CMI/TMJ - Routine to Pass data to Designated Provider Package ;
 ;;2.0;IHS PCC SUITE;**21**;MAY 14, 2009;Build 34
 ;
 ;This Routine creates a new entry or edits an existing entry
 ;of the Desginated Specialty Provider Management System
 ;BDPDFN = Patient DFN Number
 ;BDPTYPE = Internal IEN # of Provider Type File #90360.3
 ;BDPRPRVP = Internal IEN of Provider Name
 ;
 ;
 ;
CREATE(BDPDFN,BDPTYPE,BDPRPRVP) ;EP - Entry Point to Create
 ;
 N BDPRR,BDPLINKI,BDPLPROV,BDPRIEN,BDPLINKI
 ;
 S BDPQ=1
 S BDPLINKI=1  ;tell xrefs we are in bdp
 S BDPRPROV=$P($G(^VA(200,BDPRPRVP,0)),U) ;Provider Text Name
 S BDPRR=$O(^BDPRECN("AA",BDPDFN,BDPTYPE,""))  ;Check to see if this Patient already has Type
 I BDPRR="" D ADDNEW Q BDPQ  ;NONE OF THIS TYPE
 S BDPLPROV=$P($G(^BDPRECN(BDPRR,0)),U,3) ;Current Provider
 Q:BDPLPROV=BDPRPRVP 0  ;Quit if Same Provider Selected as Current
 S BDPRIEN=BDPRR D MOD Q 0
 Q 0
 ;
ADDNEW ;Add a new Record
 S DIC="^BDPRECN(",DIC(0)="L",DLAYGO=90360.1,DIC("DR")=".02////"_BDPDFN,X=BDPTYPE
 D FILE^BDPFMC
 I Y<0 W !,"Error creating DESIGNATED PROVIDER.",!,"Notify programmer.",! D EOP^BDP Q
 ;
 S BDPRIEN=+Y
 ;S X="`"_BDPRPRVP,DIC="^BDPRECN("_BDPRIEN_",1,",DA(1)=BDPRIEN,DIC(0)="L",DIC("P")=$P(^DD(90360.1,.06,0),U,2) D ^DIC K DIC,DA,DR,Y,X,DIADD,DLAYGO D ^XBFMK
 S X="`"_BDPRPRVP,DIC="^BDPRECN("_BDPRIEN_",1,",DA(1)=BDPRIEN,DIC(0)="L",DIC("P")=$P(^DD(90360.1,.06,0),U,2),DIC("DR")=".04////"_DT D ^DIC K DIC,DA,DR,Y,X,DIADD,DLAYGO D ^XBFMK  ;IHS/CMI/LAB - PATCH 21 ADDED SETTING OF .04 EFFECTIVE DATE
 S BDPQ=0
 K BDPLINKI
 Q
 ;
MOD ;Modify an Existing Provider Type for this Patient
 S BDPLINKI=1
 ;FIND THE LAST MULTIPLE AND SET .05 EQUAL TO DT, .02 AND .03
 S Z=0,X=0 F  S X=$O(^BDPRECN(BDPRIEN,1,X)) Q:X'=+X  I $P(^BDPRECN(BDPRIEN,1,X,0),U,1)=BDPLPROV S Z=X
 I Z,$P(^BDPRECN(BDPRIEN,1,Z,0),U,5)="" S DIE="^BDPRECN("_BDPRIEN_",1,",DA(1)=BDPRIEN,DA=Z,DR=".02////"_DUZ_";.03////"_DT_";.05////"_DT D ^DIE K DIE,DR,DA,DINUM,X,Y,Z
 ;S X="`"_BDPRPRVP,DIC="^BDPRECN("_BDPRIEN_",1,",DA(1)=BDPRIEN,DIC(0)="L",DIC("P")=$P(^DD(90360.1,.06,0),U,2) D ^DIC K DIC,DA,DR,Y,X,DIADD,DLAYGO D ^XBFMK
 K X,DIC
 ;IHS/CMI/LAB - ADDED SETTING OF .04 EFFECTIVE DATE PATCH 21
 S DIADD=1,X="`"_BDPRPRVP,DIC="^BDPRECN("_BDPRIEN_",1,",DA(1)=BDPRIEN,DIC(0)="L",DIC("P")=$P(^DD(90360.1,.06,0),U,2),DIC("DR")=".04////"_DT D ^DIC K DIC,DA,DR,X,DIADD,DLAYGO
 I Y=-1 S BDPQ=0 Q
 K DIC,DA,DR,Y,X,DIADD,DLAYGO D ^XBFMK
 ;SET 0 NODE FIELDS
 S DIE="^BDPRECN(",DA=BDPRIEN,DR=".03///`"_BDPRPRVP_";.04////"_DUZ_";.05////"_DT D ^DIE,^XBFMK
 S BDPQ=0
 K BDPLINKI
 Q
 ;
 ;
DELETE ;EP Delete a Designated Provider
 ;user must set BDPPAT,BDPTYPE
 NEW BDPIEN,BDPLINKI,DIE,DA,DR,DINUM,X,Y,BDPPROV
 S BDPLINKI=1
 ;
 ;
 S BDPIEN=$O(^BDPRECN("AA",BDPPAT,BDPTYPE,"")) ;Get Existing
 I BDPIEN="" Q  ;Quit if no Existing Record 
 ;
 S BDPPROV=$P(^BDPRECN(BDPIEN,0),U,3)
 ;
 S DIE="^BDPRECN(",DA=BDPIEN,DR=".03///@;.04////"_DUZ_";.05////"_DT D ^DIE K DIE,DR,DA,DINUM
 ;SET INACTIVE DATE IN MULTIPLE PLUS .02 AND .03
 ;FIND THE LAST MULTIPLE AND SET .05 EQUAL TO DT, .02 AND .03
 S X=0 F  S X=$O(^BDPRECN(BDPIEN,1,X)) Q:X'=+X  I $P(^BDPRECN(BDPIEN,1,X,0),U,1)=BDPPROV S Y=X
 I Y,$P(^BDPRECN(BDPIEN,1,Y,0),U,5)="" S DIE="^BDPRECN("_BDPIEN_",1,",DA(1)=BDPIEN,DA=Y,DR=".02////"_DUZ_";.03////"_DT_";.05////"_DT D ^DIE K DIE,DR,DA,DINUM
 K BDPLINKI
 Q
EOJ ; END OF JOB
 K BDPLINKI
 Q
 ;