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

BDPCHNGD.m

Go to the documentation of this file.
  1. BDPCHNGD ; IHS/CMI/TMJ - CHANGE NON-EXISTING PROVIDER TO NEW PROVIDER ;
  1. ;;2.0;IHS PCC SUITE;**10,21**;MAY 14, 2009;Build 34
  1. ;
  1. ; Subscripted BDPREC is EXTERNAL form.
  1. ; BDPREC("PAT NAME")=patient name
  1. ; BDPREC("PROV TYPE")=Provider Category Type
  1. ; BDPDFN=patient ien
  1. ; BDPRDATE=date in internal FileMan form
  1. ; BDPRIEN=Designated Provider ien
  1. ;
  1. ;This routine populates records which have deleted the
  1. ;current Desg. Provider and can assign unassigned patients
  1. ;to a current new Provider.
  1. START ;
  1. ;
  1. D INFORM ;Data Entry Explanation
  1. ;
  1. D MAIN Q:BDPQ D HDR^BDP
  1. D EOJ
  1. Q
  1. ;
  1. MAIN ;
  1. S BDPQ=0,BDPYI=0
  1. D ASK
  1. Q:BDPQ
  1. D PROV
  1. I BDPQ=1 G MAIN
  1. ;
  1. ;D ASK
  1. ;
  1. GETTYPE ;Do Get Date if no existing Designated Providers
  1. D TYPE ; get Provider Category Type
  1. Q:BDPQ
  1. D ASKGO ; add new Designated Provider record
  1. S BDPQ=0
  1. Q
  1. ;
  1. ;
  1. ;
  1. ;
  1. ASK ;Ask to Continue
  1. S BDPQ=0
  1. W !! S DIR(0)="Y",DIR("A")="Do you want to continue changing the Designated Provider for each Patient",DIR("B")="Y" K DA D ^DIR K DIR
  1. I $D(DIRUT) S BDPQ=1 Q
  1. I 'Y S BDPQ=1 Q
  1. Q
  1. ;
  1. ;
  1. TYPE ; GET CATEGORY TYPE FOR DESIGNATED PROVIDER
  1. W !
  1. S BDPQ=1
  1. S DIR(0)="90360.1,.01",DIR("B")="DPCP" K DA D ^DIR K DIR
  1. Q:$D(DIRUT)
  1. S BDPTYPE=+Y,BDPREC("PROV TYPE")=Y(0)
  1. I $P(^BDPTCAT(BDPTYPE,0),U,1)="MESSAGE AGENT",'$D(^BDPMSGA("B",BDPPROV)) D G TYPE
  1. .W !!,"The provider you selected is not listed as a Message Agent, he/she must "
  1. .W !,"be added to the Message Agent List using the option on the Manager's "
  1. .W !,"Menu before they can be assigned as a message agent.",!
  1. I $P(^BDPTCAT(BDPTYPE,0),U,1)="MESSAGE AGENT",$P($G(^BDPMSGA(BDPPROV,0)),U,3) D G TYPE
  1. .W !!,"The provider you selected has been inactivated as a message agent, he/she"
  1. .W !," must be reactivated using the option on the Manager's Menu before they can "
  1. .W !,"be assigned as a message agent.",!
  1. ;
  1. S BDPQ=0
  1. Q
  1. PROV ; GET DESIGNATED PROVIDER
  1. S BDPPROV="",BDPQ=0
  1. S DIC("A")="Select New Designated Provider: ",DIC="^VA(200,",DIC(0)="AEMQ" D ^DIC K DIC,DA S:$D(DUOUT) DIRUT=1,BDPQ=1
  1. Q:$D(DIRUT)
  1. I +Y<1 S BDPQ=1 Q
  1. S X=$$CHKPROV^BDPDPEE(+Y) I X S BDPQ=1 Q
  1. S BDPPROV=+Y,BDPRPROV=$P(Y,U,2)
  1. S BDPRPRVP=$P(^VA(200,BDPPROV,0),U,1) ;Provider Print Name
  1. S BDPQ=0
  1. Q
  1. ;
  1. ASKGO ;Ask to continue
  1. ;
  1. W !!!,?8,"**********************************************",!
  1. W !!,?8,"Okay, all Patients with NO EXISTING Current Provider : ",!
  1. W ?8,"Will be assigned to NEW Provider Named: "_BDPRPRVP W !
  1. W ?8,"For Designated Provider Category/Type: "_$P($G(^BDPTCAT(BDPTYPE,0)),U,1) W !!
  1. W !,?8,"**********************************************",!
  1. ;
  1. ;
  1. S DIR(0)="Y",DIR("A")="Do you wish to Continue Updating to a new CURRENT Designated Provider",DIR("?")="Enter Y for Yes or N for NO",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) S BDPQ=1 Q
  1. I Y=0 S BDPQ=1 Q
  1. ;
  1. ;
  1. UPDATE ;Update Records
  1. ;
  1. S BDPIEN="" F S BDPIEN=$O(^BDPRECN("B",BDPTYPE,BDPIEN)) Q:BDPIEN'=+BDPIEN D
  1. . Q:BDPIEN=""
  1. . S BDPTYPEM=$P($G(^BDPRECN(BDPIEN,0)),U) ;Type to Match On
  1. . Q:BDPTYPEM=""
  1. . Q:BDPTYPE=""
  1. . I BDPTYPE'=BDPTYPEM Q ;Quit if No Match
  1. . S BDPPAT=$P($G(^BDPRECN(BDPIEN,0)),U,2) ;Patient
  1. . Q:BDPPAT=""
  1. . S BDPOPROV=$P($G(^BDPRECN(BDPIEN,0)),U,3) ;Existing Provider
  1. . Q:BDPOPROV'="" ;Quit if they already have a Provider
  1. . ;Otherwise go on and populate these non-existing Current Providers
  1. . ;with the new one the User Selected
  1. . Q:BDPPROV="" ;Quit if No New Provider
  1. . S X=$$CREATE^BDPAMA(BDPPAT,BDPTYPE,BDPPROV) Q
  1. ;
  1. ;
  1. MSGEND ;End of Add Message
  1. W !!!!,"Okay - I have changed all Patient Records - as follows: ",! D Q
  1. .W !,"OLD Designated Provider: No Current Provider Assigned",!
  1. . W "has been re-assigned to NEW Designated Provider:"_BDPRPRVP W !
  1. . W "For Designated Provider Category/Type: "_$P($G(^BDPTCAT(BDPTYPE,0)),U,1) W !!
  1. . ;W "Note: If this Designated Provider already existed for the patient",!,?7," - No change was made to the patient record-.",!
  1. . D PAUSE^BDP
  1. S BDPQ=0
  1. Q
  1. ;
  1. ;
  1. EOJ ; END OF JOB
  1. D ^BDPKILL
  1. Q
  1. ;
  1. INFORM ;Data Entry Explanation
  1. ;
  1. W !,?3,"This Option allows the automatic changing Existing Records......",!,?10,"from an Unassigned (blank) CURRENT Designated Provider -",!,?10,"to a NEW assigned Designated Provider.",!!
  1. W ?3,"The User is prompted for the NEW Provider Name.",!
  1. W ?3,"Once the desired Provider Category Type is selected by the User,",!
  1. W ?3,"the Program will automatically LOOP through all Records and",!,?3,"change to the NEW Provider for this Category Type.",!!
  1. W ?3,"If the patient's existing Provider/Category Type are the same,",!,?3,"no update will occur.",!
  1. Q