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

BQIPTAP.m

Go to the documentation of this file.
  1. BQIPTAP ;PRXM/HC/DLS - Scheduled Visits (Pending); 07 Nov 2005 10:37 AM
  1. ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
  1. ;
  1. Q
  1. ;
  1. EN(DATA,DFN,DRANGE) ; EP - BQI PATIENT SCHEDULED APPTS
  1. ;Description
  1. ; Retrieves all pending scheduled visits for a patient.
  1. ;
  1. ;Input
  1. ; DFN - Patient IEN
  1. ; DRANGE - Future date to pull future appointments up to and including.
  1. ;
  1. ;Output
  1. ; DATA - Name of global in which data is stored.
  1. ;
  1. N UID,X,BQII,ARRAY,I,CSTCD
  1. N APDATA,APDTTM,APCLIN,APCLIN,CLIEN,DEFPRV,FMDTTM
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("BQIPTAP",UID))
  1. K @DATA
  1. K ^TMP("BQIPTAPT",UID)
  1. ;
  1. S BQII=0
  1. ;
  1. NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPTAP D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
  1. ;
  1. D HDR
  1. ;
  1. ;
  1. S ARRAY="^TMP(""BQIPTAPT"",UID,"
  1. D PEND^BSDU2(DFN,0,.ARRAY)
  1. S DRANGE=$$DATE^BQIUL1($G(DRANGE))
  1. I DRANGE="" S DRANGE=9999999
  1. S DRANGE=DRANGE+.2401
  1. S I=1
  1. F S I=$O(^TMP("BQIPTAPT",UID,I)) Q:'I D
  1. . S APDATA=^TMP("BQIPTAPT",UID,I)
  1. . S APDTTM=$P(APDATA,"^"),APCLIN=$P(APDATA,"^",2)
  1. . S APDTTM=$TR($E(APDTTM,1,7)_$E(APDTTM,9,18),"@"," ")
  1. . S FMDTTM=$$DATE^BQIUL1(APDTTM)
  1. . Q:FMDTTM>DRANGE
  1. . F Q:$E(APCLIN,$L(APCLIN))'=" " S APCLIN=$E(APCLIN,1,($L(APCLIN)-1))
  1. . S CLIEN=^TMP("BQIPTAPT",UID,I,0),DEFPRV=$$DCPRV(CLIEN)
  1. . S CSTCD="" I CLIEN'="" S CSTCD=$$GET1^DIQ(40.7,CLIEN_",",1,"E")
  1. . S BQII=BQII+1,@DATA@(BQII)=$$FMTE^BQIUL1($P(APDATA,"^"))_"^"_APCLIN_" "_CSTCD_"^"_DEFPRV_$C(30)
  1. ;
  1. ; Drop down to DONE
  1. ;
  1. DONE ; -- exit code
  1. K ^TMP("BQIPTAPT",UID)
  1. S BQII=BQII+1,@DATA@(BQII)=$C(31)
  1. Q
  1. ;
  1. HDR ;
  1. S @DATA@(BQII)="D00015AP_DATE^T00050AP_CLIN^T00050DEF_PRV"_$C(30)
  1. Q
  1. ;
  1. DCPRV(CLIEN) ;EP - Loop thru Clinic Providers and Return Default Provider.
  1. ; DCY returns as the name of the default clinic provider.
  1. N DCX,DCY,FOUND
  1. S (DCX,FOUND)=0
  1. S DCY=$P($G(^SC(CLIEN,0)),U,13)
  1. I DCY="" D
  1. . F S DCX=$O(^SC(CLIEN,"PR",DCX)) Q:'DCX!FOUND D
  1. .. I $P($G(^SC(CLIEN,"PR",DCX,0)),U,2)=1 S DCY=+^SC(CLIEN,"PR",DCX,0),FOUND=1
  1. I $G(DCY) S DCY=$$GET1^DIQ(200,DCY,.01)
  1. Q $G(DCY)
  1. ;
  1. ERR ;
  1. D ^%ZTER
  1. NEW Y,ERRDTM
  1. S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
  1. S BMXSEC="Recording that an error occurred at "_ERRDTM
  1. I $D(BQII),$D(DATA) S BQII=BQII+1,@DATA@(BQII)=$C(31)
  1. Q