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

BPXRMPRC.m

Go to the documentation of this file.
BPXRMPRC ; IHS/MSC/MGH - Code to handle V PROCEDURE ;03-Mar-2016 11:29;DU
 ;;2.0;CLINICAL REMINDERS;**1001,1007**;Feb 04, 2005;Build 12
 ;
 ;====================================================
FPDAT(DFN,TAXARR,NGET,SDIR,BDT,EDT,FLIST) ;Find data for a patient.
 N DAS,DATE,DS,EDTT,ICDP,IND,NFOUND,NODE,NNODE,TE,TLIST,TS
 N TDATE,TIND,CODESYS
 I $G(^PXRMINDX(9000010.08,"DATE BUILT"))="" D  Q
 . D NOINDEX^PXRMERRH("TX",TAXARR("IEN"),9000010.08)
 I '$D(^PXRMINDX(9000010.08,"PPI",DFN)) Q
 ;S NNODE=+$P($G(TAXARR("PDS",9000010.08,80.1)),U,2)
 ;I NNODE=0 Q
 S EDTT=$S(EDT[".":EDT+.0000001,1:EDT+.240001)
 S DS=$S(SDIR=+1:BDT-.000001,1:EDTT)
 S TS=$O(TAXARR(80.1,""))-1
 S TE=$O(TAXARR(80.1,""),-1)
 S NFOUND=0
 ;F IND=1:1:NNODE D
 ;S NODE=TAXARR("PDS",9000010.08,80.1,IND)
 ;S ICDP=TS
 S ICDP=""
 S NODE=""
 ;IHS/MSC/MGH Section redone for ICD-10 codes patch 1007
 F  S NODE=$O(^PXRMINDX(9000010.08,"PPI",DFN,NODE)) Q:NODE=""  D
 .F CODESYS="10P","ICP" D
 ..S CODE=""
 ..F  S CODE=$O(TAXARR("AE",CODESYS,CODE)) Q:CODE=""  D
 ... S ICDP=TAXARR("AE",CODESYS,CODE)
 ... ;IHS/MSC/MGH changed 1007 to get IEN of code
 ... I CODESYS="10P" S ICDP=+$$CODEN^ICDEX(CODE,80.1)
 ... I '$D(^PXRMINDX(9000010.08,"PPI",DFN,NODE,ICDP)) Q
 ... S DATE=DS
 ... F  S DATE=+$O(^PXRMINDX(9000010.08,"PPI",DFN,NODE,ICDP,DATE),SDIR) Q:$S(DATE=0:1,DATE<BDT:1,DATE>EDTT:1,1:0)  D
 .... S DAS=$O(^PXRMINDX(9000010.08,"PPI",DFN,NODE,ICDP,DATE,""))
 .... S NFOUND=NFOUND+1
 .... S TLIST(DATE,NFOUND)=DAS_U_DATE_U_CODESYS_U_ICDP_U_NODE
 .... I NFOUND>NGET D
 ..... S TDATE=$O(TLIST(""),-SDIR),TIND=$O(TLIST(TDATE,""))
 ..... K TLIST(TDATE,TIND)
 ;Return up to NGET of the most recent entries.
 S NFOUND=0
 S DATE=""
 F  S DATE=$O(TLIST(DATE),SDIR) Q:(DATE="")!(NFOUND=NGET)  D
 . S IND=0
 . F  S IND=$O(TLIST(DATE,IND)) Q:(IND="")!(NFOUND=NGET)  D
 .. S NFOUND=NFOUND+1
 .. S FLIST(DATE,NFOUND,9000010.08)=TLIST(DATE,IND)
 Q
 ;
 ;====================================================
GETDATA(DAS,FIEVT) ;Return data for a specified V POV entry.
 ;DBIA #4250
 D VPRC^BPXRMPX(DAS,.FIEVT)
 Q
 ;
 ;====================================================
GPLIST(TAXARR,NOCC,BDT,EDT,PLIST) ;Build patient list for V PROCEDURE entries.
 N DAS,DATE,DFN,DS,ICDP,IND,NFOUND,NODE,NNODE,TEMP,TLIST
 I $G(^PXRMINDX(9000010.08,"DATE BUILT"))="" D  Q
 . D NOINDEX^PXRMERRH("TX",TAXARR("IEN"),9000010.08)
 S TLIST="GPLIST_BPXRMPRC"
 S DS=$S(EDT[".":EDT+.0000001,1:EDT+.240001)
 S NNODE=+$P($G(TAXARR("PDS",9000010.08,80.1)),U,2)
 I NNODE=0 Q
 S ICDP=""
 F  S ICDP=$O(TAXARR(80.1,ICDP)) Q:(ICDP="")  D
 . I '$D(^PXRMINDX(9000010.08,"IPP",ICDP)) Q
 . F IND=1:1:NNODE D
 .. S NODE=TAXARR("PDS",9000010.08,80.1,IND)
 .. I '$D(^PXRMINDX(9000010.08,"IPP",ICDP,NODE)) Q
 .. S DFN=0
 .. F  S DFN=$O(^PXRMINDX(9000010.08,"IPP",ICDP,NODE,DFN)) Q:DFN=""  D
 ... S DATE=DS
 ... F  S DATE=+$O(^PXRMINDX(9000010.08,"IPP",ICDP,NODE,DFN,DATE),-1) Q:(DATE=0)!(DATE<BDT)  D
 .... S DAS=$O(^PXRMINDX(9000010.08,"IPP",ICDP,NODE,DFN,DATE,""))
 .... S ^TMP($J,TLIST,DFN,DATE,DAS)=ICDP_U_"ICD0"_U_NODE
 ;Return up to NOCC of the most recent entries for each patient.
 S DFN=0
 F  S DFN=$O(^TMP($J,TLIST,DFN)) Q:DFN=""  D
 . S NFOUND=0
 . S DATE=""
 . F  S DATE=$O(^TMP($J,TLIST,DFN,DATE),-1) Q:(DATE="")!(NFOUND=NOCC)  D
 .. S DAS=""
 .. F  S DAS=$O(^TMP($J,TLIST,DFN,DATE,DAS)) Q:DAS=""  D
 ... S NFOUND=NFOUND+1
 ... S TEMP=^TMP($J,TLIST,DFN,DATE,DAS)
 ... S ICDP=$P(TEMP,U,1)
 ... S ^TMP($J,PLIST,1,DFN,NFOUND,9000010.08)=DAS_U_DATE_U_TEMP
 K ^TMP($J,TLIST)
 Q
 ;
 ;====================================================
MHVOUT(INDENT,OCCLIST,IFIEVAL,NLINES,TEXT) ;Produce the MHV output.
 N CODE,D0,PROC,EM,ICD0P,ICD0ZN,ICD9ZN,IND,JND,NAME,NIN,NOUT,PN,RANK
 N TEMP,TEXTIN,TEXTOUT,VDATE
 S NAME="Procedure = "
 S IND=0
 F  S IND=$O(OCCLIST(IND)) Q:IND=""  D
 . S VDATE=IFIEVAL(IND,"DATE")
 . S ICD0P=IFIEVAL(IND,"CODEP")
 . S D0=$G(^AUPNVPRC(IFIEVAL(IND,"DAS"),0))
 . S ICD9ZN=$$ICDOP^ICDCODE(ICD0P,VDATE)
 . S CODE=$P(ICD0ZN,U,2)
 . S PROC=$P(ICD0ZN,U,5)
 . S TEMP=NAME_PROC_" ("_$$EDATE^PXRMDATE(VDATE)_")"
 . D FORMATS^PXRMTEXT(INDENT+2,PXRMRM,4,.TEXTIN,.NOUT,.TEXTOUT)
 . F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
 S NLINES=NLINES+1,TEXT(NLINES)=""
 Q
 ;
 ;====================================================
OUTPUT(INDENT,OCCLIST,IFIEVAL,NLINES,TEXT) ;Produce the clinical
 ;maintenance output. The VPOV information is:  DATE, ICD9 IEN,
 ;ICD9 CODE, MODIFIER, PROVIDER NARRATIVE.
 N CODE,D0,PROC,EM,ICD0P,ICD0ZN,IND,JND,NIN,NOUT,PN,RANK
 N TEMP,TEXTIN,TEXTOUT,VDATE
 S NLINES=NLINES+1
 S TEXT(NLINES)=$$INSCHR^PXRMEXLC(INDENT," ")_"Hospitalization Procedure:"
 S IND=0
 F  S IND=$O(OCCLIST(IND)) Q:IND=""  D
 . S VDATE=IFIEVAL(IND,"DATE")
 . S TEMP=$$EDATE^PXRMDATE(VDATE)
 . S ICD0P=IFIEVAL(IND,"CODE")
 . S CODESYS=IFIEVAL(IND,"CODESYS")
 . S D0=$G(^AUPNVPRC(IFIEVAL(IND,"DAS"),0))
 . S PN=$P(D0,U,4)
 . I PN="" S PN="MISSING"
 .E  S PN=$P($G(^AUTNPOV(PN,0)),U,1)
 . S ICD0ZN=$$ICDOP^ICDEX(ICD0P,VDATE,CODESYS,"I")
 . S CODE=$P(ICD0ZN,U,2)
 . S PROC=$P(ICD0ZN,U,5)
 . S TEMP=TEMP_" "_CODE_" "_PROC_" data node: "
 . S TEXTIN(1)=$$EDATE^PXRMDATE(VDATE)_"  "_CODE_" ("_CODESYS_")"
 . S TEXTIN(2)=" Prov. Narr. - "_PN
 . D FORMAT^PXRMTEXT(INDENT+2,PXRMRM,2,.TEXTIN,.NOUT,.TEXTOUT)
 . F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
 S NLINES=NLINES+1,TEXT(NLINES)=""
 Q
 ;