source: WorldVistAEHR/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNCTBLD.m@ 619

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

initial load of WorldVistAEHR

File size: 1.9 KB
Line 
1SPNCTBLD ;WDE/SD BUILD UTILITY WITH CARE TYPE/S ;6/27/02 05:15
2 ;;2.0;Spinal Cord Dysfunction;**19**;01/02/1997
3 ;
4 ;
5 ; Build utility with care type in patient /out patient /annl /cont
6 ; passing 10 into this routine means that they want to see all
7 ; care types on file for the patient
8 ;
9EN(SPNCTYP,SPNDFN) ;
10 K ^UTILITY($J),^TMP($J)
11 S SPNIEN=0 F S SPNIEN=$O(^SPNL(154.1,"B",SPNDFN,SPNIEN)) Q:(SPNIEN="")!('+SPNIEN) D
12 .S SPNDATA=$G(^SPNL(154.1,SPNIEN,8))
13 .Q:SPNDATA=""
14 .S SPNSET=0
15 .I $P(SPNDATA,U,3)="" Q ;no record type on file old record
16 .I SPNCTYP=10 S SPNSET=1
17 .I SPNCTYP'=10 I $P($G(SPNDATA),U,3)=SPNCTYP S SPNSET=1
18 .Q:SPNSET=0
19 .S (SPNW,SPNX,SPNY)=""
20 .S SPNW=$P($G(SPNDATA),U,1) Q:SPNW="" ;care start date
21 .;S SPNX=$P($G(^SPNL(154.1,SPNIEN,0)),U,2) Q:SPNX="" ;outcome type
22 .S SPNY=$P($G(^SPNL(154.1,SPNIEN,0)),U,4) Q:SPNY="" ;date recorded
23 .S SPNZ=$P($G(SPNDATA),U,3) ;care type
24 .;S ^UTILITY($J,SPNZ,SPNW,SPNX,SPNY,SPNIEN)=SPNDATA
25 .S ^UTILITY($J,SPNZ,SPNW,SPNY,SPNIEN)=SPNDATA
26 .Q
27 Q
28OTHER(SPNCTYP,SPNDFN) ;
29 ; This tag is used to build the Annuals and Continuum of
30 ; care care types. These don't have a care start/end date.
31 ; They will be build right into tmp($j
32 K ^TMP($J),^UTILITY($J)
33 S (SPNX,SPNY,SPNCNT,SPNEXIT)=0
34 S SPNIEN=0 F S SPNIEN=$O(^SPNL(154.1,"B",SPNDFN,SPNIEN)) Q:(SPNIEN="")!('+SPNIEN) D
35 .S SPNDATA=$G(^SPNL(154.1,SPNIEN,8))
36 .Q:SPNDATA=""
37 .S SPNSET=0
38 .I $P(SPNDATA,U,3)="" ;no care type
39 .I $P(SPNDATA,U,3)=SPNCTYP S SPNSET=1
40 .Q:SPNSET=0
41 .S SPNY=$P($G(^SPNL(154.1,SPNIEN,0)),U,4) Q:SPNY="" ;date recorded
42 .S ^UTILITY($J,SPNY,SPNIEN)=SPNIEN
43 S SPNCNT=0
44 S SPNY=0 F S SPNY=$O(^UTILITY($J,SPNY)) Q:SPNY="" S SPNIEN=0 F S SPNIEN=$O(^UTILITY($J,SPNY,SPNIEN)) Q:SPNIEN="" D
45 .S SPNCNT=SPNCNT+1
46 .S ^TMP($J,SPNCNT,SPNY,SPNIEN)=SPNIEN
47 .S $P(^TMP($J,0),U,1)=SPNCNT
48 ; set the 4th piece to the care type
49 S $P(^TMP($J,0),U,4)=SPNCTYP
50 Q
Note: See TracBrowser for help on using the repository browser.