source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SCMCDD1.m@ 1314

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

initial load of FOIAVistA 6/30/08 version

File size: 4.7 KB
Line 
1SCMCDD1 ;ALB/REW - DD Calls used by PCMM ; 6 November 1995
2 ;;5.3;Scheduling;**41,89,107**;AUG 13, 1993
3 ;1
4WRITETP(SCTP) ;used by write node of 404.57
5 N SCCL
6 S SCCL=$P($G(^SCTM(404.57,+$G(SCTP),0)),U,9)
7 Q $P($$GETPRTP^SCAPMCU2(SCTP,DT),U,2)_" "_$P($G(^SC(+$G(SCCL),0)),U,1)
8 ;
9SETPTTM(SCPTTMA) ;delete
10 Q
11 ;
12KILLPTTM(SCPTTMA) ;delete
13 Q
14 ;
15AFTERTM(SCPTTM) ;called after update of 404.42
16 N SCPTTMB4,SCPCTMB4,SCTMB4,SCTMNDB4,SCPTTMAF,SCPCTMAF,SCTMAF,X,SCFLD,SCX,SCTMNDAF,SCTMNMB4,Y
17 Q:'$G(SCPTTM)
18 S SCPTTMAF=$G(^SCPT(404.42,SCPTTM,0))
19 S SCPCTMAF=$S(($P(SCPTTMAF,U,8)=1):1,1:0)
20 S SCTMAF=$P(SCPTTMAF,U,3)
21 S:SCTMAF SCTMNDAF=$G(^SCTM(404.51,SCTMAF,0))
22 F X="SCPTTMB4","SCPCTMB4","SCTMB4","SCTMNMB4" S @X=$G(^TMP($J,"SCTMCHG",SCPTTM,X))
23 F SCFLD=1:1:14 S SCX=$P(SCPTTMAF,U,SCFLD) S:SCX'="" ^TMP($J,"SCTMCHG",SCPTTM,"AF",(SCFLD*.01))=SCX
24 S X=+$O(^ORD(101,"B","SCMC PATIENT TEAM CHANGES",0))_";ORD(101,"
25 D:SCPTTMAF'=SCPTTMB4 EN^XQOR
26 K ^TMP($J,"SCTMCHG",SCPTTM)
27 Q
28 ;
29BEFORETM(SCPTTM) ;called before update of 404.42
30 N SCPTTMB4,SCPCTMB4,SCTMB4,SCTMNDB4,X,SCFLD,SCX,SCY,DR,DIC,DA,DIQ
31 Q:'$G(SCPTTM)
32 S SCPTTMB4=$G(^SCPT(404.42,SCPTTM,0))
33 S SCPCTMB4=$S(($P(SCPTTMB4,U,8)=1):1,1:0)
34 S SCTMB4=$P(SCPTTMB4,U,3)
35 S:SCTMB4 SCTMNDB4=$G(^SCTM(404.51,SCTMB4,0))
36 F X="SCPTTMB4","SCPCTMB4","SCTMB4","SCTMNDB4" S ^TMP($J,"SCTMCHG",SCPTTM,X)=$G(@X)
37 F SCY=1:1:14 S SCX=$P(SCPTTMB4,U,SCY) IF SCX'="" D
38 .S SCFLD=SCY*.01
39 .S ^TMP($J,"SCTMCHG",SCPTTM,"B4",SCFLD)=SCX
40 Q
41 ;
42SETPC(SC1,SC2,SC3,SC4,DA) ;APCPOS xref for 404.43
43 ;DFN = Pointer to Patient File
44 ;SC1 = pointer to 404.42
45 ;SC2 = ROLE (1=pc practitioner,2=pc attending)
46 ;SC3 = Activation Date
47 ;SC4 = Team Position
48 N DFN
49 S DFN=$P($G(^SCPT(404.42,SC1,0)),U,1)
50 S:DFN&SC1&SC2&SC3&SC4&DA ^SCPT(404.43,"APCPOS",DFN,SC2,SC3,SC4,DA)=""
51 Q
52KILLPC(SC1,SC2,SC3,SC4,DA) ;APCPOS xref for 404.43
53 ;DFN = Pointer to Patient File
54 ;SC1 = pointer to 404.42
55 ;SC2 = ROLE (1=pc practitioner,2=pc attending)
56 ;SC3 = Activation Date
57 ;SC4 = Team Position
58 N DFN
59 S DFN=$P($G(^SCPT(404.42,SC1,0)),U,1)
60 K:DFN&SC1&SC2&SC3&SC4&DA ^SCPT(404.43,"APCPOS",DFN,SC2,SC3,SC4,DA)
61 Q
62 ;
63MAKEMANY(DFNA,SCOLDASS,SCBADASS,SCNEWASS) ;Not supported for use by PCMM Only - sets PC field to YES
64 ; DFNA - DFN ARRAY
65 ; SCOLDASS - Subset of DFNA that were previously assigned
66 ; SCBADASS - Subset of DFNA that could not be assigned
67 ; SCNEWASS - Subset of DFNA that were newly assigned
68 ; Returned: total^new^old^bad
69 ; Note: No input error checking!!
70 N DFN,SCX,SCOUTFLD,SCBADOUT,SCOLDCNT,SCBADCNT,SCNEWCNT
71 S (SCBADCNT,SCOLDCNT,SCNEWCNT)=0
72 S DFN=0
73 F S DFN=$O(@DFNA@(DFN)) Q:'DFN D
74 .S SCOUTFLD(.04)=1
75 .S SCX=$$ACOUTPT^SCAPMC20(DFN,"SCOUTFLD","SCBADOUT")
76 .;SCX=OK?^p404.41^new?
77 .IF 'SCX D
78 ..S SCBADCNT=SCBADCNT+1
79 ..S @SCBADASS@(DFN)=""
80 .ELSE D
81 ..IF $P(SCX,U,3) D
82 ...S SCNEWCNT=SCNEWCNT+1
83 ...S @SCNEWASS@(DFN)=""
84 ..ELSE D
85 ...S SCOLDCNT=SCOLDCNT+1
86 ...S @SCOLDASS@(DFN)=""
87 Q (SCOLDCNT+SCNEWCNT)_U_SCNEWCNT_U_SCOLDCNT_U_SCBADCNT
88 ;
89MAKEOUT(DA) ;used by 404.42 to create an outpatient profile entry (if there wasn't one) and set the PRIMARY CARE?(.04) field to YES
90 ; Returned (for de-bugging): ok?^ien of404.41^new?
91 N SCNODE,SCX,DFN,SCOUTFLD
92 S SCNODE=$G(^SCPT(404.42,+$G(DA),0))
93 S DFN=$P(SCNODE,U,1)
94 IF $P(SCNODE,U,8)=1 D ;if assignment was to primary care
95 .S SCOUTFLD(.04)=1
96 .S SCX=$$ACOUTPT^SCAPMC20(DFN,"SCOUTFLD","SCBADOUT")
97 Q $G(SCX)
98 ;
99AFTERTP(SCPTTP) ;called after update of 404.43
100 N SCPTTPB4,SCPCTPB4,SCTPB4,SCTPNDB4,SCPTTPAF,SCPCTPAF,SCTPAF,X,SCFLD,SCX,SCTMB4,SCTMNDB4,SCTMNDAF,SCTMAF,SCPTNM,SCTPNDAF,SCTPNMB4,Y
101 Q:'$G(SCPTTP)
102 S SCPTTPAF=$G(^SCPT(404.43,SCPTTP,0))
103 S SCPCTPAF=+$P(SCPTTPAF,U,5)
104 S SCTPAF=$P(SCPTTPAF,U,2)
105 S:SCTPAF SCTPNDAF=$G(^SCTM(404.57,SCTPAF,0))
106 S:SCTPAF SCTMAF=$P(SCTPNDAF,U,2)
107 S:SCTMAF SCTMNDAF=$G(^SCTM(404.51,SCTMAF,0))
108 F X="SCPTTPB4","SCPCTPB4","SCTPB4","SCTPNMB4","SCTMB4","SCTMNDB4" S @X=$G(^TMP($J,"SCTPCHG",SCPTTP,X))
109 F SCFLD=1:1:9 S SCX=$P(SCPTTPAF,U,SCFLD) S:SCX'="" ^TMP($J,"SCTPCHG",SCPTTP,"AF",(SCFLD*.01))=SCX
110 S X=+$O(^ORD(101,"B","SCMC PATIENT TEAM POSITION CHANGES",0))_";ORD(101,"
111 D:SCPTTPAF'=SCPTTPB4 EN^XQOR
112 K ^TMP($J,"SCTPCHG",SCPTTP)
113 Q
114 ;
115BEFORETP(SCPTTP) ;called before update of 404.43
116 N SCPTTPB4,SCPCTPB4,SCTPB4,SCTPNDB4,X,SCFLD,SCX,SCY,DR,DIC,DA,DIQ,SCTMB4,SCTMNDAF,SCTMNDB4,SCTMNMB4
117 Q:'$G(SCPTTP)
118 S SCPTTPB4=$G(^SCPT(404.43,SCPTTP,0))
119 Q:'SCPTTPB4
120 S SCPCTPB4=+$P(SCPTTPB4,U,5)
121 S SCTPB4=$P(SCPTTPB4,U,2)
122 S:SCTPB4 SCTPNDB4=$G(^SCTM(404.57,SCTPB4,0))
123 S:SCTPB4 SCTMB4=$P(SCTPNDB4,U,2)
124 S:SCTMB4 SCTMNDB4=$G(^SCTM(404.51,SCTMB4,0))
125 F X="SCPTTPB4","SCPCTPB4","SCTPB4","SCTPNDB4","SCTMNDB4","SCTMB4" S ^TMP($J,"SCTPCHG",SCPTTP,X)=$G(@X)
126 F SCY=1:1:9 S SCX=$P(SCPTTPB4,U,SCY) IF SCX'="" D
127 .S SCFLD=SCY*.01
128 .S ^TMP($J,"SCTPCHG",SCPTTP,"B4",SCFLD)=SCX
129 Q
Note: See TracBrowser for help on using the repository browser.