source: FOIAVistA/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNPSR18.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 2.6 KB
Line 
1SPNPSR18 ;HIRMFO/JWR,WAA-HUNT: MEDICATION SEARCH ;3/1/96 14:16
2 ;;2.0;Spinal Cord Dysfunction;**9**;01/02/1997
3 ;
4EN1(D0,FDATE,TDATE,ACTION,SEQUENCE) ; *** Search entry point
5 ; Input:
6 ; ACTION,SEQUENCE = Search ACTION,SEQUENCE number
7 ; D0 = SCD (SPINAL CORD) REGISTRY file (#154) IEN
8 ; ^TMP($J,"SPNPRT",ACTION,SEQUENCE,"BEGINING DATE") = Date ^ Date(ext)
9 ; ^TMP($J,"SPNPRT",ACTION,SEQUENCE,"ENDING DATE") = Date ^ Date(ext)
10 ; ^TMP($J,"SPNPRT",ACTION,SEQUENCE,"DRUG CLASS",IEN) = DRUG CLASS
11 ; FDATE = Date
12 ; TDATE = Date
13 ; Output:
14 ; $S( D0_Meets_Search_Criteria : 1 , 1 : 0 )
15 ;
16 N AGE,DFN,I,MEETSRCH,VA,VADM,VAERR
17 S (SPNLDFN,DFN)=+$P($G(^SPNL(154,D0,0)),U)
18 ;
19PHARM S MEETSRCH=0
20 Q:'$D(ACTION)
21 Q:'$D(SEQUENCE)
22 I '$D(TDATE) S TDATE=DT
23 S EXPDATE=FDATE-.000001,SPNCN1=0 ; for each expiration date
24 F S EXPDATE=$O(^PS(55,SPNLDFN,"P","A",EXPDATE)) Q:EXPDATE'>0!(EXPDATE>TDATE)!(MEETSRCH=1) D
25 . S RECNR=0 ; for each prescription on that date
26 . F S RECNR=$O(^PS(55,SPNLDFN,"P","A",EXPDATE,RECNR)) Q:RECNR'>0!(MEETSRCH=1) D
27 . . S NDRG=$P($G(^PSRX(RECNR,0)),U,6) Q:NDRG=""
28 . . S NDREC=$P($G(^PSDRUG(NDRG,0)),U,2) D:NDREC'=""
29 . . . S CN="" F S CN=$O(^TMP($J,"SPNPRT",ACTION,SEQUENCE,"DRUG CLASS",CN)) Q:CN<1 I $P($G(^TMP($J,"SPNPRT",ACTION,SEQUENCE,"DRUG CLASS",CN)),U,2)=NDREC S MEETSRCH=1 Q
30 . . Q
31 . Q
32 K NDRG
33Q Q MEETSRCH
34EN2(ACTION,SEQUENCE) ; *** Prompt entry point
35 ; Input:
36 ; ACTION,SEQUENCE = Search ACTION,SEQUENCE number
37 ; ^TMP($J,"SPNPRT",ACTION,SEQUENCE,"BEGINING DATE") = Date ^ Date(ext)
38 ; ^TMP($J,"SPNPRT",ACTION,SEQUENCE,"ENDING DATE") = Date ^ Date(ext)
39 ; ^TMP($J,"SPNPRT",ACTION,SEQUENCE,"DRUG CLASS",IEN) =
40 ; ^TMP($J,"SPNPRT",ACTION,SEQUENCE,0)=$$EN1^SPNPSR18(D0,BDATE,EDATE,ACTION,SEQUENCE)
41 ; Output:
42 ; SPNLEXIT = $S( User_Abort/Timeout : 1 , 1 : 0 )
43 ;
44 N DIC,DIR,DIRUT,DTOUT,DUOUT,I
45DIR K ^TMP($J,"SPNPRT",ACTION,SEQUENCE),DIR,DIC
46 S DIC=50.605,DIC(0)="AEMNQZ" K DIRUT
47 I +Y>1 F D Q:SPNLEXIT Q:Y<1
48 . I $D(DUOUT)!($D(DTOUT)) S SPNLEXIT=1 Q
49 . Q:Y'>0 D ^DIC I Y>0 D
50 .. I $D(^TMP($J,"SPNPRT",ACTION,SEQUENCE,"DRUG CLASS",+Y)) W !,"You have already selected that drug class." Q
51 .. S ^TMP($J,"SPNPRT",ACTION,SEQUENCE,"DRUG CLASS",+Y)=$P($G(^PS(50.605,+Y,0)),U,2)_U_$P(Y,U,2)
52 . S DIR("A")="Another: "
53 . Q
54 Q:SPNLEXIT=1 K DIR
55 S Y=$O(^TMP($J,"SPNPRT",ACTION,SEQUENCE,"DRUG CLASS",0))
56 Q:Y<1
57 W !!,"Enter the date range to search for the selected Medications"
58 S (BDATE,EDATE)=""
59 D EN1^SPNPSR00(ACTION,SEQUENCE+.1,.BDATE,.EDATE)
60 S ^TMP($J,"SPNPRT",ACTION,SEQUENCE,0)="$$EN1^SPNPSR18(D0,"_BDATE_","_EDATE_","""_ACTION_""","_SEQUENCE_")"
61 Q
Note: See TracBrowser for help on using the repository browser.