source: FOIAVistA/trunk/r/SPINAL_CORD_DYSFUNCTION-SPN/SPNCTOUA.m@ 1352

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

initial load of FOIAVistA 6/30/08 version

File size: 3.5 KB
Line 
1SPNCTOUA ;WDE/SD OUTPATIENT MAIN STARTING POINT ;6/27/02 05:15
2 ;;2.0;Spinal Cord Dysfunction;**19,20**;01/02/1997
3 ;
4 ;
5OUT ;Starting point called from the option
6 ;patient is asked and then spnct is set to 2
7 ; the patient's dfn is passed back in SPNFDFN
8 D ZAP^SPNCTINA ;make sure all is clean before we start
9 D KILL^SPNCTINA
10 D PAT1541^SPNFMENU
11 S SPNNEW=""
12 Q:SPNFEXIT=1
13 Q:$D(SPNFDFN)=""
14RESTART ;
15 S SPNFEXIT=0,SPNEXIT=0
16 I $D(SPNDFN)=0 S SPNDFN=SPNFDFN
17 I $D(SPNDFN)=0 D ZAP^SPNCTINA Q
18 S SPNNEW=""
19 S SPNCT=2 ;outpatient
20 D EN^SPNCTBLD(SPNCT,SPNDFN) ;build utility with in patient
21 D CUR^SPNCTCUR(SPNCT,SPNDFN) ;build tmp with current
22 S SPNHDR="Current OUTPATIENT Episode of Care"
23 D EN^SPNCTSHW(SPNDFN)
24 ;
25 S SPNA=$P($G(^TMP($J,0)),U,2) ;no episodes on file
26 I SPNA=0 D ADD^SPNCTOUB D ZAP Q ;start a new episode of care
27 I SPNSEL="P" S SPNHDR="Previous OUTPATIENT Episode(s) of Care" D EN^SPNCTPAA(SPNCT,SPNDFN) D ZAP Q
28 I SPNSEL="C" D ADD^SPNCTOUB D ZAP Q ;episodes on file but closed
29 I SPNSEL="A" D ADD
30 I SPNEXIT=1 D ZAP Q
31 ;I $G(SPNCLOSE)'="" I SPNCLOSE=1 D CLOSE^SPNCTCLS S SPNXMIT=1 ;close group
32 I SPNEXIT'=1 I $D(SPNFD0) I $D(SPNFTYPE) D EDIT^SPNFEDT0
33 ;
34 D ZAP S SPNFDFN=SPNDFN G RESTART
35 Q
36ZAP ;
37 K ^UTILITY($J),^TMP($J)
38 K SPNA,SPNB,SPNC,SPNRTN,SPNSEL,SPNFTYPE,SPNFD0,SPNIEN,SPNSCOR,DIR,DA,DIE,SPNFEXIT,SPNSET,SPNDATA
39 K SPNCEDT,SPNFIEN,SPNTST
40 K SPNCTYP,SPNW,SPNX,SPNY,SPNZ,SPNCNT,SPNXMIT,SPNFIEN,SPNDATE,DIC,DR,SPNLINE,SPNCNT,SPNOUT,SPNOTNE
41 Q
42ADD ; *** Add a record to the OUTCOMES file (#154.1)
43 I $G(SPNFDFN)="" I +$G(SPNDFN) S SPNFDFN=SPNDFN
44 I SPNFDFN="" D ZAP^SPNOGRDA Q
45 D REPT^SPNFEDT0(SPNFDFN)
46 I $G(SPNFFIM)=0 D ZAP Q
47 D OUT^SPNCTAA ;prompt for the score type for the new outcome
48 I SPNEXIT=1 D ZAP Q
49 ;above is the new order for score type and record type
50 ;D OUT^SPNCTAA ;prompt for the score type for the new outcome
51 ;I SPNEXIT=1 D ZAP Q
52 ;D REPT^SPNFEDT0(SPNFDFN)
53 ;I $G(SPNFFIM)=0 D ZAP Q
54 I SPNFTYPE="" D ZAP Q ;no fim record type selected
55 I SPNEXIT=1 D ZAP Q
56 I '+SPNSCOR D ZAP Q
57 K DIR S DIR("A")="Enter a New Record Date: "
58 D DATES ;Date range set up of dir(0) set above as saftey
59 D ^DIR
60 I '+Y K DIR,Y S SPNFEXIT=1 Q
61 S SPNDATE=Y
62 K DD,DIC,DINUM,DO
63 S SPNFD0=-1
64 S DIC="^SPNL(154.1,",DIC(0)="L"
65 S DLAYGO=154.1,X=SPNFDFN
66 D FILE^DICN W ! S SPNFD0=+Y
67 K DA,DIE,DR
68 I $G(SPNSCOR)="" S SPNSCOR=""
69 S DIE="^SPNL(154.1,",DA=SPNFD0
70 S SPNCDT=$P($G(^TMP($J,0)),U,2)
71 I SPNCDT="" W !,"No care start date is on file for this patient !" D ZAP Q
72 S DR=".02///^S X="_SPNFTYPE_";.04///"_SPNDATE_";.021///"_SPNSCOR_";.023///"_$$EN^SPNMAIN(DUZ)_";1001///"_SPNCDT_";1002///"_$P($G(^TMP($J,0)),U,3)_";1003////2"
73 I SPNSCOR=10 D CHK^SPNCTCLS
74 I SPNEXIT=1 D ZAP Q ;^ OUT OF THE CLOSE QUESTION
75 D ^DIE
76 S SPNNEW="YES"
77 ;
78 Q
79DATES ;set up upper and lower boundaries for the new record
80 ; If there is a care stop date that will be the upper
81 ; If there is a care start date that will be the lower
82 ; Note that TMP is 2nd and 3rd piece is the care start
83 ; and endates
84 ; So if they are adding a outcome to a closed episode
85 ; piece 2 and 3 will be present.
86 S (SPNX,SPNY)="",DIR(0)=""
87 S SPNX=$P($G(^TMP($J,0)),U,2)
88 S SPNY=$P($G(^TMP($J,0)),U,3)
89 I SPNY'="" S DIR(0)="DAO^"_SPNX_":"_SPNY_":EX" Q
90 ;spny = close date
91 I SPNSCOR'=5 I SPNY="" S DIR(0)="DAO^"_SPNX_":"_DT_":EX" Q
92 I SPNSCOR=5 I SPNY="" D
93 .S SPNB=""
94 .S SPNA=0 F S SPNA=$O(^TMP($J,SPNA)) Q:SPNA="" S SPNB="" S SPNB=$O(^TMP($J,SPNA,SPNB)) Q:SPNB=""
95 .I $G(SPNB)'="" S DIR(0)="DAO^"_SPNB_":"_DT_":EX" Q
96 .Q
97 Q
Note: See TracBrowser for help on using the repository browser.