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

BSDX44.m

Go to the documentation of this file.
BSDX44 ; IHS/OIT/HMW/MSC/SAT - WINDOWS SCHEDULING RPCS ;
 ;;3.0;IHS WINDOWS SCHEDULING;;DEC 09, 2010
 ; Return primary provider for a visit
PRIPRV(RET,VIEN) ;EP
 S RET=$$PRIPRV^BGOUTL(VIEN)
 Q
 ; Set primary provider
 ;  INP = Visit IEN [1] ^ Patient IEN [2] ^ Provider IEN [3] ^ Primary/Secondary (P/S) [4] ^
 ;        Force Conversion to Primary (Y/N) [5]
SETVPRV(RET,INP) ;
 N X,VIEN,VPRV,DFN,PRV,PRI,FORCE,PRIPRV,IENS,FDA,FNUM
 S RET="",FNUM=$$FNUM
 S VIEN=+INP
 S DFN=$P(INP,U,2)
 S RET=$$CHKVISIT^BGOUTL(VIEN,DFN)
 Q:RET
 S PRV=$P(INP,U,3)
 S PRI=$P(INP,U,4)
 S:'$L(PRI) PRI="S"
 S FORCE=$P(INP,U,5)
 S FORCE=FORCE!(FORCE="Y")
 S PRIPRV=$$PRIPRV^BGOUTL(VIEN)
 I PRIPRV>0,PRI="P",+PRIPRV'=PRV D  Q:RET
 .I FORCE S FDA(FNUM,$P(PRIPRV,U,3)_",",.04)="S"
 .E  S RET=$$ERR^BGOUTL(1098,$P(PRIPRV,U,2))
 S (X,VPRV)=0
 F  S X=$O(^AUPNVPRV("AD",VIEN,X)) Q:'X  D  Q:VPRV
 .S:$P($G(^AUPNVPRV(X,0)),U)=PRV VPRV=X
 S IENS=$S(VPRV:VPRV_",",1:"+1,")
 S FDA=$NA(FDA(FNUM,IENS))
 S @FDA@(.01)=PRV
 S @FDA@(.02)=DFN
 S @FDA@(.03)=VIEN
 S @FDA@(.04)=PRI
 S RET=$$UPDATE^BGOUTL(.FDA)
 Q
 ; Return V File #
FNUM() Q 9000010.06
 ;
 ;return data from the V PROVIDER file
GETPRV(BGOY,VPRV)  ;
 ;  .BGOY   = returned pointer to list of V PROVIDER data
 ;   VPRV    = V PROVIDER code - pointer to ^AUPNVPRV
 ; called by BSDX GETVPRV
 N BGOI,BGONOD,BGOVP
 D ^XBKVAR S X="ERROR^BSDX25",@^%ZOSF("TRAP")
 S BGOI=0
 K ^BGOTMP($J)
 S BGOY="^BGOTMP("_$J_")"
 S ^BGOTMP($J,0)="T00020ERRORID"_$C(30)
 ;check for valid V PROVIDER
 I '+VPRV D ERR("BGOPRV: Invalid V Provider ID") Q
 I '$D(^AUPNVPRV(VPRV,0)) D ERR("BGOPRV: Invalid V Provider ID") Q
 S BGONOD=^AUPNVPRV(VPRV,0)
 ;                        1                    2                  3                  4           5
 S ^BGOTMP($J,0)="I00020V_PROVIDER_IEN^I00020PROVIDER_IEN^I00020PATIENT_NAME^T00030VISIT^T00030PROVIDER_STATUS"_$C(30)
 S BGOVP=VPRV_U   ; V_PROVIDER_IEN
 S BGOVP=BGOVP_$P(BGONOD,U,1)_U  ; PROVIDER_IEN
 S BGOVP=BGOVP_$P(BGONOD,U,2)_U  ; PATIENT_NAME
 S BGOVP=BGOVP_$P(BGONOD,U,3)_U  ; VISIT
 S BGOVP=BGOVP_$P(BGONOD,U,5)    ; PROVIDER_STATUS
 S BGOI=BGOI+1
 S ^BGOTMP($J,BGOI)=BGOVP
 S BGOI=BGOI+1
 S ^BGOTMP($J,BGOI)=$C(30)
 S BGOI=BGOI+1
 S ^BGOTMP($J,BGOI)=$C(31)
 Q
 ;
ERROR ;
 D ERR("RPMS Error")
 Q
 ;
ERR(ERRNO) ;Error processing
 I +ERRNO S BGOERR=ERRNO+134234112 ;vbObjectError
 E  S BGOERR=ERRNO
 S BGOI=BGOI+1
 S ^BGOTMP($J,BGOI)=BGOERR_$C(30)
 S BGOI=BGOI+1
 S ^BGOTMP($J,BGOI)=$C(31)
 Q