SDECRT2 ;ALB/SAT - VISTA SCHEDULING RPCS ;JAN 15, 2016
;;5.3;Scheduling;**627**;Aug 13, 1993;Build 249
;
Q
;
CRSET(CLN,DATE,DFN,ORDER,SDSTART,SDSTOP) ;EP; process single chart request
; called by CRLOOP and by chart request software
NEW HRCN,TERM,BSDMODE
;
S HRCN=$$HRCN^SDECF2(DFN,+$$FAC^SDECU(CLN)) ;chart #
S TERM=$$HRCNT^SDECF2(HRCN) ;terminal digit format
I $$GET1^DIQ(9009020.2,+$$DIVC^SDECU(CLN),.18)="NO" D
. S TERM=$$HRCND^SDECF2(HRCN) ;use chart # per site param
;
;set chart request as first item for day-makes extra forms print
;too hard to find first cr for patient for day AND hopefully
;chart request not being made if patient already has appt
;
S BSDMODE="CR"
;
I ORDER="" D Q ;make sure all cr for date are printed
. I $D(^TMP("SDRS",$J,$$GET1^DIQ(2,DFN,.01)," "_TERM,DFN,DATE)) D
.. NEW I F I=.01:.01:.99 Q:'$D(^TMP("SDRS",$J,$$GET1^DIQ(2,DFN,.01)," "_TERM,DFN,(DATE+I)))
.. D NMO^SDECRT0(DFN,(DATE_I),CLN,TERM,"",1)
. E D NMO^SDECRT0(DFN,DATE,CLN,TERM,"",1)
;
I ORDER=1,SDSTART]"",SDSTART]$E(TERM,1,2) Q ;before beginning
I ORDER=1,SDSTOP]"",$E(TERM,1,2)]SDSTOP Q ;after end
I ORDER=4,SDSTART]"",SDSTART]$$GET1^DIQ(2,DFN,.01) Q ;before beginning ;IHS/ITSC/LJF 10/25/2004 PATCH 1003
I ORDER=4,SDSTOP]"",$$GET1^DIQ(2,DFN,.01)]SDSTOP Q ;after end of range ;IHS/ITSC/LJF 10/25/2004 PATCH 1003
;
I ORDER=1 D TDO^SDECRT0(DFN,DATE,CLN,TERM,"",1) Q
I ORDER=2 D CLO^SDECRT0(DFN,DATE,CLN,TERM,"",1) Q
I ORDER=3 D PCO^SDECRT0(DFN,DATE,CLN,TERM,"",1) Q
D NMO^SDECRT0(DFN,DATE,CLN,TERM,"",1) Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDECRT2 1620 printed Dec 13, 2024@02:52:39 Page 2
SDECRT2 ;ALB/SAT - VISTA SCHEDULING RPCS ;JAN 15, 2016
+1 ;;5.3;Scheduling;**627**;Aug 13, 1993;Build 249
+2 ;
+3 QUIT
+4 ;
CRSET(CLN,DATE,DFN,ORDER,SDSTART,SDSTOP) ;EP; process single chart request
+1 ; called by CRLOOP and by chart request software
+2 NEW HRCN,TERM,BSDMODE
+3 ;
+4 ;chart #
SET HRCN=$$HRCN^SDECF2(DFN,+$$FAC^SDECU(CLN))
+5 ;terminal digit format
SET TERM=$$HRCNT^SDECF2(HRCN)
+6 IF $$GET1^DIQ(9009020.2,+$$DIVC^SDECU(CLN),.18)="NO"
Begin DoDot:1
+7 ;use chart # per site param
SET TERM=$$HRCND^SDECF2(HRCN)
End DoDot:1
+8 ;
+9 ;set chart request as first item for day-makes extra forms print
+10 ;too hard to find first cr for patient for day AND hopefully
+11 ;chart request not being made if patient already has appt
+12 ;
+13 SET BSDMODE="CR"
+14 ;
+15 ;make sure all cr for date are printed
IF ORDER=""
Begin DoDot:1
+16 IF $DATA(^TMP("SDRS",$JOB,$$GET1^DIQ(2,DFN,.01)," "_TERM,DFN,DATE))
Begin DoDot:2
+17 NEW I
FOR I=.01:.01:.99
if '$DATA(^TMP("SDRS",$JOB,$$GET1^DIQ(2,DFN,.01)," "_TERM,DFN,(DATE+I)))
QUIT
+18 DO NMO^SDECRT0(DFN,(DATE_I),CLN,TERM,"",1)
End DoDot:2
+19 IF '$TEST
DO NMO^SDECRT0(DFN,DATE,CLN,TERM,"",1)
End DoDot:1
QUIT
+20 ;
+21 ;before beginning
IF ORDER=1
IF SDSTART]""
IF SDSTART]$EXTRACT(TERM,1,2)
QUIT
+22 ;after end
IF ORDER=1
IF SDSTOP]""
IF $EXTRACT(TERM,1,2)]SDSTOP
QUIT
+23 ;before beginning ;IHS/ITSC/LJF 10/25/2004 PATCH 1003
IF ORDER=4
IF SDSTART]""
IF SDSTART]$$GET1^DIQ(2,DFN,.01)
QUIT
+24 ;after end of range ;IHS/ITSC/LJF 10/25/2004 PATCH 1003
IF ORDER=4
IF SDSTOP]""
IF $$GET1^DIQ(2,DFN,.01)]SDSTOP
QUIT
+25 ;
+26 IF ORDER=1
DO TDO^SDECRT0(DFN,DATE,CLN,TERM,"",1)
QUIT
+27 IF ORDER=2
DO CLO^SDECRT0(DFN,DATE,CLN,TERM,"",1)
QUIT
+28 IF ORDER=3
DO PCO^SDECRT0(DFN,DATE,CLN,TERM,"",1)
QUIT
+29 DO NMO^SDECRT0(DFN,DATE,CLN,TERM,"",1)
QUIT
+30 QUIT