source: WorldVistAEHR/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNCTCUR.m@ 836

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

initial load of WorldVistAEHR

File size: 1.2 KB
Line 
1SPNCTCUR ;WDE/SD SETS UP TMP WITH CURRENT EPISODE ;6/28/02 05:15
2 ;;2.0;Spinal Cord Dysfunction;**19**;01/02/1997
3 ;
4 ;
5CUR(SPNCT,SPNDFN) ;
6 ; spnw is the care start date
7 ; spncdt is the most recent care date on file
8 ; This loop gets the latest care date on file
9 ;
10 S (SPNW,SPNCDT)=0
11 F S SPNW=$O(^UTILITY($J,SPNCT,SPNW)) Q:(SPNW="")!('+SPNW) I SPNW>SPNCDT S SPNCDT=SPNW
12 D BLD
13 Q
14 ;
15PAST(SPNCT,SPNCDT) ;
16 ; this will be used to build tmp with a past care date
17 D BLD
18 Q
19 ;
20BLD ;
21 ;NOW SET UP TMP BASED ON A CARE START DATE
22 ;
23 ;
24 K ^TMP($J)
25 ; spnw is the care start date
26 ; spncdt is the care date we want to build into tmp
27 ;
28 ;
29 S SPNCNT=0
30 S (SPNW,SPNX,SPNY)=""
31 F S SPNW=$O(^UTILITY($J,SPNCT,SPNCDT,SPNW)) Q:SPNW="" S SPNX="" F S SPNX=$O(^UTILITY($J,SPNCT,SPNCDT,SPNW,SPNX)) Q:SPNX="" D
32 .S SPNCNT=SPNCNT+1
33 .S ^TMP($J,SPNCNT,SPNW,SPNX)=SPNX
34 .S ^TMP($J,0)=SPNCNT
35 .; spncedt = care endate if on file
36 .I $G(SPNCEDT)="" S SPNCEDT=$P($G(^SPNL(154.1,SPNX,8)),U,2)
37 S $P(^TMP($J,0),U,2)=SPNCDT S $P(^TMP($J,0),U,3)=$G(SPNCEDT)
38 ; set the 4th piece to the care type
39 S $P(^TMP($J,0),U,4)=SPNCT
Note: See TracBrowser for help on using the repository browser.