1 | SPNCMR3 ;HIRMFO/RM,WAA-PATIENT CENSUS CALCULATION ; 10/9/92
|
---|
2 | ;;2.0;Spinal Cord Dysfunction;;01/02/1997
|
---|
3 | EN1 ;FINDS ALL PATIENTS WHO HAVE BEEN ADMITTED WITH IN A DATE RANGE
|
---|
4 | I SPNSEL["3" F SPNDATE=(SPNST-.0000001):0 S SPNDATE=$O(^DGPM("AMV1",SPNDATE)) Q:SPNDATE'>0!(SPNDATE>SPNED) D
|
---|
5 | .F SPNDFN=0:0 S SPNDFN=$O(^DGPM("AMV1",SPNDATE,SPNDFN)) Q:SPNDFN'>0 F SPNMOV=0:0 S SPNMOV=$O(^DGPM("AMV1",SPNDATE,SPNDFN,SPNMOV)) Q:SPNMOV'>0 D
|
---|
6 | ..S WLOC=$P($G(^DGPM(SPNMOV,0)),"^",6),HLOC=+$G(^DIC(42,+WLOC,44)) Q:'HLOC
|
---|
7 | ..S SPNX=HLOC D SETPT
|
---|
8 | ..Q
|
---|
9 | .Q
|
---|
10 | EN2 ;THIS WILL FIND ALL CURRENT PATIENTS
|
---|
11 | I SPNSEL["1" D
|
---|
12 | .S SPNX=0
|
---|
13 | .F S SPNX=$O(^TMP($J,"SPNWC",SPNX)) Q:SPNX<1 D
|
---|
14 | ..S WLOC=$G(^SC(SPNX,42)) Q:+WLOC<1
|
---|
15 | ..S HLOC=$P($G(^DIC(42,+WLOC,0)),U) Q:HLOC=""
|
---|
16 | ..S SPNDFN=0 N SPNDT F S SPNDFN=$O(^DPT("CN",HLOC,SPNDFN)) Q:SPNDFN<1 S SPNDATE="CURRENT" D SETPT
|
---|
17 | ..Q
|
---|
18 | .Q
|
---|
19 | K SPNDATE,SPNX,SPNNUM,HLOC,WLOC,SPNDFN,SPNMOV Q
|
---|
20 | SETPT ;This entry point is to set the patient data in the TMP global.
|
---|
21 | N SPNTMP
|
---|
22 | I '$D(^TMP($J,"SPNWC",SPNX)) Q
|
---|
23 | I $D(^TMP($J,"SPNWC","B",SPNDFN,SPNX)) Q
|
---|
24 | S ^TMP($J,"SPNWC",SPNX,SPNDATE,SPNDFN)=""
|
---|
25 | S ^TMP($J,"SPNWC","B",SPNDFN,SPNX)=""
|
---|
26 | S SPNTMP(1)=$P(^SC(SPNX,0),U,2)
|
---|
27 | S SPNTMP(2)=$P(^SC(SPNX,0),U)
|
---|
28 | S SPNTMP(3)=$S(SPNTMP(1)'="":SPNTMP(1),1:SPNTMP(2))
|
---|
29 | S ^TMP($J,"SPNWC","C",SPNTMP(3),SPNX)=""
|
---|
30 | Q
|
---|