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

VENPCCUR.m

Go to the documentation of this file.
VENPCCUR ; IHS/OIT/GIS - VEN UTILITIES ; RPC CALLS
 ;;2.6;PCC+;**1,3**;APR 03, 2012;Build 24
 ;
 ;
PATIENT(OUT,IN) ; EP - RPC: VEN PCC+ GET PATIENT
 ; GIVEN A CHART NUMBER, RETURN ALL PATIENT IDENTIFIERS
 I '$L($G(IN)) Q
 N NAME,DOB,AGE,X,Y,%,HRN,AUPNPAT,AUPNSEX,AUPNDOB,AUPNDAYS,AUPNDOD,B,SSN,PP
 S OUT="",HRN=IN,B="|"
 S DIC="^AUPNPAT(",X=HRN,DIC(0)="M"
PLK ; EP  - FOR ALT PROCESSING OF HRN
 D ^DIC I Y=-1 Q
 I $G(AUPNDOD) Q  ; PATIENT MUST BE ALIVE
 I '$G(AUPNPAT) Q
 S NAME=$P($G(^DPT(AUPNPAT,0)),U) I '$L(NAME) Q
 S DOB=$$FMTE^XLFDT(AUPNDOB,"2D")
 S AGE=DT-AUPNDOB\10000
 S PPIEN=$P($G(^AUPNPAT(AUPNPAT,0)),U,14),PPIEN=+$$PRV^VENPCCU(PPIEN)
 S PPNAME=$P($G(^VA(200,PPIEN,0)),U)
 S SSN=$P($G(^DPT(AUPNPAT,0)),U,9)
 S OUT=AUPNPAT_B_NAME_B_AGE_B_DOB_B_PPIEN_B_PPNAME_B_AUPNSEX_B_SSN
 D ^XBFMK
 Q
 ;
VISIT(OUT,IN) ; EP - RPC: VEN PCC+ GET RECENT VISITS
 ; GIVEN A DFN, RETURN A TABLE GENERATION STRING THAT WILL SHOW ALL VISITS FOR THIS PT IN PAST 24 HOURS
 N START,FIN,%,DFN
 S OUT=""
 S DFN=+$G(IN) I '$D(^DPT(DFN,0)) Q
 S %=$$FMADD^XLFDT(DT,-1),START=$$FMTE^XLFDT(%,"2D")
 S %=$$FMADD^XLFDT(DT,+1),FIN=$$FMTE^XLFDT(%,"2D")
 S OUT="BMX ADO SS^VISITS^^AA~"_START_"~"_FIN_"~9~~~~"_DFN_"|R"
 Q
 ;
AGE(DFN) ; EP - TRIGGER FUNCTION FOR BMX ADO SCHEMA/PATIENT DEMOGRAPHICS ; GIVEN DFN RETRUN THE AGE
 N DOB,AGE
 S DOB=$P($G(^DPT(+$G(DFN),0)),U,3) I 'DOB Q ""
 S AGE=DT-DOB\10000
 Q AGE
 ; 
PP1(VIEN) ; EP - TRIGGER FUNCTION FOR BMX ADO SCHEMA/VISITS ; RETURN PRIMARY PROVIDER IEN
 Q $$PP(+$G(VIEN),1)
 ; 
PP2(VIEN) ; EP - TRIGGER FUNCTION FOR BMX ADO SCHEMA/VISITS ; RETURN PRIMARY PROVIDER NAME
 Q $$PP(+$G(VIEN),2)
 ; 
PP(VIEN,MODE) ; EP - EXTRACTION FUNCTION ; GIVEN A VISIT IEN, RETURN THE PRIMARY PROVIDER (IF THERE IS ONE): IEN^NAME
 I '$D(^AUPNVSIT(+$G(VIEN),0)) Q ""
 N VPIEN,NAME,PIEN,TOT
 S PVIEN=0,TOT=0
 F  S PVIEN=$O(^AUPNVPRV("AD",VIEN,PVIEN)) Q:'PVIEN  S TOT=TOT+1 I $P($G(^AUPNVPRV(PVIEN,0)),U,4)="P" Q
 I 'TOT Q ""
 I TOT=1 S PVIEN=$O(^AUPNVPRV("AD",VIEN,0)) I $P($G(^AUPNVPRV(PVIEN,0)),U,4)="S" Q ""
 I 'PVIEN Q ""
 S PIEN=+$G(^AUPNVPRV(PVIEN,0)) I 'PIEN Q ""
 S PIEN=$$PRV^VENPCCU(PIEN) ; FILE 200 CONVERION (IF NECESSARY)
 I MODE=1 Q PIEN
 S NAME=$P($G(^VA(200,PIEN,0)),U) I '$L(NAME) Q ""
 Q NAME
 ;