CCRMEDS: Processing of multiple directions.

This commit is contained in:
sam 2008-09-28 15:32:16 +00:00
parent d840081086
commit 11f480b5ac
2 changed files with 54 additions and 52 deletions

View File

@ -102,9 +102,6 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
. S @MAP@("MEDQUANTITYUNIT")=QTYDATA(14.5)
. ;
. ; --- START OF DIRECTIONS ---
. ;
. S @MAP@("MEDDIRECTIONDESCRIPTIONTEXT")="" ; This is reserved for systems not able to generate the sig in components.
. S @MAP@("MEDDOSEINDICATOR")="1" ; means that we are specifying it. See E2369-05.
. ; Sig data not in any API :-( Oh yes, you can get the whole thing, but...
. ; we want the compoenents.
. ; It's in node 6 of ^PSRX(IEN)
@ -113,46 +110,52 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
. ; ==>[2N] ^ (#2) UNITS [3P:50.607] ^ (#3) NOUN [4F] ^ (#4)
. ; ==>DURATION [5F] ^ (#5) CONJUNCTION [6S] ^ (#6) ROUTE
. ; ==>[7P:51.2] ^ (#7) SCHEDULE [8F] ^ (#8) VERB [9F] ^
. N SIGDATA S SIGDATA=^PSRX(RXIEN,6,1,0)
. S @MAP@("MEDDELIVERYMETHOD")=$P(SIGDATA,U,9)
. S @MAP@("MEDDOSEVALUE")=$P(SIGDATA,U,1)
. S @MAP@("MEDDOSEUNIT")=@MAP@("MEDCONCUNIT")
. S @MAP@("MEDRATEVALUE")="" ; For inpatient
. S @MAP@("MEDRATEUNIT")="" ; For inpatient
. S @MAP@("MEDVEHICLETEXT")="" ; For inpatient
. S @MAP@("MEDDIRECTIONROUTETEXT")=$$GET1^DIQ(51.2,$P(SIGDATA,U,7),.01)
. S @MAP@("MEDFREQUENCYVALUE")=$P(SIGDATA,U,8)
. ; Invervals... again another call.
. ; In the wisdom of the original programmers, the schedule is a free text field
. ; However, it gets translated by a call to the administration schedule file
. ; to see if that schedule exists.
. ; That's the same thing I am going to do.
. ; The call is AP^PSS51P1(PSSPP,PSSFT,PSSWDIEN,PSSSTPY,LIST,PSSFREQ).
. ; PSSPP is "PSJ" (for some reason, schedules are stored as PSJ, not PSO--
. ; I looked), PSSFT is the name, and list is the ^TMP name to store the data in.
. ; So...
. D AP^PSS51P1("PSJ",$P(SIGDATA,U,8),,,"SCHEDULE")
. N SCHEDATA M SCHEDATA=^TMP($J,"SCHEDULE")
. N INTERVAL
. I $P(SCHEDATA(0),U)=-1 S INTERVAL=""
. E D
. . N SUB S SUB=$O(SCHEDATA(0))
. . S INTERVAL=SCHEDATA(SUB,2)
. S @MAP@("MEDINTERVALVALUE")=INTERVAL
. S @MAP@("MEDINTERVALUNIT")="Minute"
. S @MAP@("MEDDURATIONVALUE")=$P(SIGDATA,U,5)
. S @MAP@("MEDDURATIONUNIT")=""
. S @MAP@("MEDPRNFLAG")=$P(SIGDATA,U,8)["PRN"
. S @MAP@("MEDPROBLEMOBJECTID")=""
. S @MAP@("MEDPROBLEMTYPETXT")=""
. S @MAP@("MEDPROBLEMDESCRIPTION")=""
. S @MAP@("MEDPROBLEMCODEVALUE")=""
. S @MAP@("MEDPROBLEMCODINGSYSTEM")=""
. S @MAP@("MEDPROBLEMCODINGVERSION")=""
. S @MAP@("MEDPROBLEMSOURCEACTORID")=""
. S @MAP@("MEDSTOPINDICATOR")=""
. S @MAP@("MEDDIRSEQ")=""
. S @MAP@("MEDMULDIRMOD")=""
. ;
. N DIRNUM S DIRNUM=0 ; Sigline number
. F S DIRNUM=$O(^PSRX(RXIEN,6,DIRNUM)) Q:DIRNUM="" D
. . S @MAP@("MEDDIRECTIONDESCRIPTIONTEXT",DIRNUM)="" ; This is reserved for systems not able to generate the sig in components.
. . S @MAP@("MEDDOSEINDICATOR",DIRNUM)="1" ; means that we are specifying it. See E2369-05.
. . N SIGDATA S SIGDATA=^PSRX(RXIEN,6,DIRNUM,0)
. . S @MAP@("MEDDELIVERYMETHOD",DIRNUM)=$P(SIGDATA,U,9)
. . S @MAP@("MEDDOSEVALUE",DIRNUM)=$P(SIGDATA,U,1)
. . S @MAP@("MEDDOSEUNIT",DIRNUM)=@MAP@("MEDCONCUNIT")
. . S @MAP@("MEDRATEVALUE",DIRNUM)="" ; For inpatient
. . S @MAP@("MEDRATEUNIT",DIRNUM)="" ; For inpatient
. . S @MAP@("MEDVEHICLETEXT",DIRNUM)="" ; For inpatient
. . S @MAP@("MEDDIRECTIONROUTETEXT",DIRNUM)=$$GET1^DIQ(51.2,$P(SIGDATA,U,7),.01)
. . S @MAP@("MEDFREQUENCYVALUE",DIRNUM)=$P(SIGDATA,U,8)
. . ; Invervals... again another call.
. . ; In the wisdom of the original programmers, the schedule is a free text field
. . ; However, it gets translated by a call to the administration schedule file
. . ; to see if that schedule exists.
. . ; That's the same thing I am going to do.
. . ; The call is AP^PSS51P1(PSSPP,PSSFT,PSSWDIEN,PSSSTPY,LIST,PSSFREQ).
. . ; PSSPP is "PSJ" (for some reason, schedules are stored as PSJ, not PSO--
. . ; I looked), PSSFT is the name, and list is the ^TMP name to store the data in.
. . ; So...
. . D AP^PSS51P1("PSJ",$P(SIGDATA,U,8),,,"SCHEDULE")
. . N SCHEDATA M SCHEDATA=^TMP($J,"SCHEDULE")
. . N INTERVAL
. . I $P(SCHEDATA(0),U)=-1 S INTERVAL=""
. . E D
. . . N SUB S SUB=$O(SCHEDATA(0))
. . . S INTERVAL=SCHEDATA(SUB,2)
. . S @MAP@("MEDINTERVALVALUE",DIRNUM)=INTERVAL
. . S @MAP@("MEDINTERVALUNIT",DIRNUM)="Minute"
. . S @MAP@("MEDDURATIONVALUE",DIRNUM)=$P(SIGDATA,U,5)
. . S @MAP@("MEDDURATIONUNIT",DIRNUM)=""
. . S @MAP@("MEDPRNFLAG",DIRNUM)=$P(SIGDATA,U,8)["PRN"
. . S @MAP@("MEDPROBLEMOBJECTID",DIRNUM)=""
. . S @MAP@("MEDPROBLEMTYPETXT",DIRNUM)=""
. . S @MAP@("MEDPROBLEMDESCRIPTION",DIRNUM)=""
. . S @MAP@("MEDPROBLEMCODEVALUE",DIRNUM)=""
. . S @MAP@("MEDPROBLEMCODINGSYSTEM",DIRNUM)=""
. . S @MAP@("MEDPROBLEMCODINGVERSION",DIRNUM)=""
. . S @MAP@("MEDPROBLEMSOURCEACTORID",DIRNUM)=""
. . S @MAP@("MEDSTOPINDICATOR",DIRNUM)=""
. . S @MAP@("MEDDIRSEQ",DIRNUM)=DIRNUM
. . N DIRMOD S DIRMOD=$P(SIGDATA,U,6)
. . S @MAP@("MEDMULDIRMOD",DIRNUM)=$S(DIRMOD="T":"THEN",DIRMOD="A":"AND",DIRMOD="X":"EXCEPT",1:"")
. ;
. ; --- END OF DIRECTIONS ---
. ;
@ -161,10 +164,9 @@ EXTRACT(MINXML,DFN,OUTXML) ; EXTRACT MEDICATIONS INTO PROVIDED XML TEMPLATE
. ; ^PSRX(22,"PRC",1,0)="Pharmacist: you must obey my command"
. S @MAP@("MEDFULLFILLMENTINSTRUCTIONS")=$G(^PSRX(RXIEN,"PRC",1,0))
. S @MAP@("MEDRFNO")=MED(9)
. N RESULT S RESULT=$NA(^TMP("GPLCCR",$J,"RESULT"))
. N RESULT S RESULT=$NA(^TMP("GPLCCR",$J,"MAPPED"))
. K @RESULT
. ; D MAP^GPLXPATH($NA(INXML),MAP,RESULT)
. D MAP^GPLXPATH(MINXML,MAP,RESULT)
. D MAP^GPLXPATH(MINXML,MAP,RESULT)
. ; D PARY^GPLXPATH(RESULT)
. D:MEDCOUNT=1 CP^GPLXPATH(RESULT,OUTXML) ; First one is a copy
. D:MEDCOUNT>1 INSINNER^GPLXPATH(OUTXML,RESULT) ; AFTER THE FIRST, INSERT INNER XML

View File

@ -4,18 +4,18 @@ CCRUNIT ; A routine that tests some crap
;
MEDS
N DEBUG S DEBUG=0
N DFN S DFN=3
N DFN S DFN=1
K ^TMP($J)
W "Loading CCR Template into T using LOAD^GPLCCR0($NA(^TMP($J,""CCR"")))",!!
N T S T=$NA(^TMP($J,"CCR")) D LOAD^GPLCCR0(T)
N XPATH S XPATH="//ContinuityOfCareRecord/Body/Medications"
W "XPATH is: "_XPATH,!
W "Getting Med Template into INXML using",!
W "QUERY^GPLXPATH(T,XPATH,""INXML"")",!!
D QUERY^GPLXPATH(T,XPATH,"INXML")
W "Getting Med Template into MINXML using",!
W "QUERY^GPLXPATH(T,XPATH,""MINXML"")",!!
D QUERY^GPLXPATH(T,XPATH,"MINXML")
B
W "Executing EXTRACT^CCRMEDS(INXML,DFN,OUTXML)",!
W "Executing EXTRACT^CCRMEDS(MINXML,DFN,OUTXML)",!
W "OUTXML will be ^TMP($J,""OUT"")",!
N OUTXML S OUTXML=$NA(^TMP($J,"OUT"))
D EXTRACT^CCRMEDS(.INXML,DFN,OUTXML)
D EXTRACT^CCRMEDS("MINXML",DFN,OUTXML)
Q