Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SDESGETREGA2

SDESGETREGA2.m

Go to the documentation of this file.
SDESGETREGA2 ;ALB/ANU - SDES GET PATREG BY DFNICN ;JULY 15,2023
 ;;5.3;Scheduling;**853**;Aug 13, 1993;Build 9
 ;;Per VHA Directive 6402, this routine should not be modified
 ;
 ; Documented API's and Integration Agreements
 ; -------------------------------------------
 ; Reference to PATIENT in ICR #7030
 ; Reference to PATIENT in ICR #7029
 ; Reference to PATIENT in ICR #1476
 ; Reference to PATIENT in ICR #10035
 ; Reference to SCHEDULED ADMISSION in ICR #4425
 ;
 ; Cloned from SDESGETREGA for new version
 ;
 ; The SDCONTEXT array is controlled by the Acheron application and its fields are
 ; needed for the storage of the required auditing information.
 ;
 ; SDCONTEXT("ACHERON ID")
 ; SDCONTEXT("USER DUZ")
 ; SDCONTEXT("USER NAME")
 Q
 ;
 ;
 ; RPC: SDES GET PATREG BY DFNICN
 ;
GETREGA(JSONRETURN,DFNS,ICNS,SDEAS) ; Get Patient(s) Registration Data
 ;
 N SDERRORS,SDFDA,SDCOUNT,SDRETURN
 S SDCOUNT=1
 ; Validate EAS
 D VALEAS($G(SDEAS),.SDERRORS)
 I $D(SDERRORS) M SDRETURN=SDERRORS D BUILDJSON(.JSONRETURN,.SDRETURN) Q
 ; Validate DFNs and ICNs
 I '$G(DFNS(1)),'$G(ICNS(1)) D ERRLOG^SDESJSON(.SDERRORS,486)
 I $D(SDERRORS) M SDRETURN=SDERRORS D BUILDJSON(.JSONRETURN,.SDRETURN) Q
 ;
 D PROCDFNS(.DFNS,.SDRETURN,.SDCOUNT) ; Process DFNs
 D PROCICNS(.ICNS,.SDRETURN,.SDCOUNT) ; Process ICNs
 ;
 D BUILDJSON(.JSONRETURN,.SDRETURN)
 Q
 ;
PROCDFNS(DFNS,SDRETURN,SDCOUNT) ; Validate and Process DFNs
 ;
 N SDCOUNT1,DFN
 S SDCOUNT1=0
 F  S SDCOUNT1=$O(DFNS(SDCOUNT1)) Q:'SDCOUNT1  D
 .N SDINFO
 .I SDCOUNT>50 D ERRLOG^SDESJSON(.SDERRORS,489) Q
 .S DFN=DFNS(SDCOUNT1)
 .D VALDFN($G(DFN),.SDERRORS) ;Validate DFN
 .I $D(SDERRORS) M SDRETURN=SDERRORS Q
 .D GETREG(DFN,.SDINFO)
 .M SDRETURN("Patient",SDCOUNT)=SDINFO("Patient")
 .S SDCOUNT=SDCOUNT+1
 Q
 ;
PROCICNS(ICNS,SDRETURN,SDCOUNT) ; Validate and Process ICNs
 N SDDFN,ICN
 S SDCOUNT1=0
 F  S SDCOUNT1=$O(ICNS(SDCOUNT1)) Q:'SDCOUNT1  D
 .N SDINFO
 .I SDCOUNT>50 D ERRLOG^SDESJSON(.SDERRORS,489) Q
 .S ICN=ICNS(SDCOUNT1)
 .D VALICN($G(ICN),.SDERRORS) ;Validate ICN
 .I $D(SDERRORS) M SDRETURN=SDERRORS Q
 .D GETREG(SDDFN,.SDINFO)
 .M SDRETURN("Patient",SDCOUNT)=SDINFO("Patient")
 .S SDCOUNT=SDCOUNT+1
 Q
 ;
VALDFN(DFN,ERRORS) ; Validate DFNS
 I +DFN=0 D ERRLOG^SDESJSON(.ERRORS,1) Q
 I '$D(^DPT(DFN,0)) D ERRLOG^SDESJSON(.ERRORS,2," DFN not found:"_$G(DFN))
 Q
 ;
VALICN(ICN,ERRORS) ; Validate ICNS
 ;Convert ICN to DFN
 S SDDFN=$$GETDFN^MPIF001(ICN)
 S SDDFN=$S(+SDDFN>0:SDDFN,1:"")
 I +ICN=0 D ERRLOG^SDESJSON(.ERRORS,2," ICN not found:"_$G(ICN))
 Q
 ;
VALEAS(EAS,ERRORS) ; Validate EAS
 I $L(EAS) S EAS=$$EASVALIDATE^SDESUTIL($G(EAS))
 I $P($G(EAS),U)=-1 D ERRLOG^SDESJSON(.ERRORS,142)
 Q
 ;
GETREG(DFN,SDINFO) ;
 ;
 D GETREG^SDESGETREGA1
 Q
 ;
BUILDJSON(JSONRETURN,SDRETURN) ;Convert data to JSON
 I '$D(SDRETURN("Patient")) S SDRETURN("Patient",1)=""
 D BUILDJSON^SDESBUILDJSON(.JSONRETURN,.SDRETURN) Q
 Q