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

APCLV.m

Go to the documentation of this file.
  1. APCLV ; IHS/CMI/LAB - visit data ;
  1. ;;2.0;IHS PCC SUITE;**10**;MAY 14, 2009;Build 88
  1. ;IHS/TUCSON/LAB - added G parameter to provider call
  1. ;
  1. ;
  1. COMM(V,F) ;PEP ; given V as visit ien, COMMUNITY - STATE,COUNTY,COMMUNITY codes of patient
  1. ;F="E":name of community, F="I":internal ien of community, F="C":stctycomm code
  1. G COMM^APCLV1
  1. ;
  1. PCHART(P,L) ;PEP - returns chart at facility L
  1. ;FOR FORMAT SEE CHART
  1. G PCHART^APCLV1
  1. CHART(V) ;PEP - returns ASUFAC_HRN ( 12 digits, HRN is left zero filled)
  1. ;V = visit ien, returns asufac_hrn for this visit
  1. ;if chart exists at Loc. of encounter it is returned
  1. ;if not, then chart at DUZ(2) is returned
  1. ;if none, then null returned
  1. G CHART^APCLV1
  1. ;
  1. LOCENC(V,F) ;PEP - given visit ien V, return loc. of encounter in format F
  1. ;F="E":name of location , F="I":ien of location, F="C":asufac
  1. G LOCENC^APCLV1
  1. ;
  1. VD(V,F) ;PEP - given visit ien in V, return date of visit in internal or external format
  1. ;F="I":internal fileman format, F="S":external slash date, F="E":external full (JAN 01, 1995)
  1. ;
  1. G VD^APCLV1
  1. VDTM(V,F) ;PEP - given visit ien in V, return visit date and time in F format
  1. ;F="S":01/01/98 3:15pm, F="E":JAN 01, 1998 3:15PM, F="I":fileman internal format
  1. G VDTM^APCLV1
  1. ;
  1. DDTM(V,F) ;PEP - discharge date/time
  1. ;
  1. G DDTM^APCLV1
  1. TIME(V,F) ;PEP - given visit ien in V, returns visit time of day i n format F
  1. ;F="E": form is 11:15 F="I" form is 1115 (fileman format), F="P" form in am/pm 11:15am
  1. G TIME^APCLV1
  1. ;
  1. DOW(V,F) ;PEP - given V, visit ien and F, format returns DOW of visit
  1. ;in F="E":Monday, F="I":1
  1. G DOW^APCLV1
  1. ;
  1. TYPE(V,F) ;PEP - given V, visit ien and F, format, returns type of visit
  1. ;F="I":internal set, F="E":external set
  1. G TYPE^APCLV1
  1. ;
  1. SC(V,F) ;PEP - given V=visit ien and F=format, returns service category of visit
  1. ;F="I":internal set, F="E":external set
  1. G SC^APCLV1
  1. CLINIC(V,F) ;PEP - given V is visit ien, F is format, returns clinic on visit
  1. ;F="E":clinic name, F="C":clinic code, F="I":internal ien of clinic
  1. G CLINIC^APCLV1
  1. ;
  1. EM(V,F) ;PEP - given V, visit ien and F, format, returns eval&man code of visit
  1. ;F="I":internal ien of cpt code, F="E":des of cpt code, F="C":cpt code
  1. G EM^APCLV1
  1. ;
  1. LS(V,F) ;PEP - given V, visit ien and F, format, returns level of servie of visit
  1. ;F="I":internal set, F="E":external set
  1. G LS^APCLV1
  1. ;
  1. ADMSERV(V,F) ;PEP - return admitting service in Code, internal or external form
  1. G ADMSERV^APCLV1
  1. DSCHSERV(V,F) ;PEP - return discharge service in format F
  1. G DSCHSERV^APCLV1
  1. NLAB(V) ;PEP - returns # of labs on the visit V
  1. G NLAB^APCLV1
  1. ADMTYPE(V,F) ;PEP - return admission type i format F
  1. ;I = internal format
  1. ;E = long name of the type
  1. ;C = coded value
  1. G ADMTYPE^APCLV1
  1. LOSHRS(AD,DSD,PAT) ;PEP; returns length of stay in hours
  1. Q $J($$FMDIFF^XLFDT(DSD,AD,2)/3600,0,0)
  1. ADMUB(V,F) ;PEP - return admission type i format F
  1. G ADMUB^APCLV1
  1. ADMSOURC(V,F) ;PEP - return admission type i format F
  1. G ADMSOURC^APCLV1
  1. DSCHTYPE(V,F) ;PEP - return discharge type in format F
  1. ;I - internal format
  1. ;E - external name
  1. ;C - coded value
  1. G DSCHTYPE^APCLV1
  1. NRX(V) ;PEP - returns # of rxs on visit V
  1. G NRX^APCLV1
  1. ;
  1. PRIMPROV(V,F) ;PEP - returns primary provider on that visit in F format
  1. ;F is defined as:
  1. ;I - returns ien of provider in file 200 or 6
  1. ;T - returns provider' initials
  1. ;A - returns internal set of affiliation (e.g. 1)
  1. ;B - returns external of affiliation (e.g. IHS)
  1. ;C - returns provider's code
  1. ;D - returns provider's discipline code (E.G. 01)
  1. ;E - returns provider's discipline in external format (PHYSICIAN)
  1. ;F - returns ien of provider's discipline (22)
  1. ;N - returns provider's name
  1. ;O - returns provider's affl_disc (e.g. 101 for IHS nurse)
  1. ;P - returns provider's affl_disc_code (e.g. 101LAB for nurse Lori Ann Butcher
  1. ;G - returns the event date&time for this provider
  1. G PRIMPROV^APCLV06
  1. ;
  1. SECPROV(V,F,N) ;PEP - returns secondary provider N in format F
  1. ; see primPROV for format definitions, N is the 1-N secondary providers, if you want an array of all secondary providers use SECPROVS EP.
  1. G SECPROV^APCLV06
  1. ;
  1. PRIMPOV(V,F) ;PEP - returns primary pov on visit V in format F
  1. ;F is defined as
  1. ;I - ien of ICD9 code
  1. ;E - external of ICD9 (text)
  1. ;C - icd9 code
  1. ;A - APC recode
  1. ;D - cause of dx
  1. ;J - cause of injury
  1. ;P - place of injury
  1. ;N - provider narrative external text
  1. G PRIMPOV^APCLV07
  1. ;
  1. SECPOV(V,F,N) ;PEP - returns secondary pov N in format F for visit V
  1. ;see primpov for definitions of F
  1. G SECPOV^APCLV07
  1. ;
  1. PROC(V,F,N) ;PEP - returns procedure N in format F for visit V
  1. ;F is defined as
  1. ;I -ien of icd9 code (.01)
  1. ;E - external of icd code
  1. ;C- icd code
  1. ;P - CPT CODE
  1. ;T - CPT INTERNAL IEN
  1. ;D - date of proc/int fm format
  1. ;G - date of proc/ext format
  1. ;F - INFECTION Y/N
  1. ;R - PROV AFFL_DISC
  1. ;X - DX DONE FOR - N
  1. ;N - provider narrative
  1. G PROC^APCLV08
  1. IMM(V,F,N) ;PEP - returns immunization done on visit V in format F number N
  1. ;F is defined as
  1. ;I - ien of immunization entry
  1. ;C - immunization code
  1. ;E - immunization name
  1. ;S - series
  1. G IMM^APCLV11
  1. DENT(V,F,N) ;PEP - returns dental
  1. ;F is defined as
  1. ;I - ien of dental entry
  1. ;C - ada code
  1. ;E - ada name
  1. ;S - series
  1. G DENT^APCLV05
  1. DSCHDATE(V,F) ;PEP - return discharge date in F format
  1. ;F="I":internal fileman format, F="S":external slash date, F="E":external full (JAN 01, 1995)
  1. ;
  1. G DSCHDATE^APCLV1
  1. CONSULTS(V) ;PEP - return # of consults
  1. G CONSULTS^APCLV1
  1. ATTPHY(V,F) ;PEP - return attending physician
  1. G ATTPHY^APCLV06
  1. LOS(V) ;PEP - return length of stay
  1. G LOS^APCLV1
  1. FACTX(V,F) ;PEP - return facility transferred to
  1. G FACTX^APCLV1
  1. MIDWIFE(V) ;PEP - return midwifery code
  1. G MIDWIFE^APCLV06
  1. ACTTIME(V) ;PEP - return activity time
  1. G ACTTIME^APCLV1
  1. TRAVTIME(V) ;PEP - return travel time
  1. G TRAVTIME^APCLV1
  1. CHSCOST(V) ;PEP - return CHS total cost
  1. G CHSCOST^APCLV1
  1. PATIENT(V,F) ;PEP - return patient
  1. G PATIENT^APCLV1
  1. DLM(V,F) ;PEP - return date last modified
  1. G DLM^APCLV1
  1. DVEX(V,F) ;PEP - return date visit exported
  1. G DVEX^APCLV1
  1. DWEX(V,F) ;PEP - return date visit exported to NDW (national data warehouse)
  1. G DWEX^APCLV1
  1. CODT(V,F) ;PEP - return check out date&time
  1. G CODT^APCLV1
  1. APDT(V,F) ;PEP - return appt date&time from visit
  1. G APDT^APCLV1
  1. APWI(V,F) ;PEP - return walk-in/appt
  1. G APWI^APCLV1
  1. OUTSL(V) ;PEP - returns outside location
  1. G OUTSL^APCLV1
  1. ;see programmer for a copy of documentation
  1. ADMDX(V,F) ;PEP - return admitting dx
  1. G ADMDX^APCLV07
  1. PCCVF(V,T,F,A) ;PEP return v file information
  1. I $G(T)="" Q 1 ;no type of data defined
  1. I '$G(V) Q 3 ;no visit ien passed
  1. I $G(F)="" Q 2 ;no format defined
  1. I '$D(^AUPNVSIT(V)) Q 4
  1. NEW APCLTYPE,X,APCLPROG
  1. S APCLTYPE=""
  1. F I=1:1 S X=$T(TVAL+I) Q:X=""!(APCLTYPE]"") I $P(X,";;",2)=T S APCLTYPE=$P(X,";;",2),APCLPROG=$P(X,";;",3)
  1. I APCLTYPE="" Q 5 ;not valid type
  1. K APCLV
  1. D @APCLPROG
  1. Q ""
  1. BMI(H,W,D) ;PEP - return BMI if passed Ht and Wt
  1. ;H - ht in inches
  1. ;W - wt in inches
  1. ;D - number of decimal digits to return, if null pass full BMI value and all decimal digits
  1. I $G(H)="" Q "" ;no ht
  1. I $G(W)="" Q "" ;no wt
  1. NEW %
  1. S W=W*.45359,H=(H*.0254),H=(H*H),%=(W/H)
  1. I $G(D) S %=$J(%,(D+3),D) ;full length equal 2N1"." with D decimals
  1. Q %
  1. PBMI(P,EDATE) ;PEP - return patient's most current BMI as of EDATE
  1. ;P - patient DFN
  1. ;EDATE - as of date in internal Fileman format if null DT is assumed
  1. ;return value: will be a "^" pieced string with the following pieces:
  1. ; 1 - BMI value (not rounded)
  1. ; 2 - HT value used (not rounded) - IF BMI IS STORED THIS WILL BE DATE OF LAST HT
  1. ; 3 - Date of HT value used in internal fileman format
  1. ; 4 - visit ien of visit on which HT found
  1. ; 5 - WT used (not rounded)
  1. ; 6 - date of weight used
  1. ; 7 - visit ien of visit on which weight found
  1. ; 8 - error/warning messages in "|" delimted format e.g. warning 1|warning 2
  1. ; warnings:
  1. ; PATIENT DFN INVALID - either P is null or P does not exist in AUPNPAT or DPT
  1. ; NO WEIGHT FOUND ON OR PRIOR TO (edate) - no weight on file for
  1. ; this patient on or prior to the value of EDATE
  1. ; NO HEIGHT FOUND ON OR PRIOR TO (edate) - no height on file for
  1. ; this patiet on or prior to the value of EDATE
  1. ; 9 - DATE IF STORED BMI
  1. ; 10 - IEN OF V MEASUREMENT OF STORED BMI
  1. ;
  1. ;
  1. ;NOTE: any weight taken on a prenatal visit is excluded and a prior weight is used
  1. ;NOTE: if you add warnings, please use the word WARNING (caps) in the error message
  1. ;NOTE: pts <18 must have ht/wt on same day and within past year
  1. ; pts >50 must have ht/wt within past 2 years
  1. ; pts 19-50 must have ht/wt within past5 years
  1. ;
  1. G PBMI^APCLV2
  1. APCWL(V) ;PEP - is this visit APC Workload Reportable
  1. ;note: LOCATION OF ENCOUNTER NOT FIGURED IN HERE.
  1. G APCWL^APCLV1
  1. TVAL ;
  1. ;;MEASUREMENT;;MEAS^APCLV01;;9000010.01
  1. ;;PROVIDER;;PROV^APCLV06;;9000010.06
  1. ;;POV;;POV^APCLV07;;9000010.07