source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SCAPMC11.m@ 1608

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

initial load of FOIAVistA 6/30/08 version

File size: 3.3 KB
Line 
1SCAPMC11 ;ALB/REW - Team API's: PTTP ; JUN 30, 1995
2 ;;5.3;Scheduling;**41**;AUG 13, 1993
3 ;;1.0
4PTTP(SCTP,SCDATES,SCLIST,SCERR) ; -- list of patient team position assignments
5 ; input:
6 ; SCTP = ien of TEAM POSITION [required]
7 ; SCDATES("BEGIN") = begin date to search (inclusive)
8 ; [default: TODAY]
9 ; ("END") = end date to search (inclusive)
10 ; [default: TODAY]
11 ; ("INCL") = 1: only use patients who were assigned to
12 ; position for entire date range
13 ; 0: anytime in date range
14 ; [default: 1]
15 ; SCLIST -array name to store list
16 ; [ex. ^TMP("SCPT",$J)]
17 ;
18 ; SCERR = array NAME to store error messages.
19 ; [ex. ^TMP("ORXX",$J)]
20 ;
21 ; Output:
22 ; SCLIST() = array of patients
23 ; Format:
24 ; Subscript: Sequential # from 1 to n
25 ; Piece Description
26 ; 1 IEN of PATIENT file entry
27 ; 2 Name of patient
28 ; 3 IEN of Patient Team Position Assignment
29 ; 4 Activation Date
30 ; 5 Inactivation Date
31 ; 6 Patient's Long ID - (SSN)
32 ;
33 ; SCERR() = Array of DIALOG file messages(errors) .
34 ; @SCERR@(0)=number of errors, undefined if none
35 ; Foramt:
36 ; Subscript: Sequential # from 1 to n
37 ; Piece Description
38 ; 1 IEN of DIALOG file
39 ;
40 ; Returned: 1 if ok, 0 if error
41 ;
42 ;
43ST N SCTPA,SCPTA,SCPTA0,SCPTMA,SCPTPA,SCPTPA0
44 N SCLSEQ,SCN,SCESEQ,SCPARM,SCP,SCBEGIN,SCEND,SCINCL,SCDTS
45 G:'$$OKDATA PRACQ ;check/setup variables
46 ; -- loop through patient team position assignments
47LP S SCPTMA=0
48 F S SCPTMA=$O(^SCPT(404.43,"APTPA",SCTP,SCPTMA)) Q:'SCPTMA D
49 .S SCPTPA=0
50 .F S SCPTPA=$O(^SCPT(404.43,"APTPA",SCTP,SCPTMA,SCPTPA)) Q:'SCPTPA D
51 ..S SCPTPA0=$G(^SCPT(404.43,SCPTPA,0))
52 ..Q:'SCPTPA0
53 ..Q:'$$DTCHK^SCAPU1(SCBEGIN,SCEND,SCINCL,$P(SCPTPA0,U,3),$P(SCPTPA0,U,4))
54 ..D BLD(.SCLIST,SCPTPA,SCPTPA0)
55PRACQ Q $G(@SCERR@(0))<1
56 ;
57 ;
58BLD(SCLIST,SCPTTPA,SCPTTPA0) ; build list
59 ; SCPTTPA - ien of patient team position assignment file #404.43
60 ; SCEFFDT - negative of effective date
61 ; SCN - current subscript (counter) 1->n
62 ; SCPTTPA0 - IS 0 node of Pt Team Pos Assnt(404.43) 1st piece:pt tm ass
63 ;
64 ; this builds the array:
65 ; sclist(1->n)=sc2^ptname^effdt^inactdt
66 ; for each scpta zero node passed to it
67 Q:'SCPTTPA!('SCPTTPA0) ;add error trapping?
68 Q:$D(@SCLIST@("SCPTTPA",+SCPTTPA0,SCPTTPA))
69 N SCEFFDT,SCCNT,DFN
70 S DFN=+$G(^SCPT(404.42,+SCPTTPA0,0))
71 Q:$D(^TMP("SCMC",$J,"EXCLUDE PT","SCPTA",+DFN))
72 S SCN=$G(@SCLIST@(0),0)+1
73 S @SCLIST@(0)=SCN
74 S @SCLIST@(SCN)=DFN_U_$P($G(^DPT(DFN,0)),U,1)_U_SCPTTPA_U_$P(SCPTTPA0,U,3)_U_$P(SCPTTPA0,U,4)_U_$P($G(^DPT(DFN,.36)),U,3)
75 S @SCLIST@("SCPTTPA",+SCPTTPA0,SCPTTPA,SCN)=""
76 S @SCLIST@("SCPTA",DFN,SCN)=""
77 Q
78OKDATA() ;check/setup variables
79 N SCOK
80 S SCOK=1
81 D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
82 IF '$D(^SCTM(404.57,+$G(SCTP),0)) D S SCOK=0
83 . S SCPARM("POSITION")=$G(SCTP,"Undefined")
84 . D ERR^SCAPMCU1(.SCESEQ,4045701,.SCPARM,"",.SCERR)
85 ; -- is it a valid TEAM ien passed (Error # 4045701 in DIALOG file)
86 IF '$D(^SCTM(404.57,+SCTP,0)) D S SCOK=0
87 . S SCPARM("TEAM")=SCTP
88 . D ERR^SCAPMCU1(SCESEQ,4045701,.SCPARM,"",.SCERR)
89 Q SCOK
Note: See TracBrowser for help on using the repository browser.