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

BMCP4.m

Go to the documentation of this file.
BMCP4 ; IHS/PHXAO/TMJ - FIX DB CHR<-->RCIS ; 
 ;;4.0;REFERRED CARE INFO SYSTEM;;JAN 09, 2006
 ;
 ;;FIX CHS PO VENDOR PTR VALUES IN RCIS VENDOR 
 ;
 S U="^"
 S RIEN=0 ;RCIS REF IEN on RCIS Side
 S BMCNOREF=0 ;Counter -No Match of RCIS Ref IEN on CHS Side
 S BMCNOVEN=0 ;Counter -No Match of RCIS Vendor IEN  on CHS Side
START ;START $O OF REFERRALS
 F  S RIEN=$O(^BMCREF(RIEN)) Q:RIEN'=+RIEN  D
 . ;GET THE RCIS PATIENT DEMOGRAPHICS
 . S BMCR=$P(^BMCREF(RIEN,0),U,1)    ;.01 RCIS Date Referral Initiated
 . S BMCRNUM=$P(^BMCREF(RIEN,0),U,2) ;.02 RCIS Referral Number
 . S BMCRPAT=$P(^BMCREF(RIEN,0),U,3) ;.03 RCIS Patient IEN
 . ;
 . ;GET PO IEN AND VENDOR VALUES
 . S RCIEN=0 ;PO IEN on RCIS Side (CHS AUTH Multiple)
 . F  S RCIEN=$O(^BMCREF(RIEN,41,RCIEN)) Q:RCIEN'=+RCIEN  D
 . . ;DO WE HAVE A CHS PO IEN ENTRY?
 . . I '$D(^ACHSF(DUZ(2),"D",RCIEN)) Q  ;Quit if no PO IEN on CHS Side
 . . ;GET THE CHS PATIENT IEN
 . . S BMCCHSP=$P(^ACHSF(DUZ(2),"D",RCIEN,0),U,22)
 . . ;DO WE HAVE A CHS LINK VALUE TO IEN OF REFERRAL
 . . I '$D(^ACHSF(DUZ(2),"D",RCIEN,2)) Q  ;Quit no Ref # on CHS side
 . . ;GET THE CHS LINK TO RCIS
 . . S CHSRIEN=$P(^ACHSF(DUZ(2),"D",RCIEN,2),U,7) ;RCIS REF IEN #
 . . Q:'$D(CHSRIEN)
 . . I CHSRIEN="" Q  ; NO BACK POINTER FROM CHS TO RCIS
 . . I CHSRIEN'=RIEN S BMCNOREF=BMCNOREF+1 Q
 . . ;I CHSRIEN'=RIEN W "PO REF # DOES NOT MATCH RCIS REF #:  "_RIEN_"    REF PO IEN: "_RCIEN,! S BMCNOREF=BMCNOREF+1 Q
 . . S BMCCHSV=$P(^ACHSF(DUZ(2),"D",RCIEN,0),U,8) ;CHS VENDOR IEN
 . . S BMCREFV=$P(^BMCREF(RIEN,41,RCIEN,0),U,9) ;RCIS VENDOR IEN
 . . Q:BMCCHSV=BMCREFV  ;Quit if Both Vendors Match-No Fix Needed
 . . S BMCNOVEN=BMCNOVEN+1
 . . D FIX ;Go Re-point the Vendor entries
 W !!,"(1)  No Match on Referral #: ",?30,BMCNOREF,!
 W !,"(2)  No Match on Vendors: ",?30,BMCNOVEN W ?45,"FIXED THESE BAD VENDOR POINTERS"
 W !!,"If Item #1 Count exists, then a previous Patched",!
 W "Routine was NOT ran.  Please contact Package Developer",!
 W "Toni Jarland, Phoenix Area IHS (602) 346-5268",!!
 DO END
 QUIT
 ;
FIX ;FIX THE VENDOR POINTERS IN RCIS
 ;
 ; OK -- HERE IS THE PLAN:
 ;
 ;   1)  RESET ALL BAD VENDOR POINTERS W/DIE CALL
 S DR=""
 S DIE="^BMCREF("_RIEN_",41," S DA(1)=RIEN,DA=RCIEN,DR=".09////"_BMCCHSV D ^DIE K DIE,DR,DA,DIC
 W !,"FIXED REFERRAL #:   "_RIEN
 Q
 ;
END ;End of Routine
 K RIEN,RCIEN,BMCCHSV,BMCREFV,BMCCHSV,BMCR,BMCRNUM,BMCRPAT,BMCNOREF,BMCNOVEN,D,D0,BMCCHSP,CHSRIEN