source: WorldVistAEHR/trunk/r/PHARMACY_DATA_MANAGEMENT-PSS/PSS50P66.m@ 1361

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

initial load of WorldVistAEHR

File size: 5.3 KB
RevLine 
[613]1PSS50P66 ;BIR/LDT - API FOR INFORMATION FROM FILE 50.606; 5 Sep 03
2 ;;1.0;PHARMACY DATA MANAGEMENT;**85**;9/30/97
3 ;
4ALL(PSSIEN,PSSFT,PSSFL,LIST) ;
5 ;PSSIEN - IEN of entry in DOSAGE FORM file (#50.606).
6 ;PSSFT - Free Text name in DOSAGE FORM file (#50.606).
7 ;PSSFL - Inactive flag - "" - All entries.
8 ; FileMan Date - Only entries with no Inactive Date or an Inactive Date greater than this date.
9 ;LIST - Subscript of ^TMP array in the form ^TMP($J,LIST,Field Number where
10 ; Field Number is the Field Number of the data piece being returned.
11 ;Returns NAME field (#.01), VERB field (#3), PREPOSITION field (#5), INACTIVE DATE field (#7),
12 ;MED ROUTE FOR DOSAGE FORM multiple (#50.6061), MED ROUTE FOR DOSAGE FORM field (#.01), and NOUN multiple (#50.6066),
13 ;NOUN field (#.01) of DOSAGE FORM file (#50.606).
14 N DIERR,ZZERR,PSS,CNT,CNT1,SCR
15 I $G(LIST)']"" Q
16 K ^TMP($J,LIST)
17 I $G(PSSIEN)']"",($G(PSSFT)']"") S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
18 I $G(PSSIEN)]"",+$G(PSSIEN)'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
19 S SCR("S")=""
20 I +$G(PSSFL)>0 N ND D SETSCRN
21 I +$G(PSSIEN)>0 N PSSIEN2 S PSSIEN2=$$FIND1^DIC(50.606,"","X","`"_PSSIEN,,SCR("S"),"") D
22 .I +PSSIEN2'>0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
23 .S ^TMP($J,LIST,0)=1
24 .D GETS^DIQ(50.606,+PSSIEN2,".01;3;5;7;1*;6*","IE","^TMP($J,""PSS50P66""") S PSS(1)=0 D
25 ..F S PSS(1)=$O(^TMP($J,"PSS50P66",50.606,PSS(1))) Q:'PSS(1) D SETZRO
26 ..S (CNT,PSS(2))=0 F S PSS(2)=$O(^TMP($J,"PSS50P66",50.6061,PSS(2))) Q:'PSS(2) D SETMRDF S CNT=CNT+1
27 ..S ^TMP($J,LIST,+PSSIEN,"MRDSFRM",0)=$S($G(CNT)>0:CNT,1:"-1^NO DATA FOUND")
28 ..S (CNT1,PSS(3))=0 F S PSS(3)=$O(^TMP($J,"PSS50P66",50.6066,PSS(3))) Q:'PSS(3) D SETNOUN S CNT1=CNT1+1
29 ..S ^TMP($J,LIST,+PSSIEN,"NOUN",0)=$S($G(CNT1)>0:CNT1,1:"-1^NO DATA FOUND")
30 I $G(PSSIEN)="",$G(PSSFT)]"" D
31 .I PSSFT["??" D LOOP Q
32 .D FIND^DIC(50.606,,"@;.01","QP",PSSFT,,"B",SCR("S"),,"")
33 .I +$G(^TMP("DILIST",$J,0))=0 S ^TMP($J,LIST,0)=-1_"^"_"NO DATA FOUND" Q
34 .I +^TMP("DILIST",$J,0)>0 S ^TMP($J,LIST,0)=+^TMP("DILIST",$J,0) N PSSXX S PSSXX=0 F S PSSXX=$O(^TMP("DILIST",$J,PSSXX)) Q:'PSSXX D
35 ..S PSSIEN=+^TMP("DILIST",$J,PSSXX,0) K ^TMP($J,"PSS50P66") D GETS^DIQ(50.606,+PSSIEN,".01;3;5;7;1*;6*","IE","^TMP($J,""PSS50P66""") S PSS(1)=0
36 ..F S PSS(1)=$O(^TMP($J,"PSS50P66",50.606,PSS(1))) Q:'PSS(1) D SETZRO
37 ..S (CNT,PSS(2))=0 F S PSS(2)=$O(^TMP($J,"PSS50P66",50.6061,PSS(2))) Q:'PSS(2) D SETMRDF S CNT=CNT+1
38 ..S ^TMP($J,LIST,+PSSIEN,"MRDSFRM",0)=$S($G(CNT)>0:CNT,1:"-1^NO DATA FOUND")
39 ..S (CNT1,PSS(3))=0 F S PSS(3)=$O(^TMP($J,"PSS50P66",50.6066,PSS(3))) Q:'PSS(3) D SETNOUN S CNT1=CNT1+1
40 ..S ^TMP($J,LIST,+PSSIEN,"NOUN",0)=$S($G(CNT1)>0:CNT1,1:"-1^NO DATA FOUND")
41 K ^TMP("DILIST",$J),^TMP($J,"PSS50P66")
42 Q
43 ;
44ADD(PSSIEN,PSSMR) ;
45 ;PSSIEN - IEN of entry in DOSAGE FORM file (#50.606).
46 ;PSSMR - IEN of entry in MEDICATION ROUTES file (#51.2).
47 ;0 (zero)is returned if ADD was unsuccessful. 1 (one) will indicate successful ADD.
48 ;Adding new entry to MED ROUTE FOR DOSAGE FORM multiple (#50.6061) of the DOSAGE FORM file (#50.606).
49 I (+$G(PSSIEN)'>0),(+$G(PSSMR)'>0) Q 0
50 N PSS,QFLG
51 N PSSIEN2 S PSSIEN2=$$FIND1^DIC(51.2,"","A","`"_PSSMR,,,"")
52 I +PSSIEN2'>0 Q 0
53 N PSSIEN3 S PSSIEN3=$$FIND1^DIC(50.606,"","A","`"_PSSIEN,,,"")
54 I +PSSIEN3'>0 Q 0
55 D LIST^DIC(50.6061,","_PSSIEN_",","@;.01IE","P",,,,,,,)
56 I +^TMP("DILIST",$J,0)'>0 D
57 .S PSS(1,50.6061,"+2,"_PSSIEN_",",.01)=$G(PSSMR)
58 I +^TMP("DILIST",$J,0)>0 S (QFLG,PSS)=0 F S PSS=$O(^TMP("DILIST",$J,PSS)) Q:'PSS Q:QFLG D
59 .I $P($G(^TMP("DILIST",$J,PSS,0)),"^",2)=PSSMR S QFLG=1 Q
60 .S PSS(1,50.6061,"+2,"_PSSIEN_",",.01)=$G(PSSMR)
61 I $G(QFLG) Q 0
62 D UPDATE^DIE("","PSS(1)") Q 1
63 Q
64 ;
65SETZRO ;
66 S ^TMP($J,LIST,+PSS(1),.01)=$G(^TMP($J,"PSS50P66",50.606,PSS(1),.01,"I"))
67 S ^TMP($J,LIST,"B",$G(^TMP($J,"PSS50P66",50.606,PSS(1),.01,"I")),+PSS(1))=""
68 S ^TMP($J,LIST,+PSS(1),3)=$G(^TMP($J,"PSS50P66",50.606,PSS(1),3,"I"))
69 S ^TMP($J,LIST,+PSS(1),5)=$G(^TMP($J,"PSS50P66",50.606,PSS(1),5,"I"))
70 S ^TMP($J,LIST,+PSS(1),7)=$S($G(^TMP($J,"PSS50P66",50.606,PSS(1),7,"I"))="":"",1:^TMP($J,"PSS50P66",50.606,PSS(1),7,"I")_"^"_^TMP($J,"PSS50P66",50.606,PSS(1),7,"E"))
71 Q
72SETMRDF ;
73 S ^TMP($J,LIST,+PSSIEN,"MRDSFRM",+PSS(2),.01)=$S($G(^TMP($J,"PSS50P66",50.6061,PSS(2),.01,"I"))="":"",1:^TMP($J,"PSS50P66",50.6061,PSS(2),.01,"I")_"^"_^TMP($J,"PSS50P66",50.6061,PSS(2),.01,"E"))
74 Q
75 ;
76SETNOUN ;
77 S ^TMP($J,LIST,+PSSIEN,"NOUN",+PSS(3),.01)=$S($G(^TMP($J,"PSS50P66",50.6066,PSS(3),.01,"I"))="":"",1:^TMP($J,"PSS50P66",50.6066,PSS(3),.01,"I"))
78 Q
79 ;
80LOOP ;
81 N PSSIEN,CNT2,CNT1
82 S (CNT2,PSSIEN)=0 F S PSSIEN=$O(^PS(50.606,PSSIEN)) Q:'PSSIEN D
83 .I +$G(PSSFL)>0,$P($G(^PS(50.606,PSSIEN,0)),"^",2)]"",$P($G(^(0)),"^",2)'>PSSFL Q
84 .K ^TMP($J,"PSS50P66") D GETS^DIQ(50.606,+PSSIEN,".01;3;5;7;1*;6*","IE","^TMP($J,""PSS50P66""") S PSS(1)=0 D
85 ..F S PSS(1)=$O(^TMP($J,"PSS50P66",50.606,PSS(1))) Q:'PSS(1) D SETZRO S CNT2=CNT2+1
86 ..S (CNT,PSS(2))=0 F S PSS(2)=$O(^TMP($J,"PSS50P66",50.6061,PSS(2))) Q:'PSS(2) D SETMRDF S CNT=CNT+1
87 ..S (CNT1,PSS(3))=0 F S PSS(3)=$O(^TMP($J,"PSS50P66",50.6066,PSS(3))) Q:'PSS(3) D SETNOUN S CNT1=CNT1+1
88 ..S ^TMP($J,LIST,+PSSIEN,"MRDSFRM",0)=$S($G(CNT)>0:CNT,1:"-1^NO DATA FOUND")
89 ..S ^TMP($J,LIST,0)=$S($G(CNT2)>0:CNT2,1:"-1^NO DATA FOUND")
90 ..S ^TMP($J,LIST,+PSSIEN,"NOUN",0)=$S($G(CNT1)>0:CNT1,1:"-1^NO DATA FOUND")
91 K ^TMP($J,"PSS50P66")
92 Q
93 ;
94SETSCRN ;
95 S SCR("S")="S ND=$P($G(^PS(50.606,+Y,0)),""^"",2) I ND=""""!(ND>PSSFL)"
96 Q
Note: See TracBrowser for help on using the repository browser.