PSO770PI ;BHAM/MFR - PSO*7*770 POST-INSTALL; 09/12/2024 11:24Am
;;7.0;OUTPATIENT PHARMACY;**770**;DEC 1997;Build 145
;
EN ; Entry Point
N PSOROOT,MBMSITE,DIK,X,NEWC,NEWCODE,FDASCR,SCRIEN,PSOERR,TEXT1,TEXT2,II,DA,CODEIEN,CODEDESC,PROTCL,RPROTCL,REMCODE,DIC,DIE,DA
D BMES^XPDUTL("Starting post-install for PSO*7*770 at "_$$FMTE^XLFDT($$NOW^XLFDT()))
;
; Fixing an issue caused by KIDS Build Installation
S RPROTCL=$O(^ORD(101,"B","PSO ERX RESEND CHANGE REQUEST",0))
S PROTCL=0 F S PROTCL=$O(^ORD(101,PROTCL)) Q:'PROTCL D
. I '$D(^ORD(101,PROTCL,10,"B",RPROTCL)) Q
. S SUBIEN=$O(^ORD(101,PROTCL,10,"B",RPROTCL,0)) I 'SUBIEN Q
. I $$GET1^DIQ(101,PROTCL,.01)="PSO ERX HIDDEN ACTIONS" Q
. K DIK S DIK="^ORD(101,"_PROTCL_",10,",DA(1)=PROTCL,DA=SUBIEN D ^DIK
;
; Renaming CAP code
S CODEIEN=$O(^PS(52.45,"B","CAP",0))
I CODEIEN D
. S DIE="^PS(52.45,",DA=CODEIEN,DR=".02///UNABLE TO FIND ORIGINAL ERX" D ^DIE
;
; New Remove Codes
F REMCODE="REM81","REM82","REM83" D
. I $D(^PS(52.45,"B",REMCODE)) Q
. K DIC S DIC="^PS(52.45,",DIC(0)="",X=REMCODE
. I REMCODE="REM81" S DIC("DR")=".02///Prior Authorization Denied;.03///REM"
. I REMCODE="REM82" S DIC("DR")=".02///No Community Care Authorization for this Prescription;.03///REM"
. I REMCODE="REM83" S DIC("DR")=".02///Patient Not Found in Local VA Database;.03///REM"
. D FILE^DICN
;
; Scheduling new DEA/DOJ Nightly Data Update Job
D BMES^XPDUTL("Scheduling PSO DEA/DOJ NIGHTLY DATA UPDATE Job... "_$$FMTE^XLFDT($$NOW^XLFDT()))
D OPTSTAT^XUTMOPT("PSO DEA/DOJ NIGHTLY DATA UPD",.PSOROOT)
I '+$G(PSOROOT(1)) D RESCH^XUTMOPT("PSO DEA/DOJ NIGHTLY DATA UPD",$$FMADD^XLFDT(DT,1)+.02,"","24H","L")
;
S MBMSITE=$S($$GET1^DIQ(59.7,1,102,"I")="MBM":1,1:0)
; Building "AVDRG" x-reference for the VistA Drug Name Search in Rx Medication Screen Search Queue(SQ)
I '$D(^PS(52.49,"AVDRG")) D
. D BMES^XPDUTL("Building VistA Drug x-reference... "_$$FMTE^XLFDT($$NOW^XLFDT()))
. S DIK="^PS(52.49,",DIK(1)="3.2^AVDRG" D ENALL^DIK
;
; Killing (resetting) New Codes
F II=1:1 S NEWC=$T(NEWCODES+II) Q:NEWC["END" D
. K NEWCODE S NEWCODE=$P(NEWC,";;",2),DIK="^PS(52.45,"
. I $D(^PS(52.45,"B",$P(NEWCODE,"^",1))) S DA=$O(^PS(52.45,"B",$P(NEWCODE,"^",1),0)) I DA D ^DIK
;
; Adding new Codes
F II=1:1 S NEWC=$T(NEWCODES+II) Q:NEWC["END" D
. K NEWCODE S NEWCODE=$P(NEWC,";;",2)
. I '$D(^PS(52.45,"B",$P(NEWCODE,"^",1))) D
. . K FDASCR
. . S FDASCR(52.45,"+1,",.01)=$P(NEWCODE,"^",1)
. . S FDASCR(52.45,"+1,",.02)=$P(NEWCODE,"^",2)
. . S FDASCR(52.45,"+1,",.03)=$P(NEWCODE,"^",3)
. . S FDASCR(52.45,"+1,",.04)=$S($P(NEWCODE,"^",2)="SCR":"SCRIPT CLARIFICATION REASON",1:"THERAPEUTIC INTERCHANGE/SUBSTITUTION REASON")
. . D NEWTXTS($P(NEWCODE,"^",1),.FDASCR)
. . K PSOERR,SCRIEN D UPDATE^DIE(,"FDASCR","SCRIEN","PSOERR")
. . K FDASCR
;
I 'MBMSITE D
. F NEWCODE="PS","OS","P" D
. . S CODEDESC=$S(NEWCODE="P":"Prior Authorization Required",NEWCODE="PS":"Product Selection Opportunity",1:"Out of Stock")
. . S CODEIEN=$O(^PS(52.45,"D",CODEDESC,0)) I 'CODEIEN Q
. . K FDASCR,PSOERR D NEWTXTS(NEWCODE,.FDASCR,CODEIEN) I '$D(FDASCR) Q
. . K PSOERR,SCRIEN D UPDATE^DIE(,"FDASCR","SCRIEN","PSOERR")
;
; Update the FULL DESCRIPTION field for the following eRx Service Reason Codes (D, G, OS, P, S, T, and U)
D UPDTESRC
;
;create the new TIU NOTE title for Dispense Drug Replacement
D CREATEPN("PHARMACY SERVICE","PHARMACY PROGRESS NOTE","PHARMACY RX DRUG REPLACEMENT") ;create new eRx Progress Notes Title in File #8925.1
;
D BMES^XPDUTL("Post-install for PSO*7*770 completed successfully at "_$$FMTE^XLFDT($$NOW^XLFDT()))
Q
;
NEWTXTS(SCRC,FDASCR,CODEIEN) ;
Q:$G(SCRC)=""
N SCRCODE,FOUND
S SCRCODE=$P(SCRC,"^",1),FOUND=0
K TEXT1 ;Full Description field #20
K TEXT2 ;Change Request Reason Text field #21
I SCRCODE="PRN" D
. S TEXT1(1,0)="Indicates that the prescription received is missing dose and/or frequency"
. S TEXT1(2,0)="guidelines."
. S TEXT2(1,0)="VA policy prohibits filling prescriptions with only ""AS NEEDED"" for"
. S TEXT2(2,0)="directions. Please indicate frequency of administration."
. S FOUND=1
;
I SCRCODE="UDD" D
. S TEXT1(1,0)="Indicates that the prescription received is missing dose and/or frequency"
. S TEXT1(2,0)="guidelines."
. S TEXT2(1,0)="VA policy prohibits filling prescriptions with only ""AS DIRECTED"""
. S TEXT2(2,0)="directions. Please indicate frequency of administration."
. S FOUND=1
;
I SCRCODE="COD" D
. S TEXT1(1,0)="Indicates that the prescription received has conflicting directions."
. S TEXT2(1,0)="This prescription contains conflicting directions. Please verify which"
. S TEXT2(2,0)="directions are to be followed."
. S FOUND=1
;
I SCRCODE="MSD" D
. S TEXT1(1,0)="Indicates that the prescription received has incomplete directions for use."
. S TEXT2(1,0)="Please provide the complete set of patient instructions."
. S FOUND=1
;
I SCRCODE="RIJ" D
. S TEXT1(1,0)="Indicates that the prescription received is missing the route of injection"
. S TEXT1(2,0)="for medication."
. S TEXT2(1,0)="Please verify the ROUTE of injection."
. S FOUND=1
;
I SCRCODE="VEF" D
. S TEXT1(1,0)="Indicates that the prescription received is missing the formulation of"
. S TEXT1(2,0)="medication to dispense."
. S TEXT2(1,0)="Please verify which formulation should be dispensed."
. S FOUND=1
;
I SCRCODE="VLQ" D
. S TEXT1(1,0)="Indicates the prescription received has a written quantity that is less"
. S TEXT1(2,0)="than typical prescribing."
. S TEXT2(1,0)="The quantity written is less than typically prescribed. Please verify the"
. S TEXT2(2,0)="quantity to dispense."
. S FOUND=1
;
I SCRCODE="VPQ" D
. S TEXT1(1,0)="Indicates the prescription received has a written quantity that is less"
. S TEXT1(2,0)="than smallest available quantity to dispense from the pharmacy."
. S TEXT2(1,0)="Please verify the quantity to dispense. Our filling sites are only able to"
. S TEXT2(2,0)="provide this product in quantities of [QUANTITY], which is more than the"
. S TEXT2(3,0)="total quantity prescribed."
. S FOUND=1
;
I SCRCODE="AUT" D
. S TEXT1(1,0)="Indicates the Prescriber is not authorized by VA to see this patient."
. S TEXT2(1,0)="VA records show this patient does not have active authorization for care"
. S TEXT2(2,0)="from your office. This prescription will be removed from the VA system."
. S TEXT2(3,0)="For authorization questions, patients or providers can call the VA Office"
. S TEXT2(4,0)="of Community Care at [PHONE_NUMBER]."
. S FOUND=1
;
I SCRCODE="PS" D
. S TEXT2(1,0)="Pharmacy is unable to provide this medication. Please approve an option"
. S TEXT2(2,0)=" below or cancel rx."
. S TEXT2(3,0)="VA Formulary: https://www.domain.ext/formularyadvisor/"
. S FOUND=1
;
I SCRCODE="OS" D
. S TEXT2(1,0)="The medication prescribed is currently out of stock. Please submit"
. S TEXT2(2,0)="a new Rx from the option(s) below."
. S TEXT2(3,0)="VA Formulary: https://www.domain.ext/formularyadvisor/"
. S FOUND=1
;
I SCRCODE="P" D
. S TEXT2(1,0)="This product requires a prior authorization. Please call the VA Pharmacy"
. S TEXT2(2,0)="at [PHONE_NUMBER] to discuss."
. S TEXT2(3,0)="VA Formulary: https://www.domain.ext/formularyadvisor/"
. S FOUND=1
;
I SCRCODE="FMC" D
. S TEXT1(1,0)="Indicates Pharmacy is unable to supply medication as prescribed."
. S TEXT2(1,0)="Pharmacy is unable to supply medication as prescribed; however, alternative"
. S TEXT2(2,0)="options may exist. Please approve an option below or Cancel Rx and send a"
. S TEXT2(3,0)="replacement."
. S FOUND=1
;
I SCRCODE="DSC" D
. S TEXT1(1,0)="Indicates a change in the days supply for the medication prescribed."
. S TEXT2(1,0)="Pharmacy would like to dispense this medication for 90 days of supply"
. S TEXT2(2,0)="instead 30 days. Please approve the 90-days option below or Cancel Rx and"
. S TEXT2(3,0)="send a replacement."
. S FOUND=1
;
I FOUND D
. S:$D(TEXT1) FDASCR(52.45,"+1,",1)="TEXT1"
. S:$D(TEXT2) FDASCR(52.45,$S($G(CODEIEN):CODEIEN,1:"+1")_",",20)="TEXT2"
Q
;
NEWCODES ; List of new Codes for file #52.45
;;PRN^PRN Directions^SCR
;;UDD^As Directed Directions^SCR
;;COD^Conflicting Directions^SCR
;;MSD^Missing Directions^SCR
;;RIJ^Route of Injection^SCR
;;VEF^Verify Formulation^SCR
;;VLQ^Verify Low Quantity^SCR
;;VPQ^Verify Package Quantity^SCR
;;AUT^Prescriber Not Authorized^SCR
;;DSC^Days Supply Change^TIS
;;FMC^Formulary Change^TIS
;;END
Q
;
UPDTESRC ;Update ERX SERVICE REASON CODES
S CODE=$O(^PS(52.45,"D","DUE (Drug Use Evaluation) ",0))
I CODE D
. K ^PS(52.45,CODE,1)
. K TEXT,REATXT
. S TEXT(1,0)="May be used to request a prescriber authorize a change to the patient's"
. S TEXT(2,0)="current medication therapy, such as a dosing regimen or an alternative"
. S TEXT(3,0)="medication that will have fewer, or no, adverse effects than the original"
. S TEXT(4,0)="prescription."
. S REATXT(52.45,CODE_",",1)="TEXT"
. K DIERR D UPDATE^DIE("","REATXT")
;
S CODE=$O(^PS(52.45,"D","Generic Substitution",0))
I CODE D
. K ^PS(52.45,CODE,1)
. K TEXT,REATXT
. S TEXT(1,0)="May be used to request a prescriber allow the dispensing of a generic"
. S TEXT(2,0)="medication when substitution is not allowed by the prescriber or"
. S TEXT(3,0)="regulations."
. S REATXT(52.45,CODE_",",1)="TEXT"
. K DIERR D UPDATE^DIE("","REATXT")
;
S CODE=$O(^PS(52.45,"D","Out of Stock",0))
I CODE D
. K ^PS(52.45,CODE,1)
. K TEXT,REATXT
. S TEXT(1,0)="May be used to request a prescriber authorize a change to the original"
. S TEXT(2,0)="prescription due to the pharmacy being out of stock of the requested"
. S TEXT(3,0)="medication."
. S REATXT(52.45,CODE_",",1)="TEXT"
. K DIERR D UPDATE^DIE("","REATXT")
;
S CODE=$O(^PS(52.45,"D","Prior Authorization Required",0))
I CODE D
. K ^PS(52.45,CODE,1)
. K TEXT,REATXT
. S TEXT(1,0)="May be used to request a prescriber review the drug requested and obtain a"
. S TEXT(2,0)="prior authorization from the payer for the existing prescription."
. ;S TEXT(3,0)=" NOTE: The PriorAuthorization RxChangeResponse, unlike the other"
. ;S TEXT(4,0)=" responses, is not considered a fillable message, cannot"
. ;S TEXT(5,0)=" be used for medication changes and does not have to be"
. ;S TEXT(6,0)=" digitally signed."
. S REATXT(52.45,CODE_",",1)="TEXT"
. K DIERR D UPDATE^DIE("","REATXT")
;
S CODE=$O(^PS(52.45,"D","Script Clarification",0))
I CODE D
. K ^PS(52.45,CODE,1)
. K TEXT,REATXT
. S TEXT(1,0)="May be used to request a prescriber clarify the original prescription."
. S REATXT(52.45,CODE_",",1)="TEXT"
. K DIERR D UPDATE^DIE("","REATXT")
;
S CODE=$O(^PS(52.45,"D","Therapeutic Interchange/Substi",0))
I CODE D
. K ^PS(52.45,CODE,1)
. K TEXT,REATXT
. S TEXT(1,0)="May be used to request a prescriber authorize a therapy change to the"
. S TEXT(2,0)="prescription. This includes the workflow where a pharmacy requests a"
. S TEXT(3,0)="30-90 day quantity or a formulary change."
. S REATXT(52.45,CODE_",",1)="TEXT"
. K DIERR D UPDATE^DIE("","REATXT")
;
S CODE=$O(^PS(52.45,"D","Prescriber Authorization",0))
I CODE D
. K ^PS(52.45,CODE,1)
. K TEXT,REATXT
. S TEXT(1,0)="May be used to request a prescriber authorization information, such as"
. S TEXT(2,0)="confirming their DEA number or enrollment with the prescription benefit"
. S TEXT(3,0)="plan. Denied and Validated are the only acceptable RxChangeResponse types"
. S TEXT(4,0)="for this workflow. Use the elements in the Validated response type to return"
. S TEXT(5,0)="the requested information."
. S REATXT(52.45,CODE_",",1)="TEXT"
. K DIERR D UPDATE^DIE("","REATXT")
;
S CODE=$O(^PS(52.45,"D","Prescriber must enroll/re-enro",0))
I CODE D
. K ^PS(52.45,CODE,1)
. K TEXT,REATXT
. S TEXT(1,0)="Expired or no authorization on file with VA. Fax RFS Form (VA 10-10172) to"
. S TEXT(2,0)="[ADD_TEXT_HERE] to request auth, or send Rx to non-VA pharmacy (not covered"
. S TEXT(3,0)="by VA). Rx will be cancelled at this time, resend upon approval including"
. S TEXT(4,0)="authorization #."
. S REATXT(52.45,CODE_",",1)="TEXT"
. K DIERR D UPDATE^DIE("","REATXT")
Q
;
CREATEPN(PARNTDOC,STDTITLE,TITLE) ;
;Input: PARNTDOC - Name of the desired parent in File #8925.1
; STDTITLE - Name of the VHA Enterprise Standard Title in File #8926.1
; TITLE - Name of the desired title in File #8925.1
;Output: Create a new entry TIU NOTE Title in File #8925.1
;
N FOUNDDOC,FOUNDSTD,MES,RESULT
;check parent document class PHARMACY SERVICE
S FOUNDDOC=$$FIND1^DIC(8925.1,"","X",PARNTDOC,"B")
;
; check VHA Enterprise Standard Title PHARMACY PROGRESS NOTE
S FOUNDSTD=$$FIND1^DIC(8926.1,"","X",STDTITLE,"B")
;
S MES(1)=""
;if PHARMACY SERVICE and PHARMACY PROGRESS NOTE exist, attach and map the new ERX RX CHANGE REQUEST NOTE TIU Note Title
I +FOUNDDOC,+FOUNDSTD D Q
. S RESULT=$$CRDD^TIUCRDD(TITLE,"DOC","ACTIVE",PARNTDOC,STDTITLE)
. I '+RESULT D Q
. . S MES(2)=$S(RESULT["already exists":$P(RESULT,U,2)_" No action taken.",1:"Installation Error: "_$P(RESULT,U,2))
. . S MES(3)=""
. . D MES^XPDUTL(.MES)
. S MES(2)="Successfully created "_TITLE_" in File #8925.1."
. S MES(3)=""
. D MES^XPDUTL(.MES)
;
;Otherwise, do not attach and map the new ERX RX REQUEST NOTE TIU Note Title
S MES(2)="Installation Error:"
S MES(3)=" The creation of the ERX RX CHANGE REQUEST NOTE TIU Title failed."
;
I '+FOUNDDOC,'+FOUNDSTD D ;both parent doc class and std title does not exist at the site
. S MES(4)=" * "_PARNTDOC_" Document Class not found."
. S MES(5)=" * VHA Enterprise Standard Title "_STDTITLE_" not found."
. S MES(6)=""
;
I '+FOUNDDOC,+FOUNDSTD D ;std title exist but parent doc class does not exist at the site
. S MES(4)=" * "_PARNTDOC_" Document Class not found."
. S MES(5)=""
;
I +FOUNDDOC,'+FOUNDSTD D ;parent doc exist but std title does not exist at the site
. S MES(4)=" * VHA Enterprise Standard Title "_STDTITLE_" not found."
. S MES(5)=""
;
D MES^XPDUTL(.MES)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSO770PI 14392 printed Aug 26, 2025@22:39:29 Page 2
PSO770PI ;BHAM/MFR - PSO*7*770 POST-INSTALL; 09/12/2024 11:24Am
+1 ;;7.0;OUTPATIENT PHARMACY;**770**;DEC 1997;Build 145
+2 ;
EN ; Entry Point
+1 NEW PSOROOT,MBMSITE,DIK,X,NEWC,NEWCODE,FDASCR,SCRIEN,PSOERR,TEXT1,TEXT2,II,DA,CODEIEN,CODEDESC,PROTCL,RPROTCL,REMCODE,DIC,DIE,DA
+2 DO BMES^XPDUTL("Starting post-install for PSO*7*770 at "_$$FMTE^XLFDT($$NOW^XLFDT()))
+3 ;
+4 ; Fixing an issue caused by KIDS Build Installation
+5 SET RPROTCL=$ORDER(^ORD(101,"B","PSO ERX RESEND CHANGE REQUEST",0))
+6 SET PROTCL=0
FOR
SET PROTCL=$ORDER(^ORD(101,PROTCL))
if 'PROTCL
QUIT
Begin DoDot:1
+7 IF '$DATA(^ORD(101,PROTCL,10,"B",RPROTCL))
QUIT
+8 SET SUBIEN=$ORDER(^ORD(101,PROTCL,10,"B",RPROTCL,0))
IF 'SUBIEN
QUIT
+9 IF $$GET1^DIQ(101,PROTCL,.01)="PSO ERX HIDDEN ACTIONS"
QUIT
+10 KILL DIK
SET DIK="^ORD(101,"_PROTCL_",10,"
SET DA(1)=PROTCL
SET DA=SUBIEN
DO ^DIK
End DoDot:1
+11 ;
+12 ; Renaming CAP code
+13 SET CODEIEN=$ORDER(^PS(52.45,"B","CAP",0))
+14 IF CODEIEN
Begin DoDot:1
+15 SET DIE="^PS(52.45,"
SET DA=CODEIEN
SET DR=".02///UNABLE TO FIND ORIGINAL ERX"
DO ^DIE
End DoDot:1
+16 ;
+17 ; New Remove Codes
+18 FOR REMCODE="REM81","REM82","REM83"
Begin DoDot:1
+19 IF $DATA(^PS(52.45,"B",REMCODE))
QUIT
+20 KILL DIC
SET DIC="^PS(52.45,"
SET DIC(0)=""
SET X=REMCODE
+21 IF REMCODE="REM81"
SET DIC("DR")=".02///Prior Authorization Denied;.03///REM"
+22 IF REMCODE="REM82"
SET DIC("DR")=".02///No Community Care Authorization for this Prescription;.03///REM"
+23 IF REMCODE="REM83"
SET DIC("DR")=".02///Patient Not Found in Local VA Database;.03///REM"
+24 DO FILE^DICN
End DoDot:1
+25 ;
+26 ; Scheduling new DEA/DOJ Nightly Data Update Job
+27 DO BMES^XPDUTL("Scheduling PSO DEA/DOJ NIGHTLY DATA UPDATE Job... "_$$FMTE^XLFDT($$NOW^XLFDT()))
+28 DO OPTSTAT^XUTMOPT("PSO DEA/DOJ NIGHTLY DATA UPD",.PSOROOT)
+29 IF '+$GET(PSOROOT(1))
DO RESCH^XUTMOPT("PSO DEA/DOJ NIGHTLY DATA UPD",$$FMADD^XLFDT(DT,1)+.02,"","24H","L")
+30 ;
+31 SET MBMSITE=$SELECT($$GET1^DIQ(59.7,1,102,"I")="MBM":1,1:0)
+32 ; Building "AVDRG" x-reference for the VistA Drug Name Search in Rx Medication Screen Search Queue(SQ)
+33 IF '$DATA(^PS(52.49,"AVDRG"))
Begin DoDot:1
+34 DO BMES^XPDUTL("Building VistA Drug x-reference... "_$$FMTE^XLFDT($$NOW^XLFDT()))
+35 SET DIK="^PS(52.49,"
SET DIK(1)="3.2^AVDRG"
DO ENALL^DIK
End DoDot:1
+36 ;
+37 ; Killing (resetting) New Codes
+38 FOR II=1:1
SET NEWC=$TEXT(NEWCODES+II)
if NEWC["END"
QUIT
Begin DoDot:1
+39 KILL NEWCODE
SET NEWCODE=$PIECE(NEWC,";;",2)
SET DIK="^PS(52.45,"
+40 IF $DATA(^PS(52.45,"B",$PIECE(NEWCODE,"^",1)))
SET DA=$ORDER(^PS(52.45,"B",$PIECE(NEWCODE,"^",1),0))
IF DA
DO ^DIK
End DoDot:1
+41 ;
+42 ; Adding new Codes
+43 FOR II=1:1
SET NEWC=$TEXT(NEWCODES+II)
if NEWC["END"
QUIT
Begin DoDot:1
+44 KILL NEWCODE
SET NEWCODE=$PIECE(NEWC,";;",2)
+45 IF '$DATA(^PS(52.45,"B",$PIECE(NEWCODE,"^",1)))
Begin DoDot:2
+46 KILL FDASCR
+47 SET FDASCR(52.45,"+1,",.01)=$PIECE(NEWCODE,"^",1)
+48 SET FDASCR(52.45,"+1,",.02)=$PIECE(NEWCODE,"^",2)
+49 SET FDASCR(52.45,"+1,",.03)=$PIECE(NEWCODE,"^",3)
+50 SET FDASCR(52.45,"+1,",.04)=$SELECT($PIECE(NEWCODE,"^",2)="SCR":"SCRIPT CLARIFICATION REASON",1:"THERAPEUTIC INTERCHANGE/SUBSTITUTION REASON")
+51 DO NEWTXTS($PIECE(NEWCODE,"^",1),.FDASCR)
+52 KILL PSOERR,SCRIEN
DO UPDATE^DIE(,"FDASCR","SCRIEN","PSOERR")
+53 KILL FDASCR
End DoDot:2
End DoDot:1
+54 ;
+55 IF 'MBMSITE
Begin DoDot:1
+56 FOR NEWCODE="PS","OS","P"
Begin DoDot:2
+57 SET CODEDESC=$SELECT(NEWCODE="P":"Prior Authorization Required",NEWCODE="PS":"Product Selection Opportunity",1:"Out of Stock")
+58 SET CODEIEN=$ORDER(^PS(52.45,"D",CODEDESC,0))
IF 'CODEIEN
QUIT
+59 KILL FDASCR,PSOERR
DO NEWTXTS(NEWCODE,.FDASCR,CODEIEN)
IF '$DATA(FDASCR)
QUIT
+60 KILL PSOERR,SCRIEN
DO UPDATE^DIE(,"FDASCR","SCRIEN","PSOERR")
End DoDot:2
End DoDot:1
+61 ;
+62 ; Update the FULL DESCRIPTION field for the following eRx Service Reason Codes (D, G, OS, P, S, T, and U)
+63 DO UPDTESRC
+64 ;
+65 ;create the new TIU NOTE title for Dispense Drug Replacement
+66 ;create new eRx Progress Notes Title in File #8925.1
DO CREATEPN("PHARMACY SERVICE","PHARMACY PROGRESS NOTE","PHARMACY RX DRUG REPLACEMENT")
+67 ;
+68 DO BMES^XPDUTL("Post-install for PSO*7*770 completed successfully at "_$$FMTE^XLFDT($$NOW^XLFDT()))
+69 QUIT
+70 ;
NEWTXTS(SCRC,FDASCR,CODEIEN) ;
+1 if $GET(SCRC)=""
QUIT
+2 NEW SCRCODE,FOUND
+3 SET SCRCODE=$PIECE(SCRC,"^",1)
SET FOUND=0
+4 ;Full Description field #20
KILL TEXT1
+5 ;Change Request Reason Text field #21
KILL TEXT2
+6 IF SCRCODE="PRN"
Begin DoDot:1
+7 SET TEXT1(1,0)="Indicates that the prescription received is missing dose and/or frequency"
+8 SET TEXT1(2,0)="guidelines."
+9 SET TEXT2(1,0)="VA policy prohibits filling prescriptions with only ""AS NEEDED"" for"
+10 SET TEXT2(2,0)="directions. Please indicate frequency of administration."
+11 SET FOUND=1
End DoDot:1
+12 ;
+13 IF SCRCODE="UDD"
Begin DoDot:1
+14 SET TEXT1(1,0)="Indicates that the prescription received is missing dose and/or frequency"
+15 SET TEXT1(2,0)="guidelines."
+16 SET TEXT2(1,0)="VA policy prohibits filling prescriptions with only ""AS DIRECTED"""
+17 SET TEXT2(2,0)="directions. Please indicate frequency of administration."
+18 SET FOUND=1
End DoDot:1
+19 ;
+20 IF SCRCODE="COD"
Begin DoDot:1
+21 SET TEXT1(1,0)="Indicates that the prescription received has conflicting directions."
+22 SET TEXT2(1,0)="This prescription contains conflicting directions. Please verify which"
+23 SET TEXT2(2,0)="directions are to be followed."
+24 SET FOUND=1
End DoDot:1
+25 ;
+26 IF SCRCODE="MSD"
Begin DoDot:1
+27 SET TEXT1(1,0)="Indicates that the prescription received has incomplete directions for use."
+28 SET TEXT2(1,0)="Please provide the complete set of patient instructions."
+29 SET FOUND=1
End DoDot:1
+30 ;
+31 IF SCRCODE="RIJ"
Begin DoDot:1
+32 SET TEXT1(1,0)="Indicates that the prescription received is missing the route of injection"
+33 SET TEXT1(2,0)="for medication."
+34 SET TEXT2(1,0)="Please verify the ROUTE of injection."
+35 SET FOUND=1
End DoDot:1
+36 ;
+37 IF SCRCODE="VEF"
Begin DoDot:1
+38 SET TEXT1(1,0)="Indicates that the prescription received is missing the formulation of"
+39 SET TEXT1(2,0)="medication to dispense."
+40 SET TEXT2(1,0)="Please verify which formulation should be dispensed."
+41 SET FOUND=1
End DoDot:1
+42 ;
+43 IF SCRCODE="VLQ"
Begin DoDot:1
+44 SET TEXT1(1,0)="Indicates the prescription received has a written quantity that is less"
+45 SET TEXT1(2,0)="than typical prescribing."
+46 SET TEXT2(1,0)="The quantity written is less than typically prescribed. Please verify the"
+47 SET TEXT2(2,0)="quantity to dispense."
+48 SET FOUND=1
End DoDot:1
+49 ;
+50 IF SCRCODE="VPQ"
Begin DoDot:1
+51 SET TEXT1(1,0)="Indicates the prescription received has a written quantity that is less"
+52 SET TEXT1(2,0)="than smallest available quantity to dispense from the pharmacy."
+53 SET TEXT2(1,0)="Please verify the quantity to dispense. Our filling sites are only able to"
+54 SET TEXT2(2,0)="provide this product in quantities of [QUANTITY], which is more than the"
+55 SET TEXT2(3,0)="total quantity prescribed."
+56 SET FOUND=1
End DoDot:1
+57 ;
+58 IF SCRCODE="AUT"
Begin DoDot:1
+59 SET TEXT1(1,0)="Indicates the Prescriber is not authorized by VA to see this patient."
+60 SET TEXT2(1,0)="VA records show this patient does not have active authorization for care"
+61 SET TEXT2(2,0)="from your office. This prescription will be removed from the VA system."
+62 SET TEXT2(3,0)="For authorization questions, patients or providers can call the VA Office"
+63 SET TEXT2(4,0)="of Community Care at [PHONE_NUMBER]."
+64 SET FOUND=1
End DoDot:1
+65 ;
+66 IF SCRCODE="PS"
Begin DoDot:1
+67 SET TEXT2(1,0)="Pharmacy is unable to provide this medication. Please approve an option"
+68 SET TEXT2(2,0)=" below or cancel rx."
+69 SET TEXT2(3,0)="VA Formulary: https://www.domain.ext/formularyadvisor/"
+70 SET FOUND=1
End DoDot:1
+71 ;
+72 IF SCRCODE="OS"
Begin DoDot:1
+73 SET TEXT2(1,0)="The medication prescribed is currently out of stock. Please submit"
+74 SET TEXT2(2,0)="a new Rx from the option(s) below."
+75 SET TEXT2(3,0)="VA Formulary: https://www.domain.ext/formularyadvisor/"
+76 SET FOUND=1
End DoDot:1
+77 ;
+78 IF SCRCODE="P"
Begin DoDot:1
+79 SET TEXT2(1,0)="This product requires a prior authorization. Please call the VA Pharmacy"
+80 SET TEXT2(2,0)="at [PHONE_NUMBER] to discuss."
+81 SET TEXT2(3,0)="VA Formulary: https://www.domain.ext/formularyadvisor/"
+82 SET FOUND=1
End DoDot:1
+83 ;
+84 IF SCRCODE="FMC"
Begin DoDot:1
+85 SET TEXT1(1,0)="Indicates Pharmacy is unable to supply medication as prescribed."
+86 SET TEXT2(1,0)="Pharmacy is unable to supply medication as prescribed; however, alternative"
+87 SET TEXT2(2,0)="options may exist. Please approve an option below or Cancel Rx and send a"
+88 SET TEXT2(3,0)="replacement."
+89 SET FOUND=1
End DoDot:1
+90 ;
+91 IF SCRCODE="DSC"
Begin DoDot:1
+92 SET TEXT1(1,0)="Indicates a change in the days supply for the medication prescribed."
+93 SET TEXT2(1,0)="Pharmacy would like to dispense this medication for 90 days of supply"
+94 SET TEXT2(2,0)="instead 30 days. Please approve the 90-days option below or Cancel Rx and"
+95 SET TEXT2(3,0)="send a replacement."
+96 SET FOUND=1
End DoDot:1
+97 ;
+98 IF FOUND
Begin DoDot:1
+99 if $DATA(TEXT1)
SET FDASCR(52.45,"+1,",1)="TEXT1"
+100 if $DATA(TEXT2)
SET FDASCR(52.45,$SELECT($GET(CODEIEN):CODEIEN,1:"+1")_",",20)="TEXT2"
End DoDot:1
+101 QUIT
+102 ;
NEWCODES ; List of new Codes for file #52.45
+1 ;;PRN^PRN Directions^SCR
+2 ;;UDD^As Directed Directions^SCR
+3 ;;COD^Conflicting Directions^SCR
+4 ;;MSD^Missing Directions^SCR
+5 ;;RIJ^Route of Injection^SCR
+6 ;;VEF^Verify Formulation^SCR
+7 ;;VLQ^Verify Low Quantity^SCR
+8 ;;VPQ^Verify Package Quantity^SCR
+9 ;;AUT^Prescriber Not Authorized^SCR
+10 ;;DSC^Days Supply Change^TIS
+11 ;;FMC^Formulary Change^TIS
+12 ;;END
+13 QUIT
+14 ;
UPDTESRC ;Update ERX SERVICE REASON CODES
+1 SET CODE=$ORDER(^PS(52.45,"D","DUE (Drug Use Evaluation) ",0))
+2 IF CODE
Begin DoDot:1
+3 KILL ^PS(52.45,CODE,1)
+4 KILL TEXT,REATXT
+5 SET TEXT(1,0)="May be used to request a prescriber authorize a change to the patient's"
+6 SET TEXT(2,0)="current medication therapy, such as a dosing regimen or an alternative"
+7 SET TEXT(3,0)="medication that will have fewer, or no, adverse effects than the original"
+8 SET TEXT(4,0)="prescription."
+9 SET REATXT(52.45,CODE_",",1)="TEXT"
+10 KILL DIERR
DO UPDATE^DIE("","REATXT")
End DoDot:1
+11 ;
+12 SET CODE=$ORDER(^PS(52.45,"D","Generic Substitution",0))
+13 IF CODE
Begin DoDot:1
+14 KILL ^PS(52.45,CODE,1)
+15 KILL TEXT,REATXT
+16 SET TEXT(1,0)="May be used to request a prescriber allow the dispensing of a generic"
+17 SET TEXT(2,0)="medication when substitution is not allowed by the prescriber or"
+18 SET TEXT(3,0)="regulations."
+19 SET REATXT(52.45,CODE_",",1)="TEXT"
+20 KILL DIERR
DO UPDATE^DIE("","REATXT")
End DoDot:1
+21 ;
+22 SET CODE=$ORDER(^PS(52.45,"D","Out of Stock",0))
+23 IF CODE
Begin DoDot:1
+24 KILL ^PS(52.45,CODE,1)
+25 KILL TEXT,REATXT
+26 SET TEXT(1,0)="May be used to request a prescriber authorize a change to the original"
+27 SET TEXT(2,0)="prescription due to the pharmacy being out of stock of the requested"
+28 SET TEXT(3,0)="medication."
+29 SET REATXT(52.45,CODE_",",1)="TEXT"
+30 KILL DIERR
DO UPDATE^DIE("","REATXT")
End DoDot:1
+31 ;
+32 SET CODE=$ORDER(^PS(52.45,"D","Prior Authorization Required",0))
+33 IF CODE
Begin DoDot:1
+34 KILL ^PS(52.45,CODE,1)
+35 KILL TEXT,REATXT
+36 SET TEXT(1,0)="May be used to request a prescriber review the drug requested and obtain a"
+37 SET TEXT(2,0)="prior authorization from the payer for the existing prescription."
+38 ;S TEXT(3,0)=" NOTE: The PriorAuthorization RxChangeResponse, unlike the other"
+39 ;S TEXT(4,0)=" responses, is not considered a fillable message, cannot"
+40 ;S TEXT(5,0)=" be used for medication changes and does not have to be"
+41 ;S TEXT(6,0)=" digitally signed."
+42 SET REATXT(52.45,CODE_",",1)="TEXT"
+43 KILL DIERR
DO UPDATE^DIE("","REATXT")
End DoDot:1
+44 ;
+45 SET CODE=$ORDER(^PS(52.45,"D","Script Clarification",0))
+46 IF CODE
Begin DoDot:1
+47 KILL ^PS(52.45,CODE,1)
+48 KILL TEXT,REATXT
+49 SET TEXT(1,0)="May be used to request a prescriber clarify the original prescription."
+50 SET REATXT(52.45,CODE_",",1)="TEXT"
+51 KILL DIERR
DO UPDATE^DIE("","REATXT")
End DoDot:1
+52 ;
+53 SET CODE=$ORDER(^PS(52.45,"D","Therapeutic Interchange/Substi",0))
+54 IF CODE
Begin DoDot:1
+55 KILL ^PS(52.45,CODE,1)
+56 KILL TEXT,REATXT
+57 SET TEXT(1,0)="May be used to request a prescriber authorize a therapy change to the"
+58 SET TEXT(2,0)="prescription. This includes the workflow where a pharmacy requests a"
+59 SET TEXT(3,0)="30-90 day quantity or a formulary change."
+60 SET REATXT(52.45,CODE_",",1)="TEXT"
+61 KILL DIERR
DO UPDATE^DIE("","REATXT")
End DoDot:1
+62 ;
+63 SET CODE=$ORDER(^PS(52.45,"D","Prescriber Authorization",0))
+64 IF CODE
Begin DoDot:1
+65 KILL ^PS(52.45,CODE,1)
+66 KILL TEXT,REATXT
+67 SET TEXT(1,0)="May be used to request a prescriber authorization information, such as"
+68 SET TEXT(2,0)="confirming their DEA number or enrollment with the prescription benefit"
+69 SET TEXT(3,0)="plan. Denied and Validated are the only acceptable RxChangeResponse types"
+70 SET TEXT(4,0)="for this workflow. Use the elements in the Validated response type to return"
+71 SET TEXT(5,0)="the requested information."
+72 SET REATXT(52.45,CODE_",",1)="TEXT"
+73 KILL DIERR
DO UPDATE^DIE("","REATXT")
End DoDot:1
+74 ;
+75 SET CODE=$ORDER(^PS(52.45,"D","Prescriber must enroll/re-enro",0))
+76 IF CODE
Begin DoDot:1
+77 KILL ^PS(52.45,CODE,1)
+78 KILL TEXT,REATXT
+79 SET TEXT(1,0)="Expired or no authorization on file with VA. Fax RFS Form (VA 10-10172) to"
+80 SET TEXT(2,0)="[ADD_TEXT_HERE] to request auth, or send Rx to non-VA pharmacy (not covered"
+81 SET TEXT(3,0)="by VA). Rx will be cancelled at this time, resend upon approval including"
+82 SET TEXT(4,0)="authorization #."
+83 SET REATXT(52.45,CODE_",",1)="TEXT"
+84 KILL DIERR
DO UPDATE^DIE("","REATXT")
End DoDot:1
+85 QUIT
+86 ;
CREATEPN(PARNTDOC,STDTITLE,TITLE) ;
+1 ;Input: PARNTDOC - Name of the desired parent in File #8925.1
+2 ; STDTITLE - Name of the VHA Enterprise Standard Title in File #8926.1
+3 ; TITLE - Name of the desired title in File #8925.1
+4 ;Output: Create a new entry TIU NOTE Title in File #8925.1
+5 ;
+6 NEW FOUNDDOC,FOUNDSTD,MES,RESULT
+7 ;check parent document class PHARMACY SERVICE
+8 SET FOUNDDOC=$$FIND1^DIC(8925.1,"","X",PARNTDOC,"B")
+9 ;
+10 ; check VHA Enterprise Standard Title PHARMACY PROGRESS NOTE
+11 SET FOUNDSTD=$$FIND1^DIC(8926.1,"","X",STDTITLE,"B")
+12 ;
+13 SET MES(1)=""
+14 ;if PHARMACY SERVICE and PHARMACY PROGRESS NOTE exist, attach and map the new ERX RX CHANGE REQUEST NOTE TIU Note Title
+15 IF +FOUNDDOC
IF +FOUNDSTD
Begin DoDot:1
+16 SET RESULT=$$CRDD^TIUCRDD(TITLE,"DOC","ACTIVE",PARNTDOC,STDTITLE)
+17 IF '+RESULT
Begin DoDot:2
+18 SET MES(2)=$SELECT(RESULT["already exists":$PIECE(RESULT,U,2)_" No action taken.",1:"Installation Error: "_$PIECE(RESULT,U,2))
+19 SET MES(3)=""
+20 DO MES^XPDUTL(.MES)
End DoDot:2
QUIT
+21 SET MES(2)="Successfully created "_TITLE_" in File #8925.1."
+22 SET MES(3)=""
+23 DO MES^XPDUTL(.MES)
End DoDot:1
QUIT
+24 ;
+25 ;Otherwise, do not attach and map the new ERX RX REQUEST NOTE TIU Note Title
+26 SET MES(2)="Installation Error:"
+27 SET MES(3)=" The creation of the ERX RX CHANGE REQUEST NOTE TIU Title failed."
+28 ;
+29 ;both parent doc class and std title does not exist at the site
IF '+FOUNDDOC
IF '+FOUNDSTD
Begin DoDot:1
+30 SET MES(4)=" * "_PARNTDOC_" Document Class not found."
+31 SET MES(5)=" * VHA Enterprise Standard Title "_STDTITLE_" not found."
+32 SET MES(6)=""
End DoDot:1
+33 ;
+34 ;std title exist but parent doc class does not exist at the site
IF '+FOUNDDOC
IF +FOUNDSTD
Begin DoDot:1
+35 SET MES(4)=" * "_PARNTDOC_" Document Class not found."
+36 SET MES(5)=""
End DoDot:1
+37 ;
+38 ;parent doc exist but std title does not exist at the site
IF +FOUNDDOC
IF '+FOUNDSTD
Begin DoDot:1
+39 SET MES(4)=" * VHA Enterprise Standard Title "_STDTITLE_" not found."
+40 SET MES(5)=""
End DoDot:1
+41 ;
+42 DO MES^XPDUTL(.MES)
+43 QUIT