PSSHRQ23 ;WOIFO/AV,TS,SG - Parses out drugsNotChecked and DrugDoseCheck XML ;09/20/07
;;1.0;PHARMACY DATA MANAGEMENT;**136,178,206,224**;9/30/97;Build 3
;
; @authors - Alex Vazquez, Tim Sabat, Steve Gordon
; @date - September 19, 2007
; @version - 1.0
;
QUIT
;;
DRGNTCK(DOCHAND,NODE,BASE) ;
; @DESC Handles the drugsNotChecked section
;
; @DOCHAND Handle to XML document
; @NODE Node associated with XML element
; @BASE Base of output global
;
; @RETURNS Nothing
;
NEW HASH
;
; Read error into hash variable
DO NOTREAD(DOCHAND,NODE,.HASH)
;
; Write hashed variable to output global
DO NOTWRITE(.HASH,BASE)
;
QUIT
;;
NOTREAD(DOCHAND,NODE,HASH) ;
; @DESC Handles reading drugsNotChecked section of the XML document
;
; @DOCHAND Handle to XML document
; @NODE Node associated with drugsNotChecked XML element
; @HASH ByRef, Hash used to store response
;
; @RETURNS Variables in hash
;
NEW PSS
;
SET PSS("child")=0
SET PSS("count")=0
;
FOR SET PSS("child")=$$CHILD^MXMLDOM(DOCHAND,NODE,PSS("child")) QUIT:PSS("child")<1 DO
. SET HASH(PSS("count"),"reason")=$$VALUE^MXMLDOM(DOCHAND,PSS("child"),"status")
. SET HASH(PSS("count"),"reasonCode")=""
. SET HASH(PSS("count"),"reasonText")=""
. SET HASH(PSS("count"),"reasonSource")="PEPS" ; Always PEPS if returned from XML
. ; Get drug element of drugNotChecked
. ; No need to iterate over drug subelements because only 1 possible
. DO PARSEDRG^PSSHRCOM(DOCHAND,$$CHILD^MXMLDOM(DOCHAND,PSS("child")),.HASH,PSS("count"))
. SET PSS("count")=PSS("count")+1
. QUIT
QUIT
;;
NOTWRITE(HASH,BASE) ;
; @DESC Handles writing drugsNotChecked section of the XML document and
; and drugs pulled by validation logic as uncheckable (i.e. no gcn).
;
; @HASH ByRef, Hash used to store response
; @BASE Base of output global
;
; @RETURNS Nothing. Stores values in output global.
;
NEW I,DATASTR,MESSAGE,PSS,PSSHASH
S PSSHASH("Base")=BASE ;FOR NEXTEX CALL
S I=""
F S I=$O(HASH(I)) Q:I="" D
.S PSS("PharmOrderNo")=HASH(I,"orderNumber") ;for nextex call below
.S MESSAGE=$$GCNREASN^PSSHRVL1(HASH(I,"ien"),HASH(I,"drugName"),HASH(I,"orderNumber"),1)
.Q:+$P(MESSAGE,U,3)=1
.S REASON=$P(MESSAGE,U,2),MESSAGE=$P(MESSAGE,U)
.S DATASTR=HASH(I,"gcn")_U_HASH(I,"vuid")_U_HASH(I,"ien")_U_HASH(I,"drugName")_U_HASH(I,"cprsOrderNumber")
.S DATASTR=DATASTR_U_HASH(I,"package")_U_MESSAGE_U_U_HASH(I,"reasonSource")_U_REASON
.S ^TMP($J,BASE,"OUT","EXCEPTIONS",HASH(I,"orderNumber"),$$NEXTEX^PSSHRVL1(.PSS,.PSSHASH))=DATASTR
Q
;
WRTNODE(I,SUB,HASH) ;
;sets up the error node for a message
;inputs:
; I-Counter for the hash array
; SUB-subscript--either drugdrug, therapy or dose
; HASH-array containing the information for the global
;outputs: ^TMP error global
;
N NODECNT,NODE
;
SET NODE="^TMP($JOB,BASE,""OUT"",SUB,""ERROR"",HASH(I,""orderNumber""))"
;gets next error number
S NODECNT=$O(@NODE@(":"),-1)+1
SET NODE="^TMP($JOB,BASE,""OUT"",SUB,""ERROR"",HASH(I,""orderNumber""),NODECNT)"
;I $G(HASH(I,"severity"))="Information" Q ;If severity="information" don't save
SET @NODE@(0)=HASH(I,"drugName")_"^"_HASH(I,"ien")_"^"_HASH(I,"cprsOrderNumber")_"^"_HASH(I,"package")
SET @NODE@("SEV")=$G(HASH(I,"severity"))
SET @NODE@("TYPE")=$G(HASH(I,"type"))
;SET @NODE@("NAME")=HASH(I,"drugName")
SET @NODE@("TEXT")=HASH(I,"text")
;Message node to display to user
S @NODE@("MSG")=HASH(I,"msg")
QUIT
;
NEXTCNT(BASE,ORDR) ;
; @DESC Returns the next counter for the exceptions output global
;
; @ORDR Order number being counted on
;
; @RETURNS The next counter for the exceptions output global
;
NEW I
;
SET I=0
SET I=$ORDER(^TMP($JOB,BASE,"OUT","EXCEPTIONS",ORDR,I),-1)
SET I=I+1
QUIT I
;;
DRGDOSE(DOCHAND,NODE,BASE) ;
; @DESC Handles the drugDoseChecks element
;
; @DOCHAND Handle to XML document
; @NODE Node associated with XML element
; @BASE name to use for return global
;
; @RETURNS Nothing
;
NEW PSS,MSGHASH,DOSEHASH,PSMSGCNT
;
SET PSS("child")=0
SET PSS("doseCount")=0
SET PSMSGCNT=0
;
FOR SET PSS("child")=$$CHILD^MXMLDOM(DOCHAND,NODE,PSS("child")) QUIT:PSS("child")<1 DO
. SET PSS("childName")=$$NAME^MXMLDOM(DOCHAND,PSS("child"))
. ;
. ; Delegate to appropriate function
. ; xml can have message at the drugDoseChecks level and at the drugDoseCheck level.
. SET:PSS("childName")="message" PSMSGCNT=PSMSGCNT+1
. DO:PSS("childName")="message" MSGREAD(DOCHAND,PSS("child"),.MSGHASH,PSMSGCNT)
. ;
. SET:PSS("childName")="drugDoseCheck" PSS("doseCount")=PSS("doseCount")+1
. DO:PSS("childName")="drugDoseCheck" DOSEREAD(DOCHAND,PSS("child"),.DOSEHASH,PSS("doseCount"),.MSGHASH,PSMSGCNT,BASE)
. ;
. QUIT
; Write to globals .MSGHASH AND DOSEHASH ARE SET IN DOSEREAD
DO MSGWRITE^PSSHRQ21(.MSGHASH,BASE,"DOSE")
DO DOSEWRIT^PSSHRQ24(.DOSEHASH,BASE)
;
QUIT
;;
MSGREAD(DOCHAND,NODE,HASH,COUNT) ;
; @DESC Handles parsing message section
;
; @DOCHAND Handle to XML document
; @NODE Node associated with XML element
; @COUNT Count of message sections
; @HASH Where to store info
;
; @RETURNS Nothing
;
; Parse the message and store in hash
DO PARSEMSG^PSSHRCOM(DOCHAND,NODE,.HASH,COUNT)
;
QUIT
;
DOSEREAD(DOCHAND,NODE,HASH,COUNT,MSGHASH,MSGCNT,BASE) ;
;
; @DESC Reads in the drugDoseCheck XML element
;
; @DOCHAND Handle to XML document
; @NODE Node associated with XML element
; @BASE Name for return array
; @MSGHASH-array of messages about drug
; @MSGCNT-a counter on the messages (they can occur at the drugDosechecks or drugDoseCheck level)
; @RETURNS Nothing, values stored in hash
;
NEW PSS
S PSS("messageCount")=MSGCNT
;
; need drugname and drugien for return node, get them first
SET PSS("child")=0
FOR SET PSS("child")=$$CHILD^MXMLDOM(DOCHAND,NODE,PSS("child")) QUIT:PSS("child")<1 DO
. SET PSS("childName")=$$NAME^MXMLDOM(DOCHAND,PSS("child"))
. ;
. I PSS("childName")="message" D Q
. .S PSS("messageCount")=PSS("messageCount")+1
. .D MSGREAD(DOCHAND,PSS("child"),.MSGHASH,PSS("messageCount"))
. ;
. DO:PSS("childName")="drug"
. . DO PARSEDRG^PSSHRCOM(DOCHAND,PSS("child"),.HASH,COUNT)
. . QUIT
. DO:PSS("childName")="singleDoseStatus"
. . SET HASH(COUNT,"singleDoseStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="singleDoseStatusCode"
. . SET HASH(COUNT,"singleDoseStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="singleDoseMessage"
. . SET HASH(COUNT,"singleDoseMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . ;Need both message and code (5) for the "unable to check" condition"
. . I HASH(COUNT,"singleDoseStatusCode")=5 D MSG(.HASH,COUNT,"S")
. . QUIT
. DO:PSS("childName")="singleDoseMax"
. . SET HASH(COUNT,"singleDoseMax")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="rangeDoseStatus"
. . SET HASH(COUNT,"rangeDoseStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="rangeDoseStatusCode"
. . SET HASH(COUNT,"rangeDoseStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="rangeDoseMessage"
. . SET HASH(COUNT,"rangeDoseMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . ;Need both message and code (5) for the "unable to check" condition"
. . ;I HASH(COUNT,"rangeDoseStatusCode")=5,HASH(COUNT,"chemoInjectable")="false" D MSG(.HASH,COUNT,"R")
. . QUIT
. DO:PSS("childName")="rangeDoseLow"
. . SET HASH(COUNT,"rangeDoseLow")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="rangeDoseHigh"
. . SET HASH(COUNT,"rangeDoseHigh")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="doseHigh"
. . SET HASH(COUNT,"doseHigh")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="doseHighUnit"
. . SET HASH(COUNT,"doseHighUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="doseLow"
. . SET HASH(COUNT,"doseLow")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="doseLowUnit"
. . SET HASH(COUNT,"doseLowUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="doseRouteDescription"
. . SET HASH(COUNT,"doseRouteDescription")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child")) I HASH(COUNT,"doseRouteDescription")="" D
. . . N PSSNORTE
. . . F PSSNORTE=6,7,31 S $P(PSSDBCAR(HASH(COUNT,"orderNumber")),"^",PSSNORTE)=1
. . . S $P(PSSDBCAR(HASH(COUNT,"orderNumber")),"^",32)=" for "_$P(PSSDBCAR(HASH(COUNT,"orderNumber")),"^",9)_" route: "
. . QUIT
. DO:PSS("childName")="doseFormHigh"
. . SET HASH(COUNT,"doseFormHigh")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="doseFormHighUnit"
. . SET HASH(COUNT,"doseFormHighUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="doseFormLow"
. . SET HASH(COUNT,"doseFormLow")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="doseFormLowUnit"
. . SET HASH(COUNT,"doseFormLowUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="chemoInjectable"
. . SET HASH(COUNT,"chemoInjectable")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. ;
. DO:PSS("childName")="dailyDoseStatus"
. . SET HASH(COUNT,"dailyDoseStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="dailyDoseStatusCode"
. . SET HASH(COUNT,"dailyDoseStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="dailyDoseMessage"
. . SET HASH(COUNT,"dailyDoseMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . ;Need both message and code (5) for the "unable to check" condition"
. . ;I HASH(COUNT,"dailyDoseStatusCode")=5,HASH(COUNT,"chemoInjectable")="true" D MSG(.HASH,COUNT,"D")
. . QUIT
. ;
. DO:PSS("childName")="maxDailyDoseStatus"
. . SET HASH(COUNT,"maxDailyDoseStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxDailyDoseStatusCode"
. . SET HASH(COUNT,"maxDailyDoseStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxDailyDoseMessage"
. . SET HASH(COUNT,"maxDailyDoseMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . ;Need both message and code (5) for the "unable to check" condition"
. . I HASH(COUNT,"maxDailyDoseStatusCode")=5 D MSG(.HASH,COUNT,"M")
. . QUIT
. ;
. DO:PSS("childName")="maxLifetimeDose"
. . SET HASH(COUNT,"maxLifetimeDose")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. ;
. DO:PSS("childName")="frequencyStatus"
. . SET HASH(COUNT,"frequencyStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="frequencyStatusCode"
. . SET HASH(COUNT,"frequencyStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="frequencyMessage"
. . SET HASH(COUNT,"frequencyMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="frequencyHigh"
. . SET HASH(COUNT,"frequencyHigh")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="frequencyLow"
. . SET HASH(COUNT,"frequencyLow")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxLifetimeOrderMessage"
. . SET HASH(COUNT,"maxLifetimeOrderMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxLifetimeOrderStatus"
. . SET HASH(COUNT,"maxLifetimeOrderStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxLifetimeOrderStatusCode"
. . SET HASH(COUNT,"maxLifetimeOrderStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxSingleNTEDose"
. . SET HASH(COUNT,"maxSingleNTEDose")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxSingleNTEDoseUnit"
. . SET HASH(COUNT,"maxSingleNTEDoseUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxSingleNTEDoseForm"
. . SET HASH(COUNT,"maxSingleNTEDoseForm")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxSingleNTEDoseFormUnit"
. . SET HASH(COUNT,"maxSingleNTEDoseFormUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxDailyDose"
. . SET HASH(COUNT,"maxDailyDose")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxDailyDoseUnit"
. . SET HASH(COUNT,"maxDailyDoseUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxDailyDoseForm"
. . SET HASH(COUNT,"maxDailyDoseForm")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. DO:PSS("childName")="maxDailyDoseFormUnit"
. . SET HASH(COUNT,"maxDailyDoseFormUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
. . QUIT
. ;;
. DO:PSS("childName")="single"
. . D PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
. . Q
. ;;
. DO:PSS("childName")="rangeLow"
. . D PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
. . Q
. ;;
. DO:PSS("childName")="rangeHigh"
. . D PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
. . Q
. ;;
. DO:PSS("childName")="daily"
. . D PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
. . Q
. ;;
. DO:PSS("childName")="maxDaily"
. . D PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
. . Q
. ;;
. DO:PSS("childName")="maxLifetime"
. . D PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
. . Q
. ;;
. DO:PSS("childName")="maxLifetimeOrder"
. . D PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
. . Q
. ;;
. QUIT
;
I $G(HASH(COUNT,"orderNumber"))="" Q
I '$P($G(PSSDBCAR($G(HASH(COUNT,"orderNumber")))),"^",33) D ;No dummy data, check FDB data for frequency check failure
.I $G(HASH(COUNT,"maxDailyDoseStatusCode"))=5,$G(HASH(COUNT,"maxDailyDoseMessage"))["frequency check failed" S $P(PSSDBCAR($G(HASH(COUNT,"orderNumber"))),"^",29)=1
Q:$P($G(PSSDBCAR($G(HASH(COUNT,"orderNumber")))),"^",29)
I $G(HASH(COUNT,"frequencyLow"))'>0!($G(HASH(COUNT,"frequencyHigh"))'>0) Q
N PSSLFREQ,PSSHFREQ,PSSOFREQ
S PSSOFREQ=$$ORDFREQ^PSSDSUTL($P($G(PSSDBAR("FREQZZ")),"^",2)) Q:'PSSOFREQ ;PSSOFREQ = Order Frequency
I PSSOFREQ["." S PSSOFREQ=$$ROUNDNUM^PSSDSUTL(PSSOFREQ)
S PSSLFREQ=$G(HASH(COUNT,"frequencyLow")) S:PSSLFREQ["." PSSLFREQ=$$ROUNDNUM^PSSDSUTL(PSSLFREQ)
S PSSHFREQ=$G(HASH(COUNT,"frequencyHigh")) S:PSSHFREQ["." PSSHFREQ=$$ROUNDNUM^PSSDSUTL(PSSHFREQ)
I (PSSLFREQ<.01!(PSSHFREQ<.01)),((PSSOFREQ<PSSLFREQ)!(PSSOFREQ>PSSHFREQ)) S $P(PSSDBCAR($G(HASH(COUNT,"orderNumber"))),"^",29)=1 Q
I PSSOFREQ<1,PSSLFREQ'<1,PSSHFREQ'<1 S $P(PSSDBCAR($G(HASH(COUNT,"orderNumber"))),"^",29)=1 Q
I PSSOFREQ'<1,PSSLFREQ<1,PSSHFREQ<1 S $P(PSSDBCAR($G(HASH(COUNT,"orderNumber"))),"^",29)=1
;
QUIT
;;
MSG(HASH,COUNT,TYPE) ;
;INPUTS:
; HASH-array of data
; COUNT-Current subscript of the HASH array
; TYPE-Either "R" for Daily dose Range or "S" for maximum single dose
;
;returns: ^TMP error global
N MSG,REASON
S MSG=$$DOSEMSG^PSSHRVL1(HASH(COUNT,"drugName"),TYPE)
D
.I TYPE="R" D Q
..S REASON=$G(HASH(COUNT,"rangeDoseMessage"))
.I TYPE="S" D Q
..S REASON=$G(HASH(COUNT,"singleDoseMessage"))
.I TYPE="D" D Q
..S REASON=$G(HASH(COUNT,"dailyDoseMessage"))
.I TYPE="M" D Q
..S REASON=$G(HASH(COUNT,"maxDailyDoseMessage"))
S HASH(COUNT,"msg")=MSG
S HASH(COUNT,"text")=$S(REASON="":"Unavailable",1:REASON)
D WRTNODE(COUNT,"DOSE",.HASH)
Q
;
CHKVAL(HASH,I,SUB) ;
;INPUTS: HASH array (by ref)
; I-Index of current array
; SUB-subscript
;Returns: If node has value
;
Q $L($G(HASH(I,SUB)))
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSSHRQ23 15812 printed Nov 22, 2024@17:41:57 Page 2
PSSHRQ23 ;WOIFO/AV,TS,SG - Parses out drugsNotChecked and DrugDoseCheck XML ;09/20/07
+1 ;;1.0;PHARMACY DATA MANAGEMENT;**136,178,206,224**;9/30/97;Build 3
+2 ;
+3 ; @authors - Alex Vazquez, Tim Sabat, Steve Gordon
+4 ; @date - September 19, 2007
+5 ; @version - 1.0
+6 ;
+7 QUIT
+8 ;;
DRGNTCK(DOCHAND,NODE,BASE) ;
+1 ; @DESC Handles the drugsNotChecked section
+2 ;
+3 ; @DOCHAND Handle to XML document
+4 ; @NODE Node associated with XML element
+5 ; @BASE Base of output global
+6 ;
+7 ; @RETURNS Nothing
+8 ;
+9 NEW HASH
+10 ;
+11 ; Read error into hash variable
+12 DO NOTREAD(DOCHAND,NODE,.HASH)
+13 ;
+14 ; Write hashed variable to output global
+15 DO NOTWRITE(.HASH,BASE)
+16 ;
+17 QUIT
+18 ;;
NOTREAD(DOCHAND,NODE,HASH) ;
+1 ; @DESC Handles reading drugsNotChecked section of the XML document
+2 ;
+3 ; @DOCHAND Handle to XML document
+4 ; @NODE Node associated with drugsNotChecked XML element
+5 ; @HASH ByRef, Hash used to store response
+6 ;
+7 ; @RETURNS Variables in hash
+8 ;
+9 NEW PSS
+10 ;
+11 SET PSS("child")=0
+12 SET PSS("count")=0
+13 ;
+14 FOR
SET PSS("child")=$$CHILD^MXMLDOM(DOCHAND,NODE,PSS("child"))
if PSS("child")<1
QUIT
Begin DoDot:1
+15 SET HASH(PSS("count"),"reason")=$$VALUE^MXMLDOM(DOCHAND,PSS("child"),"status")
+16 SET HASH(PSS("count"),"reasonCode")=""
+17 SET HASH(PSS("count"),"reasonText")=""
+18 ; Always PEPS if returned from XML
SET HASH(PSS("count"),"reasonSource")="PEPS"
+19 ; Get drug element of drugNotChecked
+20 ; No need to iterate over drug subelements because only 1 possible
+21 DO PARSEDRG^PSSHRCOM(DOCHAND,$$CHILD^MXMLDOM(DOCHAND,PSS("child")),.HASH,PSS("count"))
+22 SET PSS("count")=PSS("count")+1
+23 QUIT
End DoDot:1
+24 QUIT
+25 ;;
NOTWRITE(HASH,BASE) ;
+1 ; @DESC Handles writing drugsNotChecked section of the XML document and
+2 ; and drugs pulled by validation logic as uncheckable (i.e. no gcn).
+3 ;
+4 ; @HASH ByRef, Hash used to store response
+5 ; @BASE Base of output global
+6 ;
+7 ; @RETURNS Nothing. Stores values in output global.
+8 ;
+9 NEW I,DATASTR,MESSAGE,PSS,PSSHASH
+10 ;FOR NEXTEX CALL
SET PSSHASH("Base")=BASE
+11 SET I=""
+12 FOR
SET I=$ORDER(HASH(I))
if I=""
QUIT
Begin DoDot:1
+13 ;for nextex call below
SET PSS("PharmOrderNo")=HASH(I,"orderNumber")
+14 SET MESSAGE=$$GCNREASN^PSSHRVL1(HASH(I,"ien"),HASH(I,"drugName"),HASH(I,"orderNumber"),1)
+15 if +$PIECE(MESSAGE,U,3)=1
QUIT
+16 SET REASON=$PIECE(MESSAGE,U,2)
SET MESSAGE=$PIECE(MESSAGE,U)
+17 SET DATASTR=HASH(I,"gcn")_U_HASH(I,"vuid")_U_HASH(I,"ien")_U_HASH(I,"drugName")_U_HASH(I,"cprsOrderNumber")
+18 SET DATASTR=DATASTR_U_HASH(I,"package")_U_MESSAGE_U_U_HASH(I,"reasonSource")_U_REASON
+19 SET ^TMP($JOB,BASE,"OUT","EXCEPTIONS",HASH(I,"orderNumber"),$$NEXTEX^PSSHRVL1(.PSS,.PSSHASH))=DATASTR
End DoDot:1
+20 QUIT
+21 ;
WRTNODE(I,SUB,HASH) ;
+1 ;sets up the error node for a message
+2 ;inputs:
+3 ; I-Counter for the hash array
+4 ; SUB-subscript--either drugdrug, therapy or dose
+5 ; HASH-array containing the information for the global
+6 ;outputs: ^TMP error global
+7 ;
+8 NEW NODECNT,NODE
+9 ;
+10 SET NODE="^TMP($JOB,BASE,""OUT"",SUB,""ERROR"",HASH(I,""orderNumber""))"
+11 ;gets next error number
+12 SET NODECNT=$ORDER(@NODE@(":"),-1)+1
+13 SET NODE="^TMP($JOB,BASE,""OUT"",SUB,""ERROR"",HASH(I,""orderNumber""),NODECNT)"
+14 ;I $G(HASH(I,"severity"))="Information" Q ;If severity="information" don't save
+15 SET @NODE@(0)=HASH(I,"drugName")_"^"_HASH(I,"ien")_"^"_HASH(I,"cprsOrderNumber")_"^"_HASH(I,"package")
+16 SET @NODE@("SEV")=$GET(HASH(I,"severity"))
+17 SET @NODE@("TYPE")=$GET(HASH(I,"type"))
+18 ;SET @NODE@("NAME")=HASH(I,"drugName")
+19 SET @NODE@("TEXT")=HASH(I,"text")
+20 ;Message node to display to user
+21 SET @NODE@("MSG")=HASH(I,"msg")
+22 QUIT
+23 ;
NEXTCNT(BASE,ORDR) ;
+1 ; @DESC Returns the next counter for the exceptions output global
+2 ;
+3 ; @ORDR Order number being counted on
+4 ;
+5 ; @RETURNS The next counter for the exceptions output global
+6 ;
+7 NEW I
+8 ;
+9 SET I=0
+10 SET I=$ORDER(^TMP($JOB,BASE,"OUT","EXCEPTIONS",ORDR,I),-1)
+11 SET I=I+1
+12 QUIT I
+13 ;;
DRGDOSE(DOCHAND,NODE,BASE) ;
+1 ; @DESC Handles the drugDoseChecks element
+2 ;
+3 ; @DOCHAND Handle to XML document
+4 ; @NODE Node associated with XML element
+5 ; @BASE name to use for return global
+6 ;
+7 ; @RETURNS Nothing
+8 ;
+9 NEW PSS,MSGHASH,DOSEHASH,PSMSGCNT
+10 ;
+11 SET PSS("child")=0
+12 SET PSS("doseCount")=0
+13 SET PSMSGCNT=0
+14 ;
+15 FOR
SET PSS("child")=$$CHILD^MXMLDOM(DOCHAND,NODE,PSS("child"))
if PSS("child")<1
QUIT
Begin DoDot:1
+16 SET PSS("childName")=$$NAME^MXMLDOM(DOCHAND,PSS("child"))
+17 ;
+18 ; Delegate to appropriate function
+19 ; xml can have message at the drugDoseChecks level and at the drugDoseCheck level.
+20 if PSS("childName")="message"
SET PSMSGCNT=PSMSGCNT+1
+21 if PSS("childName")="message"
DO MSGREAD(DOCHAND,PSS("child"),.MSGHASH,PSMSGCNT)
+22 ;
+23 if PSS("childName")="drugDoseCheck"
SET PSS("doseCount")=PSS("doseCount")+1
+24 if PSS("childName")="drugDoseCheck"
DO DOSEREAD(DOCHAND,PSS("child"),.DOSEHASH,PSS("doseCount"),.MSGHASH,PSMSGCNT,BASE)
+25 ;
+26 QUIT
End DoDot:1
+27 ; Write to globals .MSGHASH AND DOSEHASH ARE SET IN DOSEREAD
+28 DO MSGWRITE^PSSHRQ21(.MSGHASH,BASE,"DOSE")
+29 DO DOSEWRIT^PSSHRQ24(.DOSEHASH,BASE)
+30 ;
+31 QUIT
+32 ;;
MSGREAD(DOCHAND,NODE,HASH,COUNT) ;
+1 ; @DESC Handles parsing message section
+2 ;
+3 ; @DOCHAND Handle to XML document
+4 ; @NODE Node associated with XML element
+5 ; @COUNT Count of message sections
+6 ; @HASH Where to store info
+7 ;
+8 ; @RETURNS Nothing
+9 ;
+10 ; Parse the message and store in hash
+11 DO PARSEMSG^PSSHRCOM(DOCHAND,NODE,.HASH,COUNT)
+12 ;
+13 QUIT
+14 ;
DOSEREAD(DOCHAND,NODE,HASH,COUNT,MSGHASH,MSGCNT,BASE) ;
+1 ;
+2 ; @DESC Reads in the drugDoseCheck XML element
+3 ;
+4 ; @DOCHAND Handle to XML document
+5 ; @NODE Node associated with XML element
+6 ; @BASE Name for return array
+7 ; @MSGHASH-array of messages about drug
+8 ; @MSGCNT-a counter on the messages (they can occur at the drugDosechecks or drugDoseCheck level)
+9 ; @RETURNS Nothing, values stored in hash
+10 ;
+11 NEW PSS
+12 SET PSS("messageCount")=MSGCNT
+13 ;
+14 ; need drugname and drugien for return node, get them first
+15 SET PSS("child")=0
+16 FOR
SET PSS("child")=$$CHILD^MXMLDOM(DOCHAND,NODE,PSS("child"))
if PSS("child")<1
QUIT
Begin DoDot:1
+17 SET PSS("childName")=$$NAME^MXMLDOM(DOCHAND,PSS("child"))
+18 ;
+19 IF PSS("childName")="message"
Begin DoDot:2
+20 SET PSS("messageCount")=PSS("messageCount")+1
+21 DO MSGREAD(DOCHAND,PSS("child"),.MSGHASH,PSS("messageCount"))
End DoDot:2
QUIT
+22 ;
+23 if PSS("childName")="drug"
Begin DoDot:2
+24 DO PARSEDRG^PSSHRCOM(DOCHAND,PSS("child"),.HASH,COUNT)
+25 QUIT
End DoDot:2
+26 if PSS("childName")="singleDoseStatus"
Begin DoDot:2
+27 SET HASH(COUNT,"singleDoseStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+28 QUIT
End DoDot:2
+29 if PSS("childName")="singleDoseStatusCode"
Begin DoDot:2
+30 SET HASH(COUNT,"singleDoseStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+31 QUIT
End DoDot:2
+32 if PSS("childName")="singleDoseMessage"
Begin DoDot:2
+33 SET HASH(COUNT,"singleDoseMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+34 ;Need both message and code (5) for the "unable to check" condition"
+35 IF HASH(COUNT,"singleDoseStatusCode")=5
DO MSG(.HASH,COUNT,"S")
+36 QUIT
End DoDot:2
+37 if PSS("childName")="singleDoseMax"
Begin DoDot:2
+38 SET HASH(COUNT,"singleDoseMax")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+39 QUIT
End DoDot:2
+40 if PSS("childName")="rangeDoseStatus"
Begin DoDot:2
+41 SET HASH(COUNT,"rangeDoseStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+42 QUIT
End DoDot:2
+43 if PSS("childName")="rangeDoseStatusCode"
Begin DoDot:2
+44 SET HASH(COUNT,"rangeDoseStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+45 QUIT
End DoDot:2
+46 if PSS("childName")="rangeDoseMessage"
Begin DoDot:2
+47 SET HASH(COUNT,"rangeDoseMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+48 ;Need both message and code (5) for the "unable to check" condition"
+49 ;I HASH(COUNT,"rangeDoseStatusCode")=5,HASH(COUNT,"chemoInjectable")="false" D MSG(.HASH,COUNT,"R")
+50 QUIT
End DoDot:2
+51 if PSS("childName")="rangeDoseLow"
Begin DoDot:2
+52 SET HASH(COUNT,"rangeDoseLow")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+53 QUIT
End DoDot:2
+54 if PSS("childName")="rangeDoseHigh"
Begin DoDot:2
+55 SET HASH(COUNT,"rangeDoseHigh")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+56 QUIT
End DoDot:2
+57 if PSS("childName")="doseHigh"
Begin DoDot:2
+58 SET HASH(COUNT,"doseHigh")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+59 QUIT
End DoDot:2
+60 if PSS("childName")="doseHighUnit"
Begin DoDot:2
+61 SET HASH(COUNT,"doseHighUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+62 QUIT
End DoDot:2
+63 if PSS("childName")="doseLow"
Begin DoDot:2
+64 SET HASH(COUNT,"doseLow")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+65 QUIT
End DoDot:2
+66 if PSS("childName")="doseLowUnit"
Begin DoDot:2
+67 SET HASH(COUNT,"doseLowUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+68 QUIT
End DoDot:2
+69 if PSS("childName")="doseRouteDescription"
Begin DoDot:2
+70 SET HASH(COUNT,"doseRouteDescription")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
IF HASH(COUNT,"doseRouteDescription")=""
Begin DoDot:3
+71 NEW PSSNORTE
+72 FOR PSSNORTE=6,7,31
SET $PIECE(PSSDBCAR(HASH(COUNT,"orderNumber")),"^",PSSNORTE)=1
+73 SET $PIECE(PSSDBCAR(HASH(COUNT,"orderNumber")),"^",32)=" for "_$PIECE(PSSDBCAR(HASH(COUNT,"orderNumber")),"^",9)_" route: "
End DoDot:3
+74 QUIT
End DoDot:2
+75 if PSS("childName")="doseFormHigh"
Begin DoDot:2
+76 SET HASH(COUNT,"doseFormHigh")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+77 QUIT
End DoDot:2
+78 if PSS("childName")="doseFormHighUnit"
Begin DoDot:2
+79 SET HASH(COUNT,"doseFormHighUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+80 QUIT
End DoDot:2
+81 if PSS("childName")="doseFormLow"
Begin DoDot:2
+82 SET HASH(COUNT,"doseFormLow")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+83 QUIT
End DoDot:2
+84 if PSS("childName")="doseFormLowUnit"
Begin DoDot:2
+85 SET HASH(COUNT,"doseFormLowUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+86 QUIT
End DoDot:2
+87 if PSS("childName")="chemoInjectable"
Begin DoDot:2
+88 SET HASH(COUNT,"chemoInjectable")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+89 QUIT
End DoDot:2
+90 ;
+91 if PSS("childName")="dailyDoseStatus"
Begin DoDot:2
+92 SET HASH(COUNT,"dailyDoseStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+93 QUIT
End DoDot:2
+94 if PSS("childName")="dailyDoseStatusCode"
Begin DoDot:2
+95 SET HASH(COUNT,"dailyDoseStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+96 QUIT
End DoDot:2
+97 if PSS("childName")="dailyDoseMessage"
Begin DoDot:2
+98 SET HASH(COUNT,"dailyDoseMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+99 ;Need both message and code (5) for the "unable to check" condition"
+100 ;I HASH(COUNT,"dailyDoseStatusCode")=5,HASH(COUNT,"chemoInjectable")="true" D MSG(.HASH,COUNT,"D")
+101 QUIT
End DoDot:2
+102 ;
+103 if PSS("childName")="maxDailyDoseStatus"
Begin DoDot:2
+104 SET HASH(COUNT,"maxDailyDoseStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+105 QUIT
End DoDot:2
+106 if PSS("childName")="maxDailyDoseStatusCode"
Begin DoDot:2
+107 SET HASH(COUNT,"maxDailyDoseStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+108 QUIT
End DoDot:2
+109 if PSS("childName")="maxDailyDoseMessage"
Begin DoDot:2
+110 SET HASH(COUNT,"maxDailyDoseMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+111 ;Need both message and code (5) for the "unable to check" condition"
+112 IF HASH(COUNT,"maxDailyDoseStatusCode")=5
DO MSG(.HASH,COUNT,"M")
+113 QUIT
End DoDot:2
+114 ;
+115 if PSS("childName")="maxLifetimeDose"
Begin DoDot:2
+116 SET HASH(COUNT,"maxLifetimeDose")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+117 QUIT
End DoDot:2
+118 ;
+119 if PSS("childName")="frequencyStatus"
Begin DoDot:2
+120 SET HASH(COUNT,"frequencyStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+121 QUIT
End DoDot:2
+122 if PSS("childName")="frequencyStatusCode"
Begin DoDot:2
+123 SET HASH(COUNT,"frequencyStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+124 QUIT
End DoDot:2
+125 if PSS("childName")="frequencyMessage"
Begin DoDot:2
+126 SET HASH(COUNT,"frequencyMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+127 QUIT
End DoDot:2
+128 if PSS("childName")="frequencyHigh"
Begin DoDot:2
+129 SET HASH(COUNT,"frequencyHigh")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+130 QUIT
End DoDot:2
+131 if PSS("childName")="frequencyLow"
Begin DoDot:2
+132 SET HASH(COUNT,"frequencyLow")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+133 QUIT
End DoDot:2
+134 if PSS("childName")="maxLifetimeOrderMessage"
Begin DoDot:2
+135 SET HASH(COUNT,"maxLifetimeOrderMessage")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+136 QUIT
End DoDot:2
+137 if PSS("childName")="maxLifetimeOrderStatus"
Begin DoDot:2
+138 SET HASH(COUNT,"maxLifetimeOrderStatus")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+139 QUIT
End DoDot:2
+140 if PSS("childName")="maxLifetimeOrderStatusCode"
Begin DoDot:2
+141 SET HASH(COUNT,"maxLifetimeOrderStatusCode")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+142 QUIT
End DoDot:2
+143 if PSS("childName")="maxSingleNTEDose"
Begin DoDot:2
+144 SET HASH(COUNT,"maxSingleNTEDose")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+145 QUIT
End DoDot:2
+146 if PSS("childName")="maxSingleNTEDoseUnit"
Begin DoDot:2
+147 SET HASH(COUNT,"maxSingleNTEDoseUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+148 QUIT
End DoDot:2
+149 if PSS("childName")="maxSingleNTEDoseForm"
Begin DoDot:2
+150 SET HASH(COUNT,"maxSingleNTEDoseForm")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+151 QUIT
End DoDot:2
+152 if PSS("childName")="maxSingleNTEDoseFormUnit"
Begin DoDot:2
+153 SET HASH(COUNT,"maxSingleNTEDoseFormUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+154 QUIT
End DoDot:2
+155 if PSS("childName")="maxDailyDose"
Begin DoDot:2
+156 SET HASH(COUNT,"maxDailyDose")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+157 QUIT
End DoDot:2
+158 if PSS("childName")="maxDailyDoseUnit"
Begin DoDot:2
+159 SET HASH(COUNT,"maxDailyDoseUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+160 QUIT
End DoDot:2
+161 if PSS("childName")="maxDailyDoseForm"
Begin DoDot:2
+162 SET HASH(COUNT,"maxDailyDoseForm")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+163 QUIT
End DoDot:2
+164 if PSS("childName")="maxDailyDoseFormUnit"
Begin DoDot:2
+165 SET HASH(COUNT,"maxDailyDoseFormUnit")=$$GETTEXT^PSSHRCOM(DOCHAND,PSS("child"))
+166 QUIT
End DoDot:2
+167 ;;
+168 if PSS("childName")="single"
Begin DoDot:2
+169 DO PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
+170 QUIT
End DoDot:2
+171 ;;
+172 if PSS("childName")="rangeLow"
Begin DoDot:2
+173 DO PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
+174 QUIT
End DoDot:2
+175 ;;
+176 if PSS("childName")="rangeHigh"
Begin DoDot:2
+177 DO PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
+178 QUIT
End DoDot:2
+179 ;;
+180 if PSS("childName")="daily"
Begin DoDot:2
+181 DO PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
+182 QUIT
End DoDot:2
+183 ;;
+184 if PSS("childName")="maxDaily"
Begin DoDot:2
+185 DO PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
+186 QUIT
End DoDot:2
+187 ;;
+188 if PSS("childName")="maxLifetime"
Begin DoDot:2
+189 DO PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
+190 QUIT
End DoDot:2
+191 ;;
+192 if PSS("childName")="maxLifetimeOrder"
Begin DoDot:2
+193 DO PARSEDSP^PSSHRQ2D(DOCHAND,PSS("child"),.HASH,COUNT)
+194 QUIT
End DoDot:2
+195 ;;
+196 QUIT
End DoDot:1
+197 ;
+198 IF $GET(HASH(COUNT,"orderNumber"))=""
QUIT
+199 ;No dummy data, check FDB data for frequency check failure
IF '$PIECE($GET(PSSDBCAR($GET(HASH(COUNT,"orderNumber")))),"^",33)
Begin DoDot:1
+200 IF $GET(HASH(COUNT,"maxDailyDoseStatusCode"))=5
IF $GET(HASH(COUNT,"maxDailyDoseMessage"))["frequency check failed"
SET $PIECE(PSSDBCAR($GET(HASH(COUNT,"orderNumber"))),"^",29)=1
End DoDot:1
+201 if $PIECE($GET(PSSDBCAR($GET(HASH(COUNT,"orderNumber")))),"^",29)
QUIT
+202 IF $GET(HASH(COUNT,"frequencyLow"))'>0!($GET(HASH(COUNT,"frequencyHigh"))'>0)
QUIT
+203 NEW PSSLFREQ,PSSHFREQ,PSSOFREQ
+204 ;PSSOFREQ = Order Frequency
SET PSSOFREQ=$$ORDFREQ^PSSDSUTL($PIECE($GET(PSSDBAR("FREQZZ")),"^",2))
if 'PSSOFREQ
QUIT
+205 IF PSSOFREQ["."
SET PSSOFREQ=$$ROUNDNUM^PSSDSUTL(PSSOFREQ)
+206 SET PSSLFREQ=$GET(HASH(COUNT,"frequencyLow"))
if PSSLFREQ["."
SET PSSLFREQ=$$ROUNDNUM^PSSDSUTL(PSSLFREQ)
+207 SET PSSHFREQ=$GET(HASH(COUNT,"frequencyHigh"))
if PSSHFREQ["."
SET PSSHFREQ=$$ROUNDNUM^PSSDSUTL(PSSHFREQ)
+208 IF (PSSLFREQ<.01!(PSSHFREQ<.01))
IF ((PSSOFREQ<PSSLFREQ)!(PSSOFREQ>PSSHFREQ))
SET $PIECE(PSSDBCAR($GET(HASH(COUNT,"orderNumber"))),"^",29)=1
QUIT
+209 IF PSSOFREQ<1
IF PSSLFREQ'<1
IF PSSHFREQ'<1
SET $PIECE(PSSDBCAR($GET(HASH(COUNT,"orderNumber"))),"^",29)=1
QUIT
+210 IF PSSOFREQ'<1
IF PSSLFREQ<1
IF PSSHFREQ<1
SET $PIECE(PSSDBCAR($GET(HASH(COUNT,"orderNumber"))),"^",29)=1
+211 ;
+212 QUIT
+213 ;;
MSG(HASH,COUNT,TYPE) ;
+1 ;INPUTS:
+2 ; HASH-array of data
+3 ; COUNT-Current subscript of the HASH array
+4 ; TYPE-Either "R" for Daily dose Range or "S" for maximum single dose
+5 ;
+6 ;returns: ^TMP error global
+7 NEW MSG,REASON
+8 SET MSG=$$DOSEMSG^PSSHRVL1(HASH(COUNT,"drugName"),TYPE)
+9 Begin DoDot:1
+10 IF TYPE="R"
Begin DoDot:2
+11 SET REASON=$GET(HASH(COUNT,"rangeDoseMessage"))
End DoDot:2
QUIT
+12 IF TYPE="S"
Begin DoDot:2
+13 SET REASON=$GET(HASH(COUNT,"singleDoseMessage"))
End DoDot:2
QUIT
+14 IF TYPE="D"
Begin DoDot:2
+15 SET REASON=$GET(HASH(COUNT,"dailyDoseMessage"))
End DoDot:2
QUIT
+16 IF TYPE="M"
Begin DoDot:2
+17 SET REASON=$GET(HASH(COUNT,"maxDailyDoseMessage"))
End DoDot:2
QUIT
End DoDot:1
+18 SET HASH(COUNT,"msg")=MSG
+19 SET HASH(COUNT,"text")=$SELECT(REASON="":"Unavailable",1:REASON)
+20 DO WRTNODE(COUNT,"DOSE",.HASH)
+21 QUIT
+22 ;
CHKVAL(HASH,I,SUB) ;
+1 ;INPUTS: HASH array (by ref)
+2 ; I-Index of current array
+3 ; SUB-subscript
+4 ;Returns: If node has value
+5 ;
+6 QUIT $LENGTH($GET(HASH(I,SUB)))