source: WorldVistAEHR/trunk/r/PHARMACY_DATA_MANAGEMENT-PSS/PSSJORDF.m@ 1773

Last change on this file since 1773 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 2.9 KB
Line 
1PSSJORDF ;BIR/MV-RETURN MED ROUTES(MR) AND INSTRUCTIONS(INS) ;06/26/98
2 ;;1.0;PHARMACY DATA MANAGEMENT;**5,13,34,38,69,113**;9/30/97;Build 1
3 ;;
4 ;* PSJORD is the Orderable Item IEN pass to Pharmacy by OE/RR.
5 ;* 1. If the dosage form is valid, this routine will return all med
6 ;* routes and instructions associated with that dose form.
7 ;* 2. If the dose form is null, this routine will return all med routes
8 ;* that exist in the medication routes file.
9 ;* 3. ^TMP format:
10 ;* ^TMP("PSJMR",$J,#)=MED ROUTE^MED ROUTE ABREVATION^IEN^OUTPATIENT
11 ;* EXPANSION^IV FLAG^DEFAULT FLAG
12 ;* ^TMP("PSJNOUN",$J,D0)=NOUN^VERB^PREPOSITION
13 ;* ^TMP("PSJSCH",$J)=DEFAULT SCHEDULE NAME
14 ;
15START(PSJORD,PSJOPAC) ;
16 NEW MR,MRNODE,INS,PSJDFNO,X,MCT,Z,PSJOISC
17 I '+PSJORD D MEDROUTE Q
18 S PSJDFNO=+$P($G(^PS(50.7,+PSJORD,0)),U,2)
19 ;S ^TMP("PSJSCH",$J)=$P($G(^PS(50.7,+PSJORD,0)),"^",8) ;default schedule
20 S PSJOISC=$P($G(^PS(50.7,+PSJORD,0)),"^",8)
21 I $G(PSJOPAC)="O"!($G(PSJOPAC)="X") D:$G(PSJOISC)'="" EN^PSSOUTSC(.PSJOISC) S:$G(PSJOISC)'="" ^TMP("PSJSCH",$J)=$G(PSJOISC) G SCPASS
22 I $G(PSJOISC)'="" D EN^PSSGSGUI(.PSJOISC,"I") S:$G(PSJOISC)'="" ^TMP("PSJSCH",$J)=$G(PSJOISC)
23SCPASS ;
24 I $G(^PS(50.606,PSJDFNO,0))="" D NOD Q:$D(^TMP("PSJMR",$J,1)) D MEDROUTE Q
25 K ^TMP("PSJMR",$J),^TMP("PSJNOUN",$J)
26 D DF
27 Q
28 ;
29DF ;* Loop thru DF node to find all available med routes, nouns, and instructions.
30 N VERB,MR,INS,X
31 S (MR,INS,X,MCT)=0
32 S VERB=$P($G(^PS(50.606,PSJDFNO,"MISC")),U)
33 S MR=+$P($G(^PS(50.7,+PSJORD,0)),"^",6) I MR,$D(^PS(51.2,MR,0)),$P($G(^(0)),"^",4)=1 S ^TMP("PSJMR",$J,1)=$P(^PS(51.2,MR,0),"^")_U_$P(^(0),"^",3)_U_MR_U_$P(^(0),"^",2)_U_$S($P(^(0),"^",6):1,1:0)_"^D",MCT=MCT+1
34 S MR=0 F S MR=$O(^PS(50.606,PSJDFNO,"MR",MR)) Q:'MR D
35 . S X=+$G(^PS(50.606,PSJDFNO,"MR",MR,0)) Q:'X!($P($G(^TMP("PSJMR",$J,1)),"^",3)=X)
36 . S MRNODE=$G(^PS(51.2,X,0))
37 . I $P($G(MRNODE),"^",4)'=1 Q
38 . S MCT=MCT+1,^TMP("PSJMR",$J,MCT)=$P(MRNODE,U)_U_$P(MRNODE,U,3)_U_X_U_$P(MRNODE,U,2)_U_$S($P(MRNODE,U,6):1,1:0)
39 S X=0
40 ;F S INS=$O(^PS(50.606,PSJDFNO,"INS",INS)) Q:'INS S X=X+1,^TMP("PSJINS",$J,X)=VERB_U_$G(^PS(50.606,PSJDFNO,"INS",INS,0))
41 ;I '$D(^TMP("PSJINS",$J)),VERB]"" S ^TMP("PSJINS",$J,1)=VERB
42 S X=0
43 I $D(^PS(50.606,PSJDFNO,"NOUN")) F Z=0:0 S Z=$O(^PS(50.606,PSJDFNO,"NOUN",Z)) Q:'Z S X=X+1,^TMP("PSJNOUN",$J,X)=$P($G(^PS(50.606,PSJDFNO,"NOUN",Z,0)),U)_U_$P($G(^PS(50.606,PSJDFNO,"MISC")),U)_U_$P($G(^("MISC")),U,3)
44 Q
45 ;
46MEDROUTE ;* Return all med routes in the med routes file.
47 S (MR,MCT)=0 K ^TMP("PSJMR",$J)
48 F S MR=$O(^PS(51.2,MR)) Q:'MR S MRNODE=^PS(51.2,MR,0) I $P(^PS(51.2,MR,0),"^",4)=1 S MCT=MCT+1,^TMP("PSJMR",$J,MCT)=$P(MRNODE,U)_U_$P(MRNODE,U,3)_U_MR_U_$P(MRNODE,U,2)_U_$S($P(MRNODE,U,6):1,1:0)
49 Q
50NOD K ^TMP("PSJMR",$J)
51 S MR=+$P($G(^PS(50.7,+PSJORD,0)),"^",6) I MR,$D(^PS(51.2,MR,0)),$P(^PS(51.2,MR,0),"^",4)=1 S ^TMP("PSJMR",$J,1)=$P(^PS(51.2,MR,0),"^")_U_$P(^(0),"^",3)_U_MR_U_$P(^(0),"^",2)_U_$S($P(^(0),"^",6):1,1:0)_"^D"
52 Q
Note: See TracBrowser for help on using the repository browser.