source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCAPMC27.m@ 1361

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

initial load of WorldVistAEHR

File size: 3.2 KB
RevLine 
[613]1SCAPMC27 ;ALB/REW - PTST Patients with a Stop Code ; JUN 30, 1995
2 ;;5.3;Scheduling;**41,140**;AUG 13, 1993
3 ;;1.0
4PTST(SCST,SCDATES,SCMAXCNT,SCLIST,SCERR,MORE) ; -- list of patients with a IEN of 40.7
5 ; USE $$PTSTEXT(below) if you have stop code (e.g. 301)
6 ; input:
7 ; SCST = stop code
8 ; SCDATES("BEGIN") = begin date to search (inclusive)
9 ; [default: TODAY]
10 ; ("END") = end date to search (inclusive)
11 ; [default: TODAY]
12 ; ("INCL") = 1: only use patients who were assigned to
13 ; team for entire date range
14 ; 0: anytime in date range
15 ; [default: 1]
16 ; SCMAXCNT = Maximum Number to Return - Default=99
17 ; SCLIST -array name to store list
18 ; [ex. ^TMP("SCPT",$J)]
19 ;
20 ; SCERR = array NAME to store error messages.
21 ; [ex. ^TMP("ORXX",$J)]
22 ; MORE - For continuing lists (see scapmc28)
23 ;Note: Don't Return DFNs where $D(^TMP("SCMC",$J,"EXCLUDE PT","SCPTA",+DFN)) is true
24 ; Output:
25 ; SCLIST() = array of patients
26 ; Format:
27 ; Subscript: Sequential # from 1 to n
28 ; Piece Description
29 ; 1 IEN of PATIENT file entry
30 ; 2 Name of patient
31 ; 3 ien to 40.7 - Not Stop Code!! stp=$$intstp
32 ; 4 AMIS reporting stop code
33 ;
34 ; SCEFFDT - negative of effective date
35 ; SCN - current subscript (counter) 1->n
36 ; SCPTA0 is 0 node of Patient Team Assignment file 1st piece is DFN
37 ; SCERR() = Array of DIALOG file messages(errors) .
38 ; @SCERR@(0)=number of errors, undefined if none
39 ; Foramt:
40 ; Subscript: Sequential # from 1 to n
41 ; Piece Description
42 ; 1 IEN of DIALOG file
43 ;
44 ; Returned: 1 if ok, 0 if error^More?
45 ;
46 ;
47ST N SCDT,SCEND,SCCL,SCNODE,SCX
48 N SCLSEQ,SCN,SCESEQ,SCPARM,SCP,SCBEGIN,SCEND,SCINCL,SCDTS
49 S SCX=0
50 G:'$$OKDATA STQ ;check/setup variables
51 ; -- loop file#44
52LP S SCDT=SCBEGIN
53 S:'$P(SCEND,".",2) SCEND=$$FMADD^XLFDT(SCEND,1) ;ending is end of day
54 IF $G(MORE) D
55 .S SCSTART=+$P($G(@SCLIST@(0)),U,2)
56 .S SCBEGIN=+$P($G(@SCLIST@(0)),U,3)
57 .S SCCL=+$P($G(@SCLIST@(0)),U,4)
58 .K @SCLIST
59 ELSE D
60 .S SCSTART=0
61 .S SCCL=0
62 ; go thru clinics with stop code=SCST
63 F S:'$G(MORE) SCCL=$O(^SC(SCCL)) Q:'SCCL S:$P($G(^SC(SCCL,0)),U,7)=SCST SCX=$$PTAPX^SCAPMC28(.SCCL,.SCBEGIN,.SCEND,.SCMAXCNT,.SCLIST,.SCERR,.SCSTART) S MORE=0
64STQ Q SCX
65 ;
66OKDATA() ;check/setup variables
67 N SCOK
68 S SCOK=1
69 S SCMAXCNT=$G(SCMAXCNT,99)
70 D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
71 IF '$D(^DIC(40.7,+$G(SCST),0)) D S SCOK=0
72 . S SCPARM("STOP")=$G(SCST,"Undefined")
73 . D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
74 ; -- is it a valid TEAM ien passed (Error # 4045101 in DIALOG file)
75 Q SCOK
76 ;
77INTST(STOP) ;given stop code return ient
78 Q +$O(^DIC(40.7,"C",+$G(STOP),0))
79 ;
80PTSTEXT(SCSTOP,SCDATES,SCMAXCNT,SCLIST,SCERR) ; -- list of patients with AMIS REPORTING STOP CODE
81 ; For variables see: PTST (above)
82 ; Returned: 1 if ok, 0 if error^More?
83 N SCST
84 S SCST=$$INTST(.SCSTOP)
85 Q $$PTST(.SCST,.SCDATES,.SCMAXCNT,.SCLIST,.SCERR,.MORE)
Note: See TracBrowser for help on using the repository browser.