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

PSSHREQ.m

Go to the documentation of this file.
  1. PSSHREQ ;WOIFO/AV,TS - Creates PSSXML to send to PEPS using input global ;09/20/07
  1. ;;1.0;PHARMACY DATA MANAGEMENT;**136,163**;9/30/97;Build 8
  1. ;
  1. ; @authors - Alex Vazquez, Tim Sabat, Steve Gordon
  1. ; @date - September 19, 2007
  1. ; @version - 1.0
  1. ;
  1. QUIT
  1. ;;
  1. BLDPREQ(PSSBASE) ;
  1. ; @DRIVER
  1. ;
  1. ; @DESC Builds the PEPSRequest PSSXML element
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS An xml string representing an entire order check.
  1. ;
  1. NEW PSS,PSSXML
  1. ;
  1. SET PSS("PSSXMLHeader")=$$XMLHDR^MXMLUTL
  1. SET PSS("xmlns")=$$ATRIBUTE^PSSHRCOM("xmlns","gov/va/med/pharmacy/peps/external/common/preencapsulation/vo/drug/check/request")
  1. SET PSS("xsi")=$$ATRIBUTE^PSSHRCOM("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance")
  1. ;
  1. SET PSSXML=PSS("PSSXMLHeader")
  1. SET PSSXML=PSSXML_"<PEPSRequest"
  1. SET PSSXML=PSSXML_" "_PSS("xmlns")
  1. SET PSSXML=PSSXML_" "_PSS("xsi")
  1. SET PSSXML=PSSXML_" >"
  1. SET PSSXML=PSSXML_$$HEADER(PSSBASE)
  1. I '$D(^TMP($JOB,PSSBASE,"IN","PING")) SET PSSXML=PSSXML_$$BODY(PSSBASE)
  1. SET PSSXML=PSSXML_"</PEPSRequest>"
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. ; @DESC Builds the Header PSSXML element. A header is the section of the PSSXML
  1. ; that includes time, server, and user. This item holds no business logic, it
  1. ; only records debugging information.
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS A the PSSXML string representing the header element.
  1. ;
  1. NEW PSSXML,PSS
  1. ;
  1. ; pingOnly is OPTIONAL. If data in global, set pingOnly to true
  1. IF $DATA(^TMP($JOB,PSSBASE,"IN","PING")) DO
  1. . SET PSS("pingOnly")=$$ATRIBUTE^PSSHRCOM("pingOnly","true")
  1. . QUIT
  1. ;
  1. SET PSSXML="<Header "_$GET(PSS("pingOnly"))_">"
  1. SET PSSXML=PSSXML_$$HDRTIME
  1. SET PSSXML=PSSXML_$$HDRSERVR
  1. SET PSSXML=PSSXML_$$HDRMUSER
  1. SET PSSXML=PSSXML_"</Header>"
  1. ;
  1. ; Return composed header
  1. QUIT PSSXML
  1. ;;
  1. HDRTIME() ;
  1. ; @DESC Builds the Time PSSXML element which resides in the header
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS An xml string containing the time element.
  1. ;
  1. NEW PSS,PSSXML
  1. ;
  1. SET PSS("value")=$$ATRIBUTE^PSSHRCOM("value",$GET(DT))
  1. ;
  1. SET PSSXML="<Time"
  1. SET PSSXML=PSSXML_" "_PSS("value")
  1. SET PSSXML=PSSXML_" />"
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. HDRSERVR() ;
  1. ; @DESC Builds the MServer PSSXML element
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS An PSSXML string representing the server element.
  1. ;
  1. NEW PSS,PSSXML,PSSNTDS1,PSSNTDS2,PSSNTDS3,PSSNTDS4,PSSNTDS5
  1. ;
  1. SET PSS("IP")=$$ATRIBUTE^PSSHRCOM("ip",$GET(IO("IP")))
  1. ;
  1. ; Namespace will remain empty because the method call used to get it
  1. ; is considered non-standard mumps.
  1. SET PSS("nameSpace")=$$ATRIBUTE^PSSHRCOM("namespace","")
  1. ;
  1. SET PSS("serverName")=$$ATRIBUTE^PSSHRCOM("serverName",$PIECE($GET(XMV("NETNAME")),"@",2))
  1. ;
  1. ;SET PSS("stationNumberOnly")=$$IEN^XUAF4($PIECE($$SITE^VASITE(),"^",1))
  1. ;IF PSS("stationNumberOnly")="" SET PSS("stationNumberOnly")=1
  1. S PSSNTDS1=$P($$SITE^VASITE(),"^",3)
  1. I PSSNTDS1'?1N.N S PSSNTDS2=$L(PSSNTDS1) S PSSNTDS5="" D:PSSNTDS2>0 S PSSNTDS1=PSSNTDS5 I PSSNTDS1'?1N.N S PSSNTDS1=0
  1. .F PSSNTDS3=1:1:PSSNTDS2 S PSSNTDS4=$E(PSSNTDS1,PSSNTDS3) Q:PSSNTDS4'?1N S PSSNTDS5=PSSNTDS5_PSSNTDS4
  1. SET PSS("stationNumber")=$$ATRIBUTE^PSSHRCOM("stationNumber",PSSNTDS1)
  1. ;
  1. ; Namespace will remain empty because the method call used to get it
  1. ; is considered non-standard mumps.
  1. SET PSS("UCI")=$$ATRIBUTE^PSSHRCOM("uci","")
  1. ;
  1. SET PSSXML="<MServer"
  1. SET PSSXML=PSSXML_" "_PSS("IP")
  1. SET PSSXML=PSSXML_" "_PSS("nameSpace")
  1. SET PSSXML=PSSXML_" "_PSS("serverName")
  1. SET PSSXML=PSSXML_" "_PSS("stationNumber")
  1. SET PSSXML=PSSXML_" "_PSS("UCI")
  1. SET PSSXML=PSSXML_" />"
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. HDRMUSER() ;
  1. ; @DESC Builds the user element of the PSSXML
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS An PSSXML string representing the M user.
  1. ;
  1. NEW PSS,PSSXML,PSSNTDZ,PSSNTDJB
  1. ;
  1. S PSSNTDZ=$G(DUZ) I PSSNTDZ'?1N.N S PSSNTDZ=0
  1. ;
  1. SET PSS("DUZ")=$$ATRIBUTE^PSSHRCOM("duz",PSSNTDZ)
  1. ;
  1. S PSSNTDJB=$J S:PSSNTDJB'?1N.N PSSNTDJB=0 SET PSS("jobNumber")=$$ATRIBUTE^PSSHRCOM("jobNumber",PSSNTDJB)
  1. ;
  1. ; FIXME need to get username
  1. SET PSS("userName")=$$ATRIBUTE^PSSHRCOM("userName",$$GET1^DIQ(200,DUZ_",",.01))
  1. ;
  1. SET PSSXML="<MUser"
  1. SET PSSXML=PSSXML_" "_PSS("DUZ")
  1. SET PSSXML=PSSXML_" "_PSS("jobNumber")
  1. SET PSSXML=PSSXML_" "_PSS("userName")
  1. SET PSSXML=PSSXML_" />"
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. BODY(PSSBASE) ;
  1. ; @DESC Builds the Body PSSXML element
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS An PSSXML string representing the body element.
  1. ;
  1. NEW PSSXML
  1. ;
  1. SET PSSXML="<Body>"
  1. SET PSSXML=PSSXML_$$DRGCHEK(PSSBASE)
  1. SET PSSXML=PSSXML_"</Body>"
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. DRGCHEK(PSSBASE) ;
  1. ; @DESC Builds the DrugCheck PSSXML element
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS an PSSXML string representing the drugCheck element
  1. ;
  1. NEW PSSXML
  1. ;
  1. SET PSSXML="<drugCheck>"
  1. SET PSSXML=PSSXML_$$CHECKS(PSSBASE)
  1. SET PSSXML=PSSXML_$$DRUGPROS(PSSBASE)
  1. SET PSSXML=PSSXML_$$MEDPROF(PSSBASE)
  1. SET PSSXML=PSSXML_"</drugCheck>"
  1. ;
  1. ; Return the full drugCheck element
  1. QUIT PSSXML
  1. ;;
  1. CHECKS(PSSBASE) ;
  1. ; @DESC Builds the checks PSSXML element
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS An PSSXML string representing the checks element.
  1. ;
  1. NEW PSS,PSSXML
  1. ;
  1. ; If data in global, set prospective only to false
  1. IF $DATA(^TMP($JOB,PSSBASE,"IN","PROFILEVPROFILE")) DO
  1. . SET PSS("prospectiveOnly")=$$ATRIBUTE^PSSHRCOM("prospectiveOnly","false")
  1. . QUIT
  1. ;
  1. ; If no data in global, set prospective only to true
  1. IF '$DATA(^TMP($JOB,PSSBASE,"IN","PROFILEVPROFILE")) DO
  1. . SET PSS("prospectiveOnly")=$$ATRIBUTE^PSSHRCOM("prospectiveOnly","true")
  1. . QUIT
  1. ;
  1. ; OPTIONAL. TBA Right now set to false, will be used in future
  1. SET PSS("useCustomTables")=$$ATRIBUTE^PSSHRCOM("useCustomTables","true")
  1. ;
  1. SET PSSXML="<checks"
  1. SET PSSXML=PSSXML_" "_$GET(PSS("prospectiveOnly"))
  1. SET PSSXML=PSSXML_" "_$GET(PSS("useCustomTables"))
  1. SET PSSXML=PSSXML_" >"
  1. SET PSSXML=PSSXML_$$CHEKDOSE(PSSBASE)
  1. SET PSSXML=PSSXML_$$CHEKDRUG(PSSBASE)
  1. SET PSSXML=PSSXML_$$CHEKTHER(PSSBASE)
  1. SET PSSXML=PSSXML_"</checks>"
  1. ;
  1. ; Return the full drugCheck element
  1. QUIT PSSXML
  1. ;;
  1. CHEKDOSE(PSSBASE) ;
  1. ; @DESC Sets the drugDoseCheck element
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS An PSSXML string representing the doseCheck element
  1. ;
  1. NEW PSSXML
  1. ;
  1. SET PSSXML=""
  1. ;
  1. IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE")) DO
  1. . SET PSSXML="<drugDoseCheck>"
  1. . ; Get the demographics PSSXML section
  1. . SET PSSXML=PSSXML_$$DEMOGRAF(PSSBASE)
  1. . SET PSSXML=PSSXML_"</drugDoseCheck>"
  1. . QUIT
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. DEMOGRAF(PSSBASE) ;
  1. ; @DESC Builds the demographic element
  1. ;
  1. ; @PSSBASE Input global base
  1. ;
  1. ; @RETURNS An PSSXML string representation of the demographics element
  1. ;
  1. NEW PSSXML,PSS
  1. ;
  1. SET PSS("bsa")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE","BSA"))
  1. SET PSS("bodySurfaceAreaInSqM")=$$ATRIBUTE^PSSHRCOM("bodySurfaceAreaInSqM",PSS("bsa"))
  1. ;
  1. SET PSS("wt")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE","WT"))
  1. SET PSS("weightInKG")=$$ATRIBUTE^PSSHRCOM("weightInKG",PSS("wt"))
  1. ;
  1. SET PSS("age")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE","AGE"))
  1. SET PSS("ageInDays")=$$ATRIBUTE^PSSHRCOM("ageInDays",PSS("age"))
  1. ;
  1. SET PSSXML="<demographics "_PSS("bodySurfaceAreaInSqM")_" "_PSS("weightInKG")_" "_PSS("ageInDays")_"/>"
  1. QUIT PSSXML
  1. ;;
  1. CHEKDRUG(PSSBASE) ;
  1. ; @DESC Sets the drugDrugCheck element
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS An PSSXML String representing drugDoseCheck element
  1. ;
  1. NEW PSSXML
  1. ;
  1. SET PSSXML=""
  1. ; If drug drug global set, add drug drug check
  1. IF $DATA(^TMP($JOB,PSSBASE,"IN","DRUGDRUG"))=1 DO
  1. . SET PSSXML="<drugDrugCheck />"
  1. . QUIT
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. CHEKTHER(PSSBASE) ;
  1. ; @DESC Sets the drugTherapyCheck element
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS An PSSXML string representing the drugTherapyCheck element
  1. ;
  1. NEW PSSXML
  1. SET PSSXML=""
  1. ; If drug therapy set, add therapy check
  1. IF $DATA(^TMP($JOB,PSSBASE,"IN","THERAPY"))=1 DO
  1. . SET PSSXML="<drugTherapyCheck />"
  1. . QUIT
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. MEDPROF(PSSBASE) ;
  1. ; @DESC Builds a medicationProfile element
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS PSSXML string element of the medicationProfile
  1. ;
  1. NEW PSS,PSSXML
  1. ;
  1. SET PSSXML="<medicationProfile>"
  1. SET PSSXML=PSSXML_$$DRUGPROF(PSSBASE)
  1. SET PSSXML=PSSXML_"</medicationProfile>"
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. DRUGPROS(PSSBASE) ;
  1. ; @DESC Builds prospectiveDrugs element
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS An PSSXML string representing prospectiveDrugs
  1. ;
  1. NEW PSSXML,PSSDRUGS
  1. ;
  1. ; Read drug info from input global, store in PSSDRUGS hash
  1. DO READRUGS(PSSBASE,"PROSPECTIVE",.PSSDRUGS)
  1. D
  1. .I '$D(PSSDRUGS("DRUG")) S PSSXML="" Q ;if no prospective drug just return null
  1. .; Write the drugs as PSSXML
  1. .SET PSSXML="<prospectiveDrugs>"_$$RITEDRGS(.PSSDRUGS)_"</prospectiveDrugs>"
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. DRUGPROF(PSSBASE) ;
  1. ; @DESC Builds a prospective drug element
  1. ;
  1. ; @PSSBASE Base of input global
  1. ;
  1. ; @RETURNS An PSSXML string representing profile drugs
  1. ;
  1. NEW PSSXML,PSSDRUGS
  1. ;
  1. ; Read from the input global and put in PSSDRUGS hash
  1. DO READRUGS(PSSBASE,"PROFILE",.PSSDRUGS)
  1. ; Write the profile drugs as PSSXML
  1. SET PSSXML=$$RITEDRGS(.PSSDRUGS)
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. READRUGS(PSSBASE,DRUGTYPE,PSSDRUGS) ;
  1. ; @DESC Builds either a prospective or a profile drug element.
  1. ; Note the "DRUGTYPE" parameter. This param allows for re-use, so either
  1. ; a profile or a prospective drug can be created.
  1. ;
  1. ; @PSSBASE Base of input global
  1. ; @DRUGTYPE A drug type, either Prospective or Profile
  1. ; @PSSDRUGS ByRef, variable to store drug attributes in
  1. ;
  1. ; @RETURNS Nothing, values stored in drugs variable
  1. ;
  1. NEW PSS
  1. ;
  1. SET PSS("ien")=""
  1. SET PSS("count")=0
  1. ;
  1. ; Loop through the unique order numbers
  1. SET PSS("orderNumber")=""
  1. FOR SET PSS("orderNumber")=$ORDER(^TMP($JOB,PSSBASE,"IN",DRUGTYPE,PSS("orderNumber"))) QUIT:PSS("orderNumber")="" DO
  1. . SET PSS("count")=PSS("count")+1
  1. . SET PSS("value")=$GET(^TMP($JOB,PSSBASE,"IN",DRUGTYPE,PSS("orderNumber")))
  1. . ; Set the drug order number
  1. . SET PSSDRUGS("DRUG",PSS("count"),"orderNumber")=PSS("orderNumber")
  1. . ; Set the drug gcn sequence number
  1. . SET PSSDRUGS("DRUG",PSS("count"),"gcn")=+$PIECE(PSS("value"),"^",1)
  1. . ; Set the drug vuid
  1. . SET PSSDRUGS("DRUG",PSS("count"),"vuid")=+$PIECE(PSS("value"),"^",2)
  1. . ; Set the drug ien
  1. . SET PSSDRUGS("DRUG",PSS("count"),"ien")=+$PIECE(PSS("value"),"^",3)
  1. . ; Set the drug name
  1. . SET PSSDRUGS("DRUG",PSS("count"),"drugName")=$PIECE(PSS("value"),"^",4)
  1. . ; Set the cprs order number
  1. . SET PSSDRUGS("DRUG",PSS("count"),"cprsOrderNumber")=$PIECE(PSS("value"),"^",5)
  1. . ; Set the package
  1. . SET PSSDRUGS("DRUG",PSS("count"),"package")=$PIECE(PSS("value"),"^",6)
  1. . ;
  1. . ; Get the possible dose information for the drug
  1. . DO READDOSE(PSSBASE,.PSSDRUGS,PSS("count"),PSS("orderNumber"))
  1. . QUIT
  1. ;
  1. QUIT
  1. ;;
  1. RITEDRGS(PSSDRUGS) ;
  1. ; @DESC Loop through the drugs and return PSSXML
  1. ;
  1. ; @PSSDRUGS Array containing the list of drugs
  1. ;
  1. ; @RETURNS PSSXML representing the drugs in array
  1. ;
  1. NEW PSSCOUNT,PSSXML
  1. ;
  1. SET PSSXML=""
  1. SET PSSCOUNT=""
  1. FOR SET PSSCOUNT=$ORDER(PSSDRUGS("DRUG",PSSCOUNT)) QUIT:PSSCOUNT="" DO
  1. . ; loop through drugs and append to PSSXML
  1. . SET PSSXML=PSSXML_$$RITEDRUG(.PSSDRUGS,PSSCOUNT)
  1. . QUIT
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. RITEDRUG(PSSDRUGS,PSSCOUNT) ;
  1. ; @DESC Builds a single drug xml element
  1. ;
  1. ; @PSSDRUGS A handle to the drug object
  1. ; @PSSCOUNT The counter where the information should be taken from
  1. ;
  1. ; @RETURNS An PSSXML string representing a single drug
  1. ;
  1. NEW PSS,PSSXML,PSSORDR
  1. ;
  1. IF $DATA(PSSDRUGS("DRUG",PSSCOUNT,"drugName")) DO
  1. . SET PSS("drugName")=$$ATRIBUTE^PSSHRCOM("drugName",PSSDRUGS("DRUG",PSSCOUNT,"drugName"))
  1. ;
  1. SET PSS("gcnSeqNo")=$$ATRIBUTE^PSSHRCOM("gcnSeqNo",PSSDRUGS("DRUG",PSSCOUNT,"gcn"))
  1. ;
  1. SET PSS("ien")=$$ATRIBUTE^PSSHRCOM("ien",PSSDRUGS("DRUG",PSSCOUNT,"ien"))
  1. ;
  1. ; Concatenate the orderNumber, cprs order number, and package
  1. ; ex. orderNumber|cprsOrderNumber|package
  1. SET PSSORDR=PSSDRUGS("DRUG",PSSCOUNT,"orderNumber")_"|"_$GET(PSSDRUGS("DRUG",PSSCOUNT,"cprsOrderNumber"))_"|"_$GET(PSSDRUGS("DRUG",PSSCOUNT,"package"))
  1. ;
  1. SET PSS("orderNumber")=$$ATRIBUTE^PSSHRCOM("orderNumber",PSSORDR)
  1. ;
  1. ; vuid is optional
  1. IF $DATA(PSSDRUGS("DRUG",PSSCOUNT,"vuid")) DO
  1. . SET PSS("vuid")=$$ATRIBUTE^PSSHRCOM("vuid",PSSDRUGS("DRUG",PSSCOUNT,"vuid"))
  1. ;
  1. SET PSSXML="<drug "_PSS("drugName")_" "_PSS("gcnSeqNo")_" "_PSS("ien")_" "_PSS("orderNumber")_" "_PSS("vuid")_" >"
  1. SET PSSXML=PSSXML_$$RITEDOSE(.PSSDRUGS,PSSCOUNT)
  1. SET PSSXML=PSSXML_"</drug>"
  1. ;
  1. QUIT PSSXML
  1. ;;
  1. READDOSE(PSSBASE,PSSHASH,PSSCOUNT,ORDRNM) ;
  1. ; @DESC Sets the individual drugDose elements, including all dosing amounts,
  1. ; frequency, etc for an individual drug.
  1. ;
  1. ; @DOSE A handle to the drug dose you want to turn into PSSXML
  1. ;
  1. ; @RETURNS Nothing, values stored in hash
  1. ;
  1. NEW PSS
  1. ;
  1. ; If no drug dose information exist for the drug quit
  1. IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))=0 SET PSSHASH("DRUG",PSSCOUNT,"hasDose")=0
  1. IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))=0 QUIT
  1. IF $DATA(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))>0 SET PSSHASH("DRUG",PSSCOUNT,"hasDose")=1
  1. ;
  1. SET PSS("value")=$GET(^TMP($JOB,PSSBASE,"IN","DOSE",ORDRNM))
  1. ; If specific get values (doseAmount,doseUnit,doseRate,frequency,
  1. ; duration,durationRate,medicalRoute,doseType)
  1. SET PSSHASH("DRUG",PSSCOUNT,"doseAmount")=$PIECE(PSS("value"),"^",5)
  1. SET PSSHASH("DRUG",PSSCOUNT,"doseUnit")=$PIECE(PSS("value"),"^",6)
  1. SET PSSHASH("DRUG",PSSCOUNT,"doseRate")=$PIECE(PSS("value"),"^",7)
  1. SET PSSHASH("DRUG",PSSCOUNT,"frequency")=$PIECE(PSS("value"),"^",8)
  1. SET PSSHASH("DRUG",PSSCOUNT,"duration")=$PIECE(PSS("value"),"^",9)
  1. SET PSSHASH("DRUG",PSSCOUNT,"durationRate")=$PIECE(PSS("value"),"^",10)
  1. SET PSSHASH("DRUG",PSSCOUNT,"route")=$PIECE(PSS("value"),"^",11)
  1. SET PSSHASH("DRUG",PSSCOUNT,"doseType")=$PIECE(PSS("value"),"^",12)
  1. QUIT
  1. ;;
  1. RITEDOSE(PSSHASH,I) ;
  1. ; @DESC Writes the doseInformation PSSXML element
  1. ;
  1. ; @PSSHASH Hash value with variables used to create element
  1. ;
  1. ; @RETURNS A valid drugDose XML element
  1. ;
  1. NEW PSSXML
  1. ;
  1. SET PSSXML=""
  1. IF +$GET(PSSHASH("DRUG",I,"hasDose"))=0 QUIT PSSXML
  1. ;
  1. ; Create dose information
  1. SET PSSXML="<doseInformation>"
  1. SET PSSXML=PSSXML_"<doseType>"_PSSHASH("DRUG",I,"doseType")_"</doseType>"
  1. SET PSSXML=PSSXML_"<doseAmount>"_PSSHASH("DRUG",I,"doseAmount")_"</doseAmount>"
  1. SET PSSXML=PSSXML_"<doseUnit>"_PSSHASH("DRUG",I,"doseUnit")_"</doseUnit>"
  1. SET PSSXML=PSSXML_"<doseRate>"_PSSHASH("DRUG",I,"doseRate")_"</doseRate>"
  1. I $L(PSSHASH("DRUG",I,"frequency")) SET PSSXML=PSSXML_"<frequency>"_PSSHASH("DRUG",I,"frequency")_"</frequency>"
  1. I $L(PSSHASH("DRUG",I,"duration")) SET PSSXML=PSSXML_"<duration>"_PSSHASH("DRUG",I,"duration")_"</duration>"
  1. I $L(PSSHASH("DRUG",I,"durationRate")) SET PSSXML=PSSXML_"<durationRate>"_PSSHASH("DRUG",I,"durationRate")_"</durationRate>"
  1. SET PSSXML=PSSXML_"<route>"_PSSHASH("DRUG",I,"route")_"</route>"
  1. ;
  1. ; Close off dose information
  1. SET PSSXML=PSSXML_"</doseInformation>"
  1. ;
  1. QUIT PSSXML
  1. ;;