- SDESGETPATINQUIR ;ALB/BLB,JAS - SDES GET PATIENT INQUIRY ;Apr 18, 2024
- ;;5.3;Scheduling;**842,877**;Aug 13, 1993;Build 14
- ;;Per VHA Directive 6402, this routine should not be modified
- Q
- ;
- GETINQUIRY(JSONRETURN,DFN) ;
- N ERRORS,RETURN,DETAILS,TMPRETURN,ORDA,ORDAS
- I '$$VALIDATEDFN(.ERRORS,$G(DFN)) M RETURN=ERRORS D BUILDJSON(.JSONRETURN,.RETURN) Q
- ;
- K ^TMP("ORDATA",$J)
- D PTINQ^ORWPT(.TMPRETURN,DFN)
- ; Remove all but Last Four of SSN
- S ORDA=0
- F S ORDA=$O(^TMP("ORDATA",$J,ORDA)) Q:'ORDA I $D(^TMP("ORDATA",$J,ORDA)) D
- . S ORDAS=0
- . F S ORDAS=$O(^TMP("ORDATA",$J,ORDA,ORDAS)) Q:'ORDAS I $L(^TMP("ORDATA",$J,ORDA,ORDAS)) D
- . . N ORLINE S ORLINE=^TMP("ORDATA",$J,ORDA,ORDAS)
- . . I ORLINE?.E3N1"-"2N1"-"4N.E D
- . . . S ^TMP("ORDATA",$J,ORDA,ORDAS)=$E(ORLINE,1,$L($P(ORLINE,"-"))-3)_$P(ORLINE,"-",3)
- ;
- M DETAILS("PatientInquiryDetails")=^TMP("ORDATA",$J)
- ;
- I '$D(DETAILS) S DETAILS("PatientInquiryDetails",1)=""
- M RETURN=DETAILS D BUILDJSON(.JSONRETURN,.RETURN)
- Q
- ;
- VALIDATEDFN(ERRORS,DFN) ;
- I DFN="" D ERRLOG^SDESJSON(.ERRORS,1) Q 0
- I DFN'="",'$D(^DPT(DFN,0)) D ERRLOG^SDESJSON(.ERRORS,2) Q 0
- Q 1
- ;
- BUILDJSON(JSONRETURN,RETURN) ;
- N JSONERR
- D ENCODE^XLFJSON("RETURN","JSONRETURN","JSONERR")
- Q
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESGETPATINQUIR 1260 printed Mar 13, 2025@22:02:06 Page 2
- SDESGETPATINQUIR ;ALB/BLB,JAS - SDES GET PATIENT INQUIRY ;Apr 18, 2024
- +1 ;;5.3;Scheduling;**842,877**;Aug 13, 1993;Build 14
- +2 ;;Per VHA Directive 6402, this routine should not be modified
- +3 QUIT
- +4 ;
- GETINQUIRY(JSONRETURN,DFN) ;
- +1 NEW ERRORS,RETURN,DETAILS,TMPRETURN,ORDA,ORDAS
- +2 IF '$$VALIDATEDFN(.ERRORS,$GET(DFN))
- MERGE RETURN=ERRORS
- DO BUILDJSON(.JSONRETURN,.RETURN)
- QUIT
- +3 ;
- +4 KILL ^TMP("ORDATA",$JOB)
- +5 DO PTINQ^ORWPT(.TMPRETURN,DFN)
- +6 ; Remove all but Last Four of SSN
- +7 SET ORDA=0
- +8 FOR
- SET ORDA=$ORDER(^TMP("ORDATA",$JOB,ORDA))
- if 'ORDA
- QUIT
- IF $DATA(^TMP("ORDATA",$JOB,ORDA))
- Begin DoDot:1
- +9 SET ORDAS=0
- +10 FOR
- SET ORDAS=$ORDER(^TMP("ORDATA",$JOB,ORDA,ORDAS))
- if 'ORDAS
- QUIT
- IF $LENGTH(^TMP("ORDATA",$JOB,ORDA,ORDAS))
- Begin DoDot:2
- +11 NEW ORLINE
- SET ORLINE=^TMP("ORDATA",$JOB,ORDA,ORDAS)
- +12 IF ORLINE?.E3N1"-"2N1"-"4N.E
- Begin DoDot:3
- +13 SET ^TMP("ORDATA",$JOB,ORDA,ORDAS)=$EXTRACT(ORLINE,1,$LENGTH($PIECE(ORLINE,"-"))-3)_$PIECE(ORLINE,"-",3)
- End DoDot:3
- End DoDot:2
- End DoDot:1
- +14 ;
- +15 MERGE DETAILS("PatientInquiryDetails")=^TMP("ORDATA",$JOB)
- +16 ;
- +17 IF '$DATA(DETAILS)
- SET DETAILS("PatientInquiryDetails",1)=""
- +18 MERGE RETURN=DETAILS
- DO BUILDJSON(.JSONRETURN,.RETURN)
- +19 QUIT
- +20 ;
- VALIDATEDFN(ERRORS,DFN) ;
- +1 IF DFN=""
- DO ERRLOG^SDESJSON(.ERRORS,1)
- QUIT 0
- +2 IF DFN'=""
- IF '$DATA(^DPT(DFN,0))
- DO ERRLOG^SDESJSON(.ERRORS,2)
- QUIT 0
- +3 QUIT 1
- +4 ;
- BUILDJSON(JSONRETURN,RETURN) ;
- +1 NEW JSONERR
- +2 DO ENCODE^XLFJSON("RETURN","JSONRETURN","JSONERR")
- +3 QUIT
- +4 ;