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

APCLAPI3.m

Go to the documentation of this file.
  1. APCLAPI3 ; IHS/CMI/LAB - visit data ;
  1. ;;2.0;IHS PCC SUITE;**2,11**;MAY 14, 2009;Build 58
  1. ;IHS/TUCSON/LAB - added G parameter to provider call
  1. ;
  1. ;
  1. ;BJPC v1.0 patch 1
  1. ;
  1. LASTMMR(APCLPDFN,APCLBD,APCLED,APCLFORM) ;PEP - date of last MMR
  1. ; Return the last recorded MMR:
  1. ; - V Immunization: 3, 94
  1. ; - V POV V06.4
  1. ; - V Procedure 99.48
  1. ; - V CPT 90707;90710
  1. ;
  1. ; Input:
  1. ; APCLPDFN - Patient DFN
  1. ; APCLBD - beginning date to begin search for value - if blank, default is DOB
  1. ; APCLED - ending date of search - if blank, default is DT
  1. ; APCLFORM - APCLFORM returned: D - return date only - example 3070801
  1. ; A - return value:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ; Default if blank is D
  1. ; Output:
  1. ; If APCLFORM is blank or APCLFORM is D returns internal fileman date if one found otherwise returns null
  1. ; If APCLFORM is A returns the string:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ;
  1. I $G(APCLPDFN)="" Q ""
  1. I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(APCLPDFN)
  1. I $G(APCLED)="" S APCLED=DT
  1. I $G(APCLFORM)="" S APCLFORM="D"
  1. NEW APCLLAST,APCLVAL,APCLX,R,X,Y,V,E,T,G,APCLY,APCLF
  1. S APCLLAST=""
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"3","IMMUNIZATION",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"94","IMMUNIZATION",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. S APCLVAL=$$LASTDXT^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"BGP MMR IZ DXS","A")
  1. D E
  1. S APCLVAL=$$LASTPRCT^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"BGP MMR IZ PROCS","A")
  1. D E
  1. S APCLVAL=$$LASTCPTI^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"90707;90710","A")
  1. D E
  1. I APCLFORM="D" Q $P(APCLLAST,U)
  1. Q APCLLAST
  1. ;
  1. E ;
  1. I $P(APCLVAL,U,1)>$P(APCLLAST,U,1) S APCLLAST=APCLVAL
  1. Q
  1. ;
  1. LASTRUB(APCLPDFN,APCLBD,APCLED,APCLFORM) ;PEP - date of last RUBELLA
  1. ; Return the last recorded RUBELLA:
  1. ; - V Immunization: 3,4,6,38,94
  1. ;
  1. ; Input:
  1. ; APCLPDFN - Patient DFN
  1. ; APCLBD - beginning date to begin search for value - if blank, default is DOB
  1. ; APCLED - ending date of search - if blank, default is DT
  1. ; APCLFORM - APCLFORM returned: D - return date only - example 3070801
  1. ; A - return value:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ; Default if blank is D
  1. ; Output:
  1. ; If APCLFORM is blank or APCLFORM is D returns internal fileman date if one found otherwise returns null
  1. ; If APCLFORM is A returns the string:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ;
  1. I $G(APCLPDFN)="" Q ""
  1. I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(APCLPDFN)
  1. I $G(APCLED)="" S APCLED=DT
  1. I $G(APCLFORM)="" S APCLFORM="D"
  1. NEW APCLLAST,APCLVAL,APCLX,R,X,Y,V,E,T,G,APCLY,APCLF
  1. S APCLLAST=""
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"3","IMMUNIZATION",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"94","IMMUNIZATION",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"6","IMMUNIZATION",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"4","IMMUNIZATION",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"38","IMMUNIZATION",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. I APCLFORM="D" Q $P(APCLLAST,U)
  1. Q APCLLAST
  1. ;
  1. LASTEPS(APCLPDFN,APCLBD,APCLED,APCLFORM) ;PEP - date of last EPSDT
  1. ; Return the last recorded EPSDT:
  1. ; - V CPT
  1. ;
  1. ; Input:
  1. ; APCLPDFN - Patient DFN
  1. ; APCLBD - beginning date to begin search for value - if blank, default is DOB
  1. ; APCLED - ending date of search - if blank, default is DT
  1. ; APCLFORM - APCLFORM returned: D - return date only - example 3070801
  1. ; A - return value:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ; Default if blank is D
  1. ; Output:
  1. ; If APCLFORM is blank or APCLFORM is D returns internal fileman date if one found otherwise returns null
  1. ; If APCLFORM is A returns the string:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ;
  1. I $G(APCLPDFN)="" Q ""
  1. I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(APCLPDFN)
  1. I $G(APCLED)="" S APCLED=DT
  1. I $G(APCLFORM)="" S APCLFORM="D"
  1. NEW APCLLAST,APCLVAL,APCLX,R,X,Y,V,E,T,G,APCLY,APCLF
  1. S APCLLAST="",APCLVAL=""
  1. S APCLY=$$AGE^AUPNPAT(APCLPDFN,APCLED)
  1. I APCLY<1 S APCLVAL=$$LASTCPTI^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"99381;99391","A")
  1. D E
  1. I APCLY>0,APCLY<5 S APCLVAL=$$LASTCPTI^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"99382;99392","A")
  1. D E
  1. I APCLY>4,APCLY<12 S APCLVAL=$$LASTCPTI^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"99383;99393","A")
  1. D E
  1. I APCLY>11,APCLY<18 S APCLVAL=$$LASTCPTI^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"99384;99394","A")
  1. D E
  1. I APCLY>17 S APCLVAL=$$LASTCPTI^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"99385;99395","A")
  1. D E
  1. I APCLFORM="D" Q $P(APCLLAST,U)
  1. Q APCLLAST
  1. ;
  1. LASTBRST(APCLPDFN,APCLBD,APCLED,APCLFORM) ;PEP - date of last BREAST EXAM
  1. ; Return the last recorded BREAST EXAM:
  1. ; - V Exam 06
  1. ; - V POV V76.10, V76,12, V76.19
  1. ; - V Procedure 89.36
  1. ; - V CPT G0101
  1. ;
  1. ; Input:
  1. ; APCLPDFN - Patient DFN
  1. ; APCLBD - beginning date to begin search for value - if blank, default is DOB
  1. ; APCLED - ending date of search - if blank, default is DT
  1. ; APCLFORM - APCLFORM returned: D - return date only - example 3070801
  1. ; A - return value:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ; Default if blank is D
  1. ; Output:
  1. ; If APCLFORM is blank or APCLFORM is D returns internal fileman date if one found otherwise returns null
  1. ; If APCLFORM is A returns the string:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ;
  1. I $G(APCLPDFN)="" Q ""
  1. I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(APCLPDFN)
  1. I $G(APCLED)="" S APCLED=DT
  1. I $G(APCLFORM)="" S APCLFORM="D"
  1. NEW APCLLAST,APCLVAL,APCLX,R,X,Y,V,E,T,G,APCLY,APCLF
  1. S APCLLAST=""
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"06","EXAM",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. S APCLVAL=$$LASTDXT^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"APCH BREAST EXAM DXS","A")
  1. D E
  1. ;S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"V76.12","DX",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. ;D E
  1. ;S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"V76.19","DX",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. ;D E
  1. S APCLVAL=$$LASTPRCT^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"APCH BREAST EXAM PROCS","A")
  1. D E
  1. S APCLVAL=$$LASTCPTI^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"G0101","A")
  1. D E
  1. I APCLFORM="D" Q $P(APCLLAST,U)
  1. Q APCLLAST
  1. ;
  1. LASTGLUC(APCLPDFN,APCLBD,APCLED,APCLFORM) ;PEP - date of last GLUCOSE SCREENING
  1. ; Return the last recorded GLUCOSE SCREENING:
  1. ; - V Lab: DM AUDIT GLUCOSE TESTS TAX, APCH SCREENING GLUCOSE LOINC
  1. ; - V POV V77.1
  1. ;
  1. ; Input:
  1. ; APCLPDFN - Patient DFN
  1. ; APCLBD - beginning date to begin search for value - if blank, default is DOB
  1. ; APCLED - ending date of search - if blank, default is DT
  1. ; APCLFORM - APCLFORM returned: D - return date only - example 3070801
  1. ; A - return value:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ; Default if blank is D
  1. ; Output:
  1. ; If APCLFORM is blank or APCLFORM is D returns internal fileman date if one found otherwise returns null
  1. ; If APCLFORM is A returns the string:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ;
  1. I $G(APCLPDFN)="" Q ""
  1. I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(APCLPDFN)
  1. I $G(APCLED)="" S APCLED=DT
  1. I $G(APCLFORM)="" S APCLFORM="D"
  1. NEW APCLLAST,APCLVAL,APCLX,R,X,Y,V,E,T,G,APCLY,APCLF
  1. S APCLLAST=""
  1. S APCLVAL=$$LASTDXT^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"APCH DIABETES SCRN DXS","A")
  1. D E
  1. S APCLVAL=$$LASTLAB^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,,$O(^ATXLAB("B","DM AUDIT GLUCOSE TESTS TAX",0)),,$O(^ATXAX("B","APCH SCREENING GLUCOSE LOINC",0)),"A")
  1. D E
  1. I APCLFORM="D" Q $P(APCLLAST,U)
  1. Q APCLLAST
  1. ;
  1. LASTHEAR(APCLPDFN,APCLBD,APCLED,APCLFORM) ;PEP - date of last HEARING EXAM
  1. ; Return the last recorded HEARING EXAM:
  1. ; - V Exam 17,23,24
  1. ; - V POV V72.11, V72.19
  1. ; - V MEASUREMENT 09, 10
  1. ; - V CPT 92553, 92552, 92555, 92556
  1. ;
  1. ; Input:
  1. ; APCLPDFN - Patient DFN
  1. ; APCLBD - beginning date to begin search for value - if blank, default is DOB
  1. ; APCLED - ending date of search - if blank, default is DT
  1. ; APCLFORM - APCLFORM returned: D - return date only - example 3070801
  1. ; A - return value:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ; Default if blank is D
  1. ; Output:
  1. ; If APCLFORM is blank or APCLFORM is D returns internal fileman date if one found otherwise returns null
  1. ; If APCLFORM is A returns the string:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ;
  1. I $G(APCLPDFN)="" Q ""
  1. I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(APCLPDFN)
  1. I $G(APCLED)="" S APCLED=DT
  1. I $G(APCLFORM)="" S APCLFORM="D"
  1. NEW APCLLAST,APCLVAL,APCLX,R,X,Y,V,E,T,G,APCLY,APCLF
  1. S APCLLAST=""
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"17","EXAM",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"23","EXAM",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"24","EXAM",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"09","MEASUREMENT",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"10","MEASUREMENT",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. D E
  1. ;S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"V72.11","DX",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. ;D E
  1. ;S APCLVAL=$$LASTITEM^APCLAPIU(APCLPDFN,"V72.19","DX",$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"A")
  1. S APCLVAL=$$LASTDXT^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"APCH HEARING EXAM DXS","A")
  1. D E
  1. S APCLVAL=$$LASTDXT^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"APCH HEARING LOSS DXS","A")
  1. D E
  1. S APCLVAL=$$LASTCPTT^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"APCH HEARING SCREEN CPTS","A")
  1. D E
  1. I APCLFORM="D" Q $P(APCLLAST,U)
  1. Q APCLLAST
  1. ;
  1. LASTFOBT(APCLPDFN,APCLBD,APCLED,APCLFORM) ;PEP - date of last FOBT
  1. ; Return the last recorded FOBT:
  1. ; - V Lab: BGP GPRA FOB TESTS, BGP FOBT LOINC CODES
  1. ; - V CPT - BGP FOBT CPTS
  1. ;
  1. ; Input:
  1. ; APCLPDFN - Patient DFN
  1. ; APCLBD - beginning date to begin search for value - if blank, default is DOB
  1. ; APCLED - ending date of search - if blank, default is DT
  1. ; APCLFORM - APCLFORM returned: D - return date only - example 3070801
  1. ; A - return value:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ; Default if blank is D
  1. ; Output:
  1. ; If APCLFORM is blank or APCLFORM is D returns internal fileman date if one found otherwise returns null
  1. ; If APCLFORM is A returns the string:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ;
  1. I $G(APCLPDFN)="" Q ""
  1. I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(APCLPDFN)
  1. I $G(APCLED)="" S APCLED=DT
  1. I $G(APCLFORM)="" S APCLFORM="D"
  1. NEW APCLLAST,APCLVAL,APCLX,R,X,Y,V,E,T,G,APCLY,APCLF
  1. S APCLLAST=""
  1. S APCLVAL=$$LASTLAB^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,,$O(^ATXLAB("B","BGP GPRA FOB TESTS",0)),,$O(^ATXAX("B","BGP FOBT LOINC CODES",0)),"A")
  1. D E
  1. S APCLVAL=$$LASTCPTT^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"BGP FOBT CPTS","A")
  1. D E
  1. I APCLFORM="D" Q $P(APCLLAST,U)
  1. Q APCLLAST
  1. ;
  1. LASTCHOL(APCLPDFN,APCLBD,APCLED,APCLFORM) ;PEP - date of last CHOLESTEROL
  1. ; Return the last recorded CHOLESTEROL:
  1. ; - V Lab: DM AUDIT CHOLESTEROL TAX, "BGP TOTAL CHOLESTEROL LOINC
  1. ; - V CPT - 82465
  1. ;
  1. ; Input:
  1. ; APCLPDFN - Patient DFN
  1. ; APCLBD - beginning date to begin search for value - if blank, default is DOB
  1. ; APCLED - ending date of search - if blank, default is DT
  1. ; APCLFORM - APCLFORM returned: D - return date only - example 3070801
  1. ; A - return value:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ; Default if blank is D
  1. ; Output:
  1. ; If APCLFORM is blank or APCLFORM is D returns internal fileman date if one found otherwise returns null
  1. ; If APCLFORM is A returns the string:
  1. ; date^text of item found^value if appropriate^visit ien^File found in^ien of file found in
  1. ;
  1. I $G(APCLPDFN)="" Q ""
  1. I $G(APCLBD)="" S APCLBD=$$DOB^AUPNPAT(APCLPDFN)
  1. I $G(APCLED)="" S APCLED=DT
  1. I $G(APCLFORM)="" S APCLFORM="D"
  1. NEW APCLLAST,APCLVAL,APCLX,R,X,Y,V,E,T,G,APCLY,APCLF
  1. S APCLLAST=""
  1. S APCLVAL=$$LASTLAB^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,,$O(^ATXLAB("B","DM AUDIT CHOLESTEROL TAX",0)),,$O(^ATXAX("B","BGP TOTAL CHOLESTEROL LOINC",0)),"A")
  1. D E
  1. S APCLVAL=$$LASTCPTI^APCLAPIU(APCLPDFN,$S($P(APCLLAST,U)]"":$P(APCLLAST,U),1:APCLBD),APCLED,"82465","A")
  1. D E
  1. I APCLFORM="D" Q $P(APCLLAST,U)
  1. Q APCLLAST
  1. ;