SDESPATCOMMTS ;ALB/ANU - VISTA SCHEDULING RPC SDES GET PATIENT COMMENTS ;JUN 08, 2023
;;5.3;Scheduling;**846**;Aug 13, 1993;Build 12
;;Per VHA Directive 6402, this routine should not be modified
;
;External References
;-------------------
; Reference to $$GETS^DIQ,$$GETS1^DIQ in ICR #2056
;
Q
;
PATCMTGET(JSONRETURN,APPTIEN,EAS) ;return entries from the SDEC APPOINTMENT FILE(409.84)
;INPUT:
; APPT IEN
;RETURN:
; List of Patient Comments
;
N ISIENVALID,ISEASVALID,RETURN,ERRORS,HASFIELDS,RETURN,ELGFIELDSARRARY
;
S ISIENVALID=$$VALIDATEIEN(.ERRORS,$G(APPTIEN))
S ISEASVALID=$$VALIDATEEAS(.ERRORS,$G(EAS))
I $D(ERRORS) M RETURN=ERRORS D BUILDJSON^SDESBUILDJSON(.JSONRETURN,.RETURN) Q
;
I '$D(ERRORS) S HASFIELDS=$$PATCMT(.ELGFIELDSARRAY,$G(APPTIEN))
I HASFIELDS M RETURN=ELGFIELDSARRAY
;
D BUILDJSON^SDESBUILDJSON(.JSONRETURN,.RETURN)
D CLEANUP
Q
;
VALIDATEIEN(ERRORS,IEN) ;
I '$G(IEN) D ERRLOG^SDESJSON(.ERRORS,14) Q 0
I '$D(^SDEC(409.84,IEN,0)) D ERRLOG^SDESJSON(.ERRORS,15) Q 0
Q 1
;
VALIDATEEAS(ERRORS,EAS) ;
I $L(EAS) S EAS=$$EASVALIDATE^SDESUTIL($G(EAS))
I $P($G(EAS),U)=-1 D ERRLOG^SDESJSON(.ERRORS,142) Q 0
Q 1
;
PATCMT(ELGARRAY,IEN) ; return entries from the SDEC CANCELLATION COMMENT file (#409.88)
;
N HASDATA
; patient comments
D GETPATCOMMENTS^SDESAPPTDATA(.ELGARRAY,IEN)
S ELGARRAY=""
S HASDATA=($D(ELGARRAY)>1)
Q HASDATA
;
CLEANUP ;
K ISTYPEVALID,ERRORS
K RETURN,HASFIELDS,ELGFIELDSARRAY,ELGRETURN
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESPATCOMMTS 1520 printed Dec 13, 2024@02:57:27 Page 2
SDESPATCOMMTS ;ALB/ANU - VISTA SCHEDULING RPC SDES GET PATIENT COMMENTS ;JUN 08, 2023
+1 ;;5.3;Scheduling;**846**;Aug 13, 1993;Build 12
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 ;External References
+5 ;-------------------
+6 ; Reference to $$GETS^DIQ,$$GETS1^DIQ in ICR #2056
+7 ;
+8 QUIT
+9 ;
PATCMTGET(JSONRETURN,APPTIEN,EAS) ;return entries from the SDEC APPOINTMENT FILE(409.84)
+1 ;INPUT:
+2 ; APPT IEN
+3 ;RETURN:
+4 ; List of Patient Comments
+5 ;
+6 NEW ISIENVALID,ISEASVALID,RETURN,ERRORS,HASFIELDS,RETURN,ELGFIELDSARRARY
+7 ;
+8 SET ISIENVALID=$$VALIDATEIEN(.ERRORS,$GET(APPTIEN))
+9 SET ISEASVALID=$$VALIDATEEAS(.ERRORS,$GET(EAS))
+10 IF $DATA(ERRORS)
MERGE RETURN=ERRORS
DO BUILDJSON^SDESBUILDJSON(.JSONRETURN,.RETURN)
QUIT
+11 ;
+12 IF '$DATA(ERRORS)
SET HASFIELDS=$$PATCMT(.ELGFIELDSARRAY,$GET(APPTIEN))
+13 IF HASFIELDS
MERGE RETURN=ELGFIELDSARRAY
+14 ;
+15 DO BUILDJSON^SDESBUILDJSON(.JSONRETURN,.RETURN)
+16 DO CLEANUP
+17 QUIT
+18 ;
VALIDATEIEN(ERRORS,IEN) ;
+1 IF '$GET(IEN)
DO ERRLOG^SDESJSON(.ERRORS,14)
QUIT 0
+2 IF '$DATA(^SDEC(409.84,IEN,0))
DO ERRLOG^SDESJSON(.ERRORS,15)
QUIT 0
+3 QUIT 1
+4 ;
VALIDATEEAS(ERRORS,EAS) ;
+1 IF $LENGTH(EAS)
SET EAS=$$EASVALIDATE^SDESUTIL($GET(EAS))
+2 IF $PIECE($GET(EAS),U)=-1
DO ERRLOG^SDESJSON(.ERRORS,142)
QUIT 0
+3 QUIT 1
+4 ;
PATCMT(ELGARRAY,IEN) ; return entries from the SDEC CANCELLATION COMMENT file (#409.88)
+1 ;
+2 NEW HASDATA
+3 ; patient comments
+4 DO GETPATCOMMENTS^SDESAPPTDATA(.ELGARRAY,IEN)
+5 SET ELGARRAY=""
+6 SET HASDATA=($DATA(ELGARRAY)>1)
+7 QUIT HASDATA
+8 ;
CLEANUP ;
+1 KILL ISTYPEVALID,ERRORS
+2 KILL RETURN,HASFIELDS,ELGFIELDSARRAY,ELGRETURN
+3 QUIT
+4 ;