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

PSXMSGS.m

Go to the documentation of this file.
  1. PSXMSGS ;BIR/WPB - Miscellaneous Message Handler ;01 JUL 1997 1:55 PM
  1. ;;2.0;CMOP;**1,2,4,24,23,27,30,41,77**;11 Apr 97;Build 3
  1. ;Reference to ^PS(59 supported by DBIA #1976
  1. ;Reference to File #200 supported by DBIA #10060
  1. ;Reference to DIQ^PSODI supported by DBIA #4858
  1. ;Reference to STATUS^PSOBPSUT supported by DBIA #4701
  1. ;
  1. CAN ;Q:'$D(^TMP("PSXCAN1",$J))
  1. S DV="" F S DV=$O(^TMP("PSXCAN1",$J,DV)) Q:DV="" S DIVN=$P(^PS(59,DV,0),"^") D PNM
  1. Q
  1. PNM S XMSUB=DIVN_" CMOP Not Dispensed Rx List, ",XMDUZ=.5,XMDUN="CMOP Manager"
  1. D XMZ^XMA2 G:XMZ<0 CAN
  1. N SYM,RXN
  1. S LCNT=1,^XMB(3.9,XMZ,2,LCNT,0)="Not Dispensed Rx Report for the "_DIVN_" Division.",LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="",LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="The following prescriptions were not dispensed by the vendor: ",LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="",LCNT=LCNT+1
  1. S DFN="" F S DFN=$O(^TMP("PSXCAN1",$J,DV,DFN)) Q:DFN="" S PNM=$P(^DPT(DFN,0),"^"),SSN1=$P(^DPT(DFN,0),"^",9),SPS=(47-$L(PNM)),PSXSSN=$E(SSN1,1,3)_"-"_$E(SSN1,4,5)_"-"_$E(SSN1,6,9) D
  1. .F I=1:1:SPS S SP=$G(SP)_" "
  1. .S ^XMB(3.9,XMZ,2,LCNT,0)="Patient: "_PNM_SP_"SSN: "_PSXSSN,LCNT=LCNT+1
  1. .S ^XMB(3.9,XMZ,2,LCNT,0)="",LCNT=LCNT+1
  1. .S RX1="" F S RX1=$O(^TMP("PSXCAN1",$J,DV,DFN,RX1)) Q:RX1="" D
  1. ..S NODE=^TMP("PSXCAN1",$J,DV,DFN,RX1)
  1. ..S REASON=$P(NODE,"^",6),BT=$P(NODE,"^",8),FIL=$P(NODE,"^",7)
  1. ..S RXN=$O(^PSRX("B",RX1,""))
  1. ..S SYM=$S(+$$RXAPI1(RXN,105,"I"):"$",1:"")_$$ECME(RXN)
  1. ..S FLL=$S(FIL>0:"REFILL "_FIL,FIL=0:"ORIGINAL",1:"")
  1. ..S DRGN=$S($P($G(NODE),"^",1)'="":$P(NODE,"^",1),1:"UNKNOWN")
  1. ..S DRGI=$P(NODE,"^",4),CMOPYN=$P(NODE,"^",5),QY=$P(NODE,"^",3)
  1. ..S ^XMB(3.9,XMZ,2,LCNT,0)=" Rx #: "_RX1_SYM_" "_$S(FIL'>0:"(ORG)",FIL>0:"(REF"_FIL_")",1:"")_" Qty: "_QY_" Trans #: "_BT,LCNT=LCNT+1
  1. ..S ^XMB(3.9,XMZ,2,LCNT,0)=" Drug: "_DRGN,LCNT=LCNT+1
  1. ..S ^XMB(3.9,XMZ,2,LCNT,0)=" Transmitted under CMOP ID: "_$G(DRGI),LCNT=LCNT+1
  1. ..S ^XMB(3.9,XMZ,2,LCNT,0)=" Reason: "_REASON,LCNT=LCNT+1
  1. ..I $G(CMOPYN)=1 S ^XMB(3.9,XMZ,2,LCNT,0)=" Note: Local Drug File entry is no longer MARKED for CMOP ",LCNT=LCNT+1
  1. ..S:$P(NODE,"^",2)'=$G(DRGI) ^XMB(3.9,XMZ,2,LCNT,0)=" Note: Local Drug File entry is no longer MATCHED to transmitted CMOP I.D. ",LCNT=LCNT+1
  1. ..S ^XMB(3.9,XMZ,2,LCNT,0)=" ",LCNT=LCNT+1
  1. ..K CMOPYN,FLL,FIL,BT,REASON,DRGI,DRGN,QY,I,SP,SPS,SP1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="Instructions: Prescriptions cannot be processed at CMOP for the reason listed",LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="above. Please review the prescription and take the appropriate action(s).",LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="If you have any questions, contact your CMOP contact person.",LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,0)="^3.92A^"_LCNT_"^"_LCNT_"^"_DT,XMDUN="CMOP Manager"
  1. K XMY D GRP S XMDUZ=.5 D ENT1^XMD
  1. K XMY,XMDUZ,XMSUB,XMDUN,REASON,RXN,LCNT,XMZ,FILL,FIL,TDT,TDTM,BAT,DOMAIN,PTR,XPTR,FACDOM
  1. Q
  1. INVREL S XMSUB="CMOP Release Return Problems",XMDUZ=DUZ,XMDUN="CMOP Manager"
  1. D XMZ^XMA2 G:XMZ<0 INVREL
  1. S LCNT=1
  1. S RXNN="" F S RXNN=$O(^TMP($J,"PSXINV",RXNN)) Q:RXNN="" D
  1. .S ^XMB(3.9,XMZ,2,LCNT,0)=RXNN_" has already been marked as processed",LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,0)="^3.92A^"_LCNT_"^"_LCNT_"^"_DT,XMDUN="CMOP Manager",XMDUZ=DUZ
  1. K XMY S XMY(DUZ)="" D ENT1^XMD
  1. Q
  1. AUTOMSG N TSK D NOW^%DTC S DTE=$$FMTE^XLFDT(%,1),SITE=$P($G(PSXSYS),U,3) K %
  1. I $G(PSXCS)'=1 G NONCS ; If not controlled subs
  1. D OPTSTAT^XUTMOPT("PSXR SCHEDULED CS TRANS",.TSK)
  1. S DTTM=$P($G(TSK(1)),U,2),NUM=+$P($G(TSK(1)),U,3),THRU=$$GET1^DIQ(550,+PSXSYS,12)
  1. G MSG1
  1. NONCS ;
  1. D OPTSTAT^XUTMOPT("PSXR SCHEDULED NON-CS TRANS",.TSK)
  1. S DTTM=$P($G(TSK(1)),U,2),NUM=+$P($G(TSK(1)),U,3),THRU=$$GET1^DIQ(550,+PSXSYS,11)
  1. MSG1 S XMDUZ=.5,XMSUB="CMOP "_$S($G(PSXCS)=1:"CS ",1:"")_"Auto-Transmission Schedule",LCNT=1
  1. I DTTM S Y=DTTM X ^DD("DD") S DTTM=Y I 1
  1. E S DTTM="NONE - Canceled",(NUM,THRU)=""
  1. D XMZ^XMA2 G:XMZ<1 AUTOMSG
  1. S ^XMB(3.9,XMZ,2,LCNT,0)=$S(DTTM["NONE":"<CANCEL> ",1:"")_$S($G(PSXCS)=1:"CS ",1:"")_"Auto-transmission Schedule.",LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="",LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="Facility : "_SITE,LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="Date Initiated : "_$P(DTE,":",1,2),LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="Begin Automatic Transmissions : "_DTTM,LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="Number of days to transmit thru: "_$S((($G(THRU)'>0)&(+NUM)):"Current date",1:$G(THRU)),LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="Scheduling Frequency (hours) : "_NUM,LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,LCNT,0)="Initiating Official : "_$$GET1^DIQ(200,DUZ,.01),LCNT=LCNT+1
  1. S ^XMB(3.9,XMZ,2,0)="^3.92A^"_LCNT_"^"_LCNT_"^"_DT,XMDUN="CMOP Manager"
  1. K XMY S XMDUZ=.5
  1. D GRP^PSXNOTE
  1. ;S XMY(DUZ)=""
  1. D ENT1^XMD
  1. Q
  1. GRP I '$D(^XUSEC("PSXMAIL")) G GRP1
  1. F MDUZ=0:0 S MDUZ=$O(^XUSEC("PSXMAIL",MDUZ)) Q:MDUZ'>0 S XMY(MDUZ)="",XQA(MDUZ)=""
  1. K MDUZ
  1. G:'$D(XMY) GRP1
  1. Q
  1. GRP1 F XDUZ=0:0 S XDUZ=$O(^XUSEC("PSXCMOPMGR",XDUZ)) Q:XDUZ'>0 S XMY(XDUZ)="",XQA(XDUZ)=""
  1. K XDUZ
  1. Q
  1. ;
  1. RXAPI1(IEN,FLD,FORMAT) ;
  1. ; Use standard PRE APIs to get Prescription data
  1. ; Reference to DIQ^PSODI supported by DBIA #4858
  1. ;
  1. ; Input
  1. ; IEN: Prescription file IEN
  1. ; FLD: Prescription field
  1. ; FORMAT: E-External (Default)
  1. ; I-Internal
  1. ; N-Do not return nulls
  1. ; Output: Data from Prescription in requested format
  1. ;
  1. I '$G(IEN)!($G(FLD)="") Q ""
  1. N DIQ,DIC,PSXARR,X,Y,D0,PSODIY
  1. N I,J,C,DA,DRS,DIL,DI,DIQ1,PSXDIQ
  1. S PSXDIQ="PSXARR"
  1. S PSXDIQ(0)=$S($G(FORMAT)="":"E",1:FORMAT)
  1. D DIQ^PSODI(52,52,.FLD,.IEN,.PSXDIQ) ;DBIA 4858
  1. Q $S(PSXDIQ(0)="N":$G(PSXARR(52,IEN,FLD)),1:$G(PSXARR(52,IEN,FLD,PSXDIQ(0))))
  1. ;
  1. ECME(RX) ;
  1. ; Returns "e" if last Rx/Refill is Electronically Billable (3rd party)
  1. ; Reference to STATUS^PSOBPSUT supported by DBIA #4701
  1. ;
  1. ; Input:
  1. ; RX: Prescription IEN (required)
  1. ; Output:
  1. ; Null: Not electronically billable to ePharmacy
  1. ; 'e': Electronically billable to ePharmacy
  1. ;
  1. I '$G(RX) Q ""
  1. Q $S($$STATUS^PSOBPSUT(RX)'="":"e",1:"")