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

View File

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