source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCAPMC10.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.6 KB
RevLine 
[613]1SCAPMC10 ;ALB/REW - Team API's: PRPT ; JUN 26, 1995
2 ;;5.3;Scheduling;**41**;AUG 13, 1993
3 ;;1.0
4PRPT(DFN,SCDATES,SCPOSA,SCUSRA,SCROLEA,SCPURPA,SCLIST,SCERR,SCYESCL) ; -- practs for patient (No support for scyescl)
5 ; input:
6 ; DFN = ien of PATIENT <FILE#2> [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 pracitioners who were on
12 ; team for entire date range
13 ; 0: anytime in date range
14 ; [default: 1]
15 ; SCPOSA= array of positions to include reverse with scposa('exclude')
16 ; SCUSRA= array of usr classes included reverse with scusra('exclude')
17 ; SCROLEA= array of usr classes included reverse with scusra('exclude')
18 ;SCPURPA - array of pointers to team purpose file 403.47
19 ; if none definded - retruns all teams
20 ; if @scpurpa@('exclude') is defined - exclude listed teams
21 ; SCERR = array NAME to store error messages.
22 ; [ex. ^TMP("ORXX",$J)]
23 ; SCYESCL=Boolean indicator to include patients' enrollments in
24 ; clinics - [0:strong recommendation/default=NO,1=YES] **NOT SUPPORTED **
25 ;
26 ; Output:
27 ; SCLIST() = array of practitioners
28 ; Format:
29 ; Subscript: Sequential # from 1 to n
30 ; Piece Description
31 ; 1 IEN of NEW PERSON file entry (#200)
32 ; 2 Name of person
33 ; 3 IEN of TEAM POSITION file (#404.57)
34 ; 4 Name of Position
35 ; 5 IEN OF USR CLASS(#8930) of POSITION (#404.57)
36 ; 6 USR Class Name
37 ; 7 IEN of STANDARD POSITION (#403.46)
38 ; 8 Standard Role (Position) Name
39 ; 9 Activation Date for 404.52 (not 404.59!)
40 ; 10 Inactivation Date for 404.52
41 ; 11 IEN of Position Ass History (404.52)
42 ; 12 IEN of Preceptor Position
43 ; 13 Name of Preceptor Position
44 ;
45 ; SCERR() = Array of DIALOG file messages(errors) .
46 ; @SCERR(0)= Number of error(s), UNDEFINED if no errors
47 ; Foramt:
48 ; Subscript: Sequential # from 1 to n
49 ; Piece Description
50 ; 1 IEN of DIALOG file
51 ; Returned: 1 if ok, 0 if error
52 ;
53 ; -- initialize control variables
54 ;
55ST N SCTP,SCPOS0,SCOK,SCTEAMS,INDX,SCPRACTS,SCND,SCU,SCR,SCPOSIT,SCX,SCTP,SC44
56 N SCLSEQ,SCN,SCESEQ,SCPARM,SCP,SCBEGIN,SCEND,SCINCL,SCDTS
57 N SCENROLL,SCPOSIT,PT,ENR
58 G:'$$OKDATA PRPTQ ; check/setup variables
59 ; put list of patient's positions in SCPOSIT()
60 IF '$$TPPT^SCAPMC23(DFN,.SCDATES,.SCPOSA,.SCUSA,.SCPURPA,.SCROLEA,.SCYESCL,"SCPOSIT",.SCERR) G PRPTQ
61 F INDX=1:1:$G(SCPOSIT(0)) S SCX=$G(SCPOSIT(INDX)) D
62 .IF 'SCX D Q
63 ..S SCPARM("Position Xref")=$G(SCX)
64 ..D ERR^SCAPMCU1(.SCESEQ,,SCPARM,"",.SCERR)
65 .S SCTP=$P(SCX,U,1)
66 .S PT("BEGIN")=$S(SCBEGIN>$P(SCX,U,5):SCBEGIN,1:$P(SCX,U,5))
67 .S PT("END")=$S('$P(SCX,U,6):SCEND,(SCEND<$P(SCX,U,6)):SCEND,1:$P(SCX,U,6))
68 .S PT("INCL")=SCINCL
69 .;go thru each pt team position assignment
70 .Q:'$$PRTP^SCAPMC8(SCTP,"PT",.SCLIST,.SCERR)
71PRPTQ Q $G(@SCERR@(0))<1
72 ;
73OKDATA() ;check/setup variables - return 1 if ok; 0 if error
74 N SCOK
75 S SCOK=1
76 D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
77 IF '$D(^DPT(+$G(DFN),0)) D S SCOK=0
78 . S SCPARM("PATIENT")=$G(DFN,"Undefined")
79 . D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
80 S SCPOSA=$G(SCPOSA,"")
81 S SCUSRA=$G(SCUSRA,"")
82 Q SCOK
Note: See TracBrowser for help on using the repository browser.