SDEC52CJSON ;ALB/BLB,TAW,LAB,BWF - VISTA SCHEDULING RPCS ;JUN 06, 2022
;;5.3;Scheduling;**784,785,788,790,799,813,818**;Aug 13, 1993;Build 9
;;Per VHA Directive 6402, this routine should not be modified
;
; Reference to PATIENT in ICR #10035
Q
;
RECGETJSON(SDECY,DFN) ;Return a list of OPEN recall appointment types for patient
;INPUT - DFN (Date File Number) Pointer to PATIENT (#2) File.
;RETURN PARMETER:
;List of recalls associated with a given patient
;Data is delimited by carat (^).
; Field List:
; (1) Internal IEN
; (2) Accession #
; (3) Comment
; (4) Fast/Non-Fasting
; (5) Test/App
; (6) Provider IEN
; (7) Provider Name
; (8) Clinic IEN
; (9) Clinic Name
; (10) Length of Appointment
; (11) Recall Date
; (12) Recall Date (Per Patient)
; (13) Date Reminder Sent
; (14) Second Print
; (15) Date/Time Recall Added
; (16) GAF Score
; (17) Patient Sensitive & Record Access Checks
; (18) Similar Patient Data
; (19) Number of Call Attempts
; (20) Recall Reminders Letter Date
; Number of Email Contacts
; Number of Text Contacts
; Number of Secure Messages
;
N SDRECALL,IEN,NUM,ERR,IENS,SDESJSONERR
S DFN=$G(DFN),SDESJSONERR=0
I DFN="" S SDESJSONERR=1 D ERRLOG^SDESJSON(.SDRECALL,1)
S ERR=0,IEN=0,NUM=0
I DFN'="",'$D(^DPT(DFN,0)) S SDESJSONERR=1 D ERRLOG^SDESJSON(.SDRECALL,2)
I 'SDESJSONERR D
. F S IEN=$O(^SD(403.5,"B",DFN,IEN)) Q:IEN="" D
. . S NUM=NUM+1
. . D RECDATA(IEN)
. . D PATDATA(DFN,IEN)
.I '$D(SDRECALL("Recall")) S SDRECALL("Recall")=""
D BUILDER
Q
RECGETONEJSON(SDECY,IEN) ;Return a single OPEN recall appointment type in JSON format based on the IEN passed
;INPUT - IEN (Internal Entry Number) RECALL REMINDERS File (403.5)
;RETURN PARAMETER: recall based on IEN being passed
;Data is delimited by carat (^).
; Field List:
; (1) Internal IEN
; (2) Accession #
; (3) Comment
; (4) Fast/Non-Fasting
; (5) Test/App
; (6) Provider IEN
; (7) Provider Name
; (8) Clinic IEN
; (9) Clinic Name
; (10) Length of Appointment
; (11) Recall Date
; (12) Recall Date (Per Patient)
; (13) Date Reminder Sent
; (14) Second Print
; (15) Date/Time Recall Added
; (16) GAF Score
; (17) Patient Sensitive & Record Access Checks
; (18) Similar Patient Data
; (19) Number of Call Attempts
; (20) Recall Reminders Letter Date
; Number of Email Contacts
; Number of Text Contacts
; Number of Secure Messages
;
N ERR,NUM,DFN,SDESJSONERR,SDREC,SDRECALL
S SDESJSONERR=0
S IEN=$G(IEN)
I IEN="" S SDESJSONERR=1 D ERRLOG^SDESJSON(.SDRECALL,16)
S ERR=0,NUM=0
I IEN'="",'$D(^SD(403.5,IEN)) S SDESJSONERR=1 D ERRLOG^SDESJSON(.SDRECALL,17) ; send error and quit if patient has no entry in the RECALL REMINDERS File (403.5)
I 'SDESJSONERR D
. S DFN=$$GET1^DIQ(403.5,IEN,.01,"I")
. S NUM=NUM+1
. D RECDATA(IEN) ; build out recall data
. D PATDATA(DFN,IEN) ; build out required patient data
D BUILDER ; build return
Q
;
RECDATA(IEN) ;
N F,DAPTDT,DATE,DATE1,DATE2,DATE3,RECARY
D GETS^DIQ(403.5,IEN,"**","IE","RECARY","SDMSG")
S F=403.5
S IENS=IEN_","
S SDRECALL("Recall",NUM,"RecallIEN")=IEN
S SDRECALL("Recall",NUM,"EASTrackingNumber")=$G(RECARY(F,IENS,100,"E"))
S SDRECALL("Recall",NUM,"Accession")=$G(RECARY(F,IENS,2,"E"))
S SDRECALL("Recall",NUM,"Comment")=$G(RECARY(F,IENS,2.5,"E"))
S SDRECALL("Recall",NUM,"FastingNonFasting")=$G(RECARY(F,IENS,2.6,"I"))
S SDRECALL("Recall",NUM,"TestApp")=$G(RECARY(F,IENS,3,"I"))
S SDRECALL("Recall",NUM,"ProviderIEN")=$G(RECARY(F,IENS,4,"I"))
S SDRECALL("Recall",NUM,"ProviderName")=$$GET1^DIQ(403.54,SDRECALL("Recall",NUM,"ProviderIEN"),.01,"E")
S SDRECALL("Recall",NUM,"ClinicIEN")=$G(RECARY(F,IENS,4.5,"I"))
S SDRECALL("Recall",NUM,"ClinicName")=$G(RECARY(F,IENS,4.5,"E"))
S SDRECALL("Recall",NUM,"AppointmentLength")=$G(RECARY(F,IENS,4.7,"E"))
S SDRECALL("Recall",NUM,"OriginatingUserI")=$G(RECARY(F,IENS,7,"I"))
S SDRECALL("Recall",NUM,"OriginatingUserE")=$G(RECARY(F,IENS,7,"E"))
S DATE=$G(RECARY(F,IENS,5,"I")) S DATE=$$FMTE^XLFDT(DATE)
S DATE1=$G(RECARY(F,IENS,5.5,"I")) S DATE1=$$FMTE^XLFDT(DATE1)
S DAPTDT=$G(RECARY(F,IENS,6,"I")) S DAPTDT=$$FMTE^XLFDT(DAPTDT)
S DATE2=$G(RECARY(F,IENS,8,"I")) S DATE2=$$FMTE^XLFDT(DATE2)
S DATE3=$G(RECARY(403.5,IENS,7.5,"E")) S DATE3=$$FMTE^XLFDT(DATE3)
S SDRECALL("Recall",NUM,"RecallDate")=DATE
S SDRECALL("Recall",NUM,"RecallDatePerPatient")=DATE1
S SDRECALL("Recall",NUM,"DateReminderSent")=DAPTDT
S SDRECALL("Recall",NUM,"SecondPrint")=DATE2
S SDRECALL("Recall",NUM,"DateTimeRecallAdded")=DATE3
Q
;
PATDATA(DFN,IEN) ;
N SDREC
S SDRECALL("Recall",NUM,"GAFScore")=$$GAF^SDECU2(DFN)
S SDRECALL("Recall",NUM,"PatientSensitiveRecordAccessChecks")=$$PTSEC^SDECUTL(DFN)
S SDRECALL("Recall",NUM,"SimilarPatientData")=$$SIM^SDECU3(DFN)
S SDREC=$$RECALL^SDECAR1A(DFN,IEN)
S SDRECALL("Recall",NUM,"NumberOfCallAttempts")=$P(SDREC,U)
S SDRECALL("Recall",NUM,"RecallRemindersLetterDate")=$P(SDREC,U,2)
S SDRECALL("Recall",NUM,"NumberOfEmailContact")=$P(SDREC,U,3)
S SDRECALL("Recall",NUM,"NumberOfTextContact")=$P(SDREC,U,4)
S SDRECALL("Recall",NUM,"NumberOfSecureMessage")=$P(SDREC,U,5)
Q
;
BUILDER ;
D ENCODE^XLFJSON("SDRECALL","SDECY","ERR")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDEC52CJSON 5472 printed Dec 13, 2024@02:50:48 Page 2
SDEC52CJSON ;ALB/BLB,TAW,LAB,BWF - VISTA SCHEDULING RPCS ;JUN 06, 2022
+1 ;;5.3;Scheduling;**784,785,788,790,799,813,818**;Aug 13, 1993;Build 9
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 ; Reference to PATIENT in ICR #10035
+5 QUIT
+6 ;
RECGETJSON(SDECY,DFN) ;Return a list of OPEN recall appointment types for patient
+1 ;INPUT - DFN (Date File Number) Pointer to PATIENT (#2) File.
+2 ;RETURN PARMETER:
+3 ;List of recalls associated with a given patient
+4 ;Data is delimited by carat (^).
+5 ; Field List:
+6 ; (1) Internal IEN
+7 ; (2) Accession #
+8 ; (3) Comment
+9 ; (4) Fast/Non-Fasting
+10 ; (5) Test/App
+11 ; (6) Provider IEN
+12 ; (7) Provider Name
+13 ; (8) Clinic IEN
+14 ; (9) Clinic Name
+15 ; (10) Length of Appointment
+16 ; (11) Recall Date
+17 ; (12) Recall Date (Per Patient)
+18 ; (13) Date Reminder Sent
+19 ; (14) Second Print
+20 ; (15) Date/Time Recall Added
+21 ; (16) GAF Score
+22 ; (17) Patient Sensitive & Record Access Checks
+23 ; (18) Similar Patient Data
+24 ; (19) Number of Call Attempts
+25 ; (20) Recall Reminders Letter Date
+26 ; Number of Email Contacts
+27 ; Number of Text Contacts
+28 ; Number of Secure Messages
+29 ;
+30 NEW SDRECALL,IEN,NUM,ERR,IENS,SDESJSONERR
+31 SET DFN=$GET(DFN)
SET SDESJSONERR=0
+32 IF DFN=""
SET SDESJSONERR=1
DO ERRLOG^SDESJSON(.SDRECALL,1)
+33 SET ERR=0
SET IEN=0
SET NUM=0
+34 IF DFN'=""
IF '$DATA(^DPT(DFN,0))
SET SDESJSONERR=1
DO ERRLOG^SDESJSON(.SDRECALL,2)
+35 IF 'SDESJSONERR
Begin DoDot:1
+36 FOR
SET IEN=$ORDER(^SD(403.5,"B",DFN,IEN))
if IEN=""
QUIT
Begin DoDot:2
+37 SET NUM=NUM+1
+38 DO RECDATA(IEN)
+39 DO PATDATA(DFN,IEN)
End DoDot:2
+40 IF '$DATA(SDRECALL("Recall"))
SET SDRECALL("Recall")=""
End DoDot:1
+41 DO BUILDER
+42 QUIT
RECGETONEJSON(SDECY,IEN) ;Return a single OPEN recall appointment type in JSON format based on the IEN passed
+1 ;INPUT - IEN (Internal Entry Number) RECALL REMINDERS File (403.5)
+2 ;RETURN PARAMETER: recall based on IEN being passed
+3 ;Data is delimited by carat (^).
+4 ; Field List:
+5 ; (1) Internal IEN
+6 ; (2) Accession #
+7 ; (3) Comment
+8 ; (4) Fast/Non-Fasting
+9 ; (5) Test/App
+10 ; (6) Provider IEN
+11 ; (7) Provider Name
+12 ; (8) Clinic IEN
+13 ; (9) Clinic Name
+14 ; (10) Length of Appointment
+15 ; (11) Recall Date
+16 ; (12) Recall Date (Per Patient)
+17 ; (13) Date Reminder Sent
+18 ; (14) Second Print
+19 ; (15) Date/Time Recall Added
+20 ; (16) GAF Score
+21 ; (17) Patient Sensitive & Record Access Checks
+22 ; (18) Similar Patient Data
+23 ; (19) Number of Call Attempts
+24 ; (20) Recall Reminders Letter Date
+25 ; Number of Email Contacts
+26 ; Number of Text Contacts
+27 ; Number of Secure Messages
+28 ;
+29 NEW ERR,NUM,DFN,SDESJSONERR,SDREC,SDRECALL
+30 SET SDESJSONERR=0
+31 SET IEN=$GET(IEN)
+32 IF IEN=""
SET SDESJSONERR=1
DO ERRLOG^SDESJSON(.SDRECALL,16)
+33 SET ERR=0
SET NUM=0
+34 ; send error and quit if patient has no entry in the RECALL REMINDERS File (403.5)
IF IEN'=""
IF '$DATA(^SD(403.5,IEN))
SET SDESJSONERR=1
DO ERRLOG^SDESJSON(.SDRECALL,17)
+35 IF 'SDESJSONERR
Begin DoDot:1
+36 SET DFN=$$GET1^DIQ(403.5,IEN,.01,"I")
+37 SET NUM=NUM+1
+38 ; build out recall data
DO RECDATA(IEN)
+39 ; build out required patient data
DO PATDATA(DFN,IEN)
End DoDot:1
+40 ; build return
DO BUILDER
+41 QUIT
+42 ;
RECDATA(IEN) ;
+1 NEW F,DAPTDT,DATE,DATE1,DATE2,DATE3,RECARY
+2 DO GETS^DIQ(403.5,IEN,"**","IE","RECARY","SDMSG")
+3 SET F=403.5
+4 SET IENS=IEN_","
+5 SET SDRECALL("Recall",NUM,"RecallIEN")=IEN
+6 SET SDRECALL("Recall",NUM,"EASTrackingNumber")=$GET(RECARY(F,IENS,100,"E"))
+7 SET SDRECALL("Recall",NUM,"Accession")=$GET(RECARY(F,IENS,2,"E"))
+8 SET SDRECALL("Recall",NUM,"Comment")=$GET(RECARY(F,IENS,2.5,"E"))
+9 SET SDRECALL("Recall",NUM,"FastingNonFasting")=$GET(RECARY(F,IENS,2.6,"I"))
+10 SET SDRECALL("Recall",NUM,"TestApp")=$GET(RECARY(F,IENS,3,"I"))
+11 SET SDRECALL("Recall",NUM,"ProviderIEN")=$GET(RECARY(F,IENS,4,"I"))
+12 SET SDRECALL("Recall",NUM,"ProviderName")=$$GET1^DIQ(403.54,SDRECALL("Recall",NUM,"ProviderIEN"),.01,"E")
+13 SET SDRECALL("Recall",NUM,"ClinicIEN")=$GET(RECARY(F,IENS,4.5,"I"))
+14 SET SDRECALL("Recall",NUM,"ClinicName")=$GET(RECARY(F,IENS,4.5,"E"))
+15 SET SDRECALL("Recall",NUM,"AppointmentLength")=$GET(RECARY(F,IENS,4.7,"E"))
+16 SET SDRECALL("Recall",NUM,"OriginatingUserI")=$GET(RECARY(F,IENS,7,"I"))
+17 SET SDRECALL("Recall",NUM,"OriginatingUserE")=$GET(RECARY(F,IENS,7,"E"))
+18 SET DATE=$GET(RECARY(F,IENS,5,"I"))
SET DATE=$$FMTE^XLFDT(DATE)
+19 SET DATE1=$GET(RECARY(F,IENS,5.5,"I"))
SET DATE1=$$FMTE^XLFDT(DATE1)
+20 SET DAPTDT=$GET(RECARY(F,IENS,6,"I"))
SET DAPTDT=$$FMTE^XLFDT(DAPTDT)
+21 SET DATE2=$GET(RECARY(F,IENS,8,"I"))
SET DATE2=$$FMTE^XLFDT(DATE2)
+22 SET DATE3=$GET(RECARY(403.5,IENS,7.5,"E"))
SET DATE3=$$FMTE^XLFDT(DATE3)
+23 SET SDRECALL("Recall",NUM,"RecallDate")=DATE
+24 SET SDRECALL("Recall",NUM,"RecallDatePerPatient")=DATE1
+25 SET SDRECALL("Recall",NUM,"DateReminderSent")=DAPTDT
+26 SET SDRECALL("Recall",NUM,"SecondPrint")=DATE2
+27 SET SDRECALL("Recall",NUM,"DateTimeRecallAdded")=DATE3
+28 QUIT
+29 ;
PATDATA(DFN,IEN) ;
+1 NEW SDREC
+2 SET SDRECALL("Recall",NUM,"GAFScore")=$$GAF^SDECU2(DFN)
+3 SET SDRECALL("Recall",NUM,"PatientSensitiveRecordAccessChecks")=$$PTSEC^SDECUTL(DFN)
+4 SET SDRECALL("Recall",NUM,"SimilarPatientData")=$$SIM^SDECU3(DFN)
+5 SET SDREC=$$RECALL^SDECAR1A(DFN,IEN)
+6 SET SDRECALL("Recall",NUM,"NumberOfCallAttempts")=$PIECE(SDREC,U)
+7 SET SDRECALL("Recall",NUM,"RecallRemindersLetterDate")=$PIECE(SDREC,U,2)
+8 SET SDRECALL("Recall",NUM,"NumberOfEmailContact")=$PIECE(SDREC,U,3)
+9 SET SDRECALL("Recall",NUM,"NumberOfTextContact")=$PIECE(SDREC,U,4)
+10 SET SDRECALL("Recall",NUM,"NumberOfSecureMessage")=$PIECE(SDREC,U,5)
+11 QUIT
+12 ;
BUILDER ;
+1 DO ENCODE^XLFJSON("SDRECALL","SDECY","ERR")
+2 QUIT