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

ORY350A.m

Go to the documentation of this file.
ORY350A ;ISP/JLC,RFR - POST-INSTALL FOR PATCH OR*3.0*350 ;04/27/2015  08:48
 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**350**;Dec 17, 1997;Build 77
 Q
SUPPLY ;correct entries in 101.43 and build list of supply
 ;entries in 101.44
 N S1,S2,S3,PSOI,PSVAC,FDA,ORFIEN
 K ^TMP($J,"ORY350A"),^TMP($J,"ORY350A1")
 S S1="" F  S S1=$O(^ORD(101.43,"S.SPLY",S1)) Q:S1=""  D
 . S S2=0
 . F  S S2=$O(^ORD(101.43,"S.SPLY",S1,S2)) Q:'S2  D
 .. S ORFIEN=S2_",",PSOI=+$P(^ORD(101.43,S2,0),"^",2) D DRGIEN^PSS50P7(PSOI,"","ORY350A")
 .. I ^TMP($J,"ORY350A",0)'>0 Q
 .. S S3=0
 .. F  S S3=$O(^TMP($J,"ORY350A",S3)) Q:'S3  D
 ... D ZERO^PSS50(S3,,,,,"ORY350A1")
 ... I ^TMP($J,"ORY350A1",0)'>0 Q
 ... S PSVAC=$G(^TMP($J,"ORY350A1",S3,2)),FDA(101.43,ORFIEN,50.5)=0
 ... I PSVAC?1"XA".E!(PSVAC?1"XX".E)!(PSVAC="DX900"&($G(^TMP($J,"ORY350A1",S3,3))["S")) S FDA(101.43,ORFIEN,50.5)=1
 ... D FILE^DIE("","FDA")
 ;build supply item list for order dialog
 D FVBLDQ^ORWUL("SPLY",1)
 Q
NOTIFI() ;CREATE NEW NOTIFICATIONS
 N ORFDA,ORIEN,ORERROR,ENT,PAR,INST,ORERROR,EXIT,ORVALUE
 D MES^XPDUTL("    LAPSED UNSIGNED ORDER")
 S ENT="PKG."_"ORDER ENTRY/RESULTS REPORTING",INST="LAPSED UNSIGNED ORDER"
 S ORVALUE("ORB ARCHIVE PERIOD")=30
 S ORVALUE("ORB DELETE MECHANISM")="Individual Recipient"
 S ORVALUE("ORB FORWARD BACKUP REVIEWER")=0
 S ORVALUE("ORB FORWARD SUPERVISOR")=0
 S ORVALUE("ORB FORWARD SURROGATES")=0
 S ORVALUE("ORB PROCESSING FLAG")="Disabled"
 S ORVALUE("ORB PROVIDER RECIPIENTS")="OAPT"
 S ORVALUE("ORB URGENCY")="High"
 S PAR="" F  S PAR=$O(ORVALUE(PAR)) Q:$G(PAR)=""!($G(EXIT))  D
 .D EN^XPAR(ENT,PAR,INST,ORVALUE(PAR),.ORERROR)  ;ICR #2336
 .I +ORERROR D
 ..S ORMSG(1)=" ",EXIT=1
 ..S ORMSG(2)="ERROR: Unable to configure the new Lapsed Unsigned Order(s) notification"
 ..S ORMSG(3)="Kernel Parameter Tools Error #"_+ORERROR_": "_$P(ORERROR,U,2)
 ..D BMES^XPDUTL(.ORMSG)
 Q:$G(EXIT) 0
 Q 1
SQOCONV() ;CONVERT EXISTING OUTPATIENT MEDICATION QUICK ORDERS INTO SUPPLY QUICK ORDERS
 N DG,DLG,ORTEXT
 S DG("OUT")=$O(^ORD(100.98,"B","OUTPATIENT MEDICATIONS",0))
 I +DG("OUT")=0 D  Q 0
 .S ORTEXT(1)="Unable to find the OUTPATIENT MEDICATIONS display group in the DISPLAY GROUP"
 .S ORTEXT(2)="file (#100.98). Please log a Remedy ticket for assistance."
 .D BMES^XPDUTL(.ORTEXT)
 S DG("SUPPLY")=$O(^ORD(100.98,"B","SUPPLIES/DEVICES",0))
 I +DG("SUPPLY")=0 D  Q 0
 .S ORTEXT(1)="Unable to find the SUPPLIES/DEVICES display group in the DISPLAY GROUP file"
 .S ORTEXT(2)="(#100.98). Please log a Remedy ticket for assistance."
 .D BMES^XPDUTL(.ORTEXT)
 S DLG("ORDERABLE ITEM")=+$O(^ORD(101.41,"B","OR GTX ORDERABLE ITEM",0))
 I DLG("ORDERABLE ITEM")=0 D  Q 0
 .S ORTEXT(1)="Unable to find the OR GTX ORDERABLE ITEM dialog in the ORDER DIALOG file"
 .S ORTEXT(2)="(#101.41). Please log a Remedy ticket for assistance."
 N IEN,EXIT
 S IEN=0 F  S IEN=$O(^ORD(101.41,IEN)) Q:+$G(IEN)=0!($G(EXIT))  D
 .;SKIP DISABLED QUICK ORDER (FIELD #3 NOT BLANK)
 .Q:$P(^ORD(101.41,IEN,0),U,3)'=""
 .;SKIP NON-QUICK ORDER
 .Q:$P(^ORD(101.41,IEN,0),U,4)'="Q"
 .;SKIP NON-OUTPATIENT MEDICATIONS
 .Q:$P(^ORD(101.41,IEN,0),U,5)'=DG("OUT")
 .;DETERMINE IF THE ORDERABLE ITEM IS A SUPPLY
 .N RIEN,ORPHOI,ORDRGIEN,SET
 .S RIEN=+$O(^ORD(101.41,IEN,6,"D",DLG("ORDERABLE ITEM"),0))
 .Q:RIEN=0
 .S ORPHOI=+$P($G(^ORD(101.41,IEN,6,RIEN,1)),U,1)
 .Q:ORPHOI=0
 .S ORPHOI=$P($G(^ORD(101.43,ORPHOI,0)),U,2)
 .Q:$P(ORPHOI,";",2)'="99PSP"
 .D DRGIEN^PSS50P7(+ORPHOI,,"ORSUPPLY")
 .Q:+^TMP($J,"ORSUPPLY",0)<1
 .S ORDRGIEN=0 F  S ORDRGIEN=$O(^TMP($J,"ORSUPPLY",ORDRGIEN)) Q:'+$G(ORDRGIEN)!($G(EXIT))!($G(SET))  D
 ..D ZERO^PSS50(ORDRGIEN,,,,,"ORDRUG")
 ..Q:+^TMP($J,"ORDRUG",0)<1
 ..I $$ISSUPPLY(ORDRGIEN),'$G(SET) D
 ...;CHANGE THE DISPLAY GROUP
 ...N FDA,ERROR
 ...S FDA(101.41,IEN_",",5)=DG("SUPPLY")
 ...D FILE^DIE("K","FDA","ERROR")
 ...I $D(ERROR) D  Q
 ....D ERROR("Unable to convert quick order IEN #"_IEN,.ERROR)
 ....S EXIT=1
 ...S SET=1
 K ^TMP($J,"ORSUPPLY")
 Q 1
ISSUPPLY(ORDRGIEN) ;DETERMINE IF DRUG IS A SUPPLY ITEM
 ;PARAMETERS: ORDRGIEN=>DRUG IEN IN ^TMP($J,"ORDRUG") GLOBAL
 Q:"^XA^XX^"[(U_$E(^TMP($J,"ORDRUG",ORDRGIEN,2),1,2)_U)!(^TMP($J,"ORDRUG",ORDRGIEN,2)="DX900"&($G(^TMP($J,"ORDRUG",ORDRGIEN,3))["S")) 1
 Q 0
ERROR(TEXT,ERROR) ;OUTPUT FILEMAN ERROR MESSAGE(S)
 N ORMSG,IDX
 S ORMSG(1)=" "
 S ORMSG(2)="ERROR: "_TEXT_"."
 S ORMSG(3)="VA FileMan Error #"_ERROR("DIERR",1)_":"
 F IDX=1:1:+$O(ERROR("DIERR",1,"TEXT","A"),-1) D
 .S ORMSG(IDX+2)=ERROR("DIERR",1,"TEXT",IDX)
 D BMES^XPDUTL(.ORMSG)
 Q