source: FOIAVistA/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNFEDI.m@ 1635

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

initial load of FOIAVistA 6/30/08 version

File size: 4.6 KB
Line 
1SPNFEDI ;WDE/SD LOOK-UP RECORDS IN 154.1 ;10/17/2001
2 ;;2.0;Spinal Cord Dysfunction;**12,13,16**;01/02/1997
3 ; called from spnfedt0
4EN(SPNFTYPE,SPNFDFN) ;
5 K ^UTILITY($J,"FUN")
6 K ^UTILITY($J,"FUNSORT")
7 K ^TMP($J,"TEMP ADM")
8 ;---------------------------------------------------------------------
9 ;build scratch global so we can check admissions on file
10 ;to what is in 154.1
11 S SPNCH="" F S SPNCH=$O(^DGPM("ATID1",SPNFDFN,SPNCH)) Q:(SPNCH="")!('+SPNCH) D
12 .S SPNCHK=0,SPNCHK=$O(^DGPM("ATID1",SPNFDFN,SPNCH,SPNCHK))
13 .S ^TMP($J,"TEMP ADM",$P($G(^DGPM(SPNCHK,0)),U,1))=""
14 S SPNFD0=0 F S SPNFD0=$O(^SPNL(154.1,"B",SPNFDFN,SPNFD0)) Q:(SPNFD0="")!('+SPNFD0) D
15 .S SPNDATA=""
16 .S SPNDATA=$P($G(^SPNL(154.1,SPNFD0,2)),U,18)
17 .I $L(SPNDATA) I '$D(^TMP($J,"TEMP ADM",SPNDATA)) S DIE="^SPNL(154.1,",DA=SPNFD0,DR=".022////@;1000////@" D ^DIE ;clean deleted admission
18 .S SPNDATA=""
19 .S SPNDATA=$G(^SPNL(154.1,SPNFD0,0)) Q:SPNDATA=""
20 .S SPNRTYP=$P(SPNDATA,U,2) Q:SPNRTYP="" ;no record type
21 .I SPNRTYP'=SPNFTYPE S (SPNDATA,SPNRTYP)="" Q
22 .S SPNRDT=$P(SPNDATA,U,4) Q:SPNRDT="" S SPNRDT=999999999-SPNRDT
23 .S ^UTILITY($J,"FUN",SPNRDT,SPNFD0)=SPNFD0
24 S SPNY=0,SPNCNT=0 F S SPNY=$O(^UTILITY($J,"FUN",SPNY)) Q:SPNY="" S SPNZ="" F S SPNZ=$O(^UTILITY($J,"FUN",SPNY,SPNZ)) Q:(SPNZ="")!('+SPNZ) D
25 .S SPNCNT=SPNCNT+1 S ^UTILITY($J,"FUNSORT",SPNCNT,SPNY,SPNZ)=$G(^UTILITY($J,"FUN",SPNY))
26 S ^UTILITY($J,"FUNSORT",0)=SPNCNT
27 K ^UTILITY($J,"FUN")
28SHOW ;
29 D HDR
30 S SPNSEL=""
31 S SPNVAL=0
32 S SPNCNT=0
33 S SPNROW=0
34 I $G(^UTILITY($J,"FUNSORT",0))=0 W !!?10,"No Outcomes on file.",!?10,"You can add one if you wish.",! S SPNSEL="A" Q
35 F S SPNCNT=$O(^UTILITY($J,"FUNSORT",SPNCNT)) Q:SPNCNT="" S SPNREV=0 F S SPNREV=$O(^UTILITY($J,"FUNSORT",SPNCNT,SPNREV)) Q:SPNREV="" S SPNZ="" F S SPNZ=$O(^UTILITY($J,"FUNSORT",SPNCNT,SPNREV,SPNZ)) Q:SPNZ="" D
36 .;I SPNCNT>28 D HDR
37 .S SPNFD0=SPNZ D BLD
38 .S Y=999999999-SPNREV X ^DD("DD") S SPNRDAT=Y
39 .W !,SPNCNT,") ",SPNRDAT,?16,SPNDISP S SPNLINE=SPNLINE+1,SPNVAL=SPNVAL+1
40 .S SPNROW=SPNROW+1
41 .I SPNROW>15 D SEL S:SPNSEL="" SPNROW=0 D:SPNSEL="" HDR I SPNSEL'="" S SPNCNT=99999999,SPNREV="Z" Q
42 .;I SPNLINE>15 D SEL D HDR:SPNSEL="" S SPNLINE=0 I SPNSEL'="" S SPNCNT=9999999,SPNREV="Z" Q
43 I SPNSEL="" D SEL
44 ;added spnrow to count the row displayed patch 16
45VALUE ;
46 ;evaluate the value in spnsel
47 I SPNSEL="a" S SPNSEL="A"
48 I SPNSEL="A" D ZAP
49 Q:SPNSEL="A"
50 I SPNSEL["^" D ZAP Q
51 I SPNSEL>SPNVAL W !?10,"Not on the list.." H 2 D ZAP S SPNSEL="^" Q
52 I SPNSEL="" D ZAP S SPNSEL="^" Q
53 I SPNSEL>$G(^UTILITY($J,"FUNSORT",0)) W !?10,"Not on the list" H 2 S SPNSEL="^" D ZAP Q
54 I $D(^UTILITY($J,"FUNSORT",SPNSEL))=0 W !?10,"Not on the list" H 2 S SPNSEL="^" D ZAP Q
55 I '+SPNSEL D ZAP Q
56 S SPNX="",SPNX=$O(^UTILITY($J,"FUNSORT",SPNSEL,SPNX)),SPNFD0="",SPNFD0=$O(^UTILITY($J,"FUNSORT",SPNSEL,SPNX,SPNFD0))
57 Q
58BLD ;
59 S SPNDISP=""
60 S SPDTA=$G(^SPNL(154.1,SPNFD0,2))
61 S SPNDISP="Admission: "
62 S SPNTMP=$P(SPDTA,U,18) I +SPNTMP S SPNTMP=$$FMTE^XLFDT(SPNTMP,"5ZDP") S SPNDISP=SPNDISP_SPNTMP
63 I SPNTMP="" S SPNDISP=SPNDISP_" "
64 S SPNDISP=SPNDISP_" Score type: "
65 S SPNTMP=$P(SPDTA,U,17)
66 S SPNTMP=$S(SPNTMP=1:"Admission ",SPNTMP=2:"Goal ",SPNTMP=3:"Interim ",SPNTMP=4:"Discharge",SPNTMP=5:"OutPatient",1:" ")
67 S SPNDISP=SPNDISP_SPNTMP
68 S SPNTMP=$P($G(^SPNL(154.1,SPNFD0,"MS")),U,9)
69 I SPNTMP="" K SPNTMP,SPDTA S:$P($G(^SPNL(154.1,SPNFD0,0)),U,2)=4 SPNDISP=SPNDISP_" EDSS Score: " S Y=SPNFD0 Q ;No edss score
70 S SPNDISP=SPNDISP_" EDSS Score: "
71 S SPNTMP=$P($G(^SPNL(154.2,SPNTMP,0)),U,1)
72 I SPNTMP="" S SPNTMP=" "
73 S SPNDISP=SPNDISP_SPNTMP
74 K SPNTMP,SPDTA
75 K SPNFD0
76 Q
77 W:$D(IOF) @IOF W #
78 Q
79HDR ;
80 S SPNLINE=7 ;NEW
81 I $D(IOF) W @IOF
82 W !?20,$S(SPNFTYPE=1:"Self Reported Functional Measure",SPNFTYPE=2:"Clinician Reported FIM",SPNFTYPE=3:"CHART/FAM/DIENNER/DUSOI",SPNFTYPE=5:"ASIA Score",SPNFTYPE=4:"MS module (Kurtzke/EDSS)",1:"ERROR")
83 S SPNSSN=$P($G(^DPT(SPNFDFN,0)),U,9) S SPNSSN=$E(SPNSSN,1,3)_"-"_$E(SPNSSN,4,5)_"-"_$E(SPNSSN,6,9)
84 W !!,"Patient: ",$P(^DPT(SPNFDFN,0),U,1),?35,"SSN: ",SPNSSN
85 W !,"------------------------------------------------------------------------------"
86 Q
87SEL ;
88 W !,"-----------------------------------------------------------------------------"
89 W !,"Select 1 through "_$S('+SPNCNT:$G(^UTILITY($J,"FUNSORT",0)),1:SPNCNT)_" of "_$G(^UTILITY($J,"FUNSORT",0))_" or A to add a new record or ^ to quit."
90 I SPNVAL<$G(^UTILITY($J,"FUNSORT",0)) W !,"Or Return to see the next group."
91 R !?5,"Select: ",SPNSEL:DTIME
92 I SPNSEL="" I SPNLINE=$G(^UTILITY($J,"FUNSORT",0)) S SPNSEL="^"
93 Q
94ZAP ;clean up table and get out of here
95 K ^UTILITY($J,"FUNSORT"),SPNVAL,SPNCNT,SPNLINE,SPNREV,SPNY,SPNRDAT,SPNDISP,X,Y,SPNFD0,SPNDATA,SPNRTYP,SPNRDT,SPNROW
96 Q
Note: See TracBrowser for help on using the repository browser.