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

PXRHS04.m

Go to the documentation of this file.
PXRHS04 ; SLC/SBW - PCE Visit Skin Test Data Extract ;Apr 09, 2018@11:14
 ;;1.0;PCE PATIENT CARE ENCOUNTER;**13,206,217**;Aug 12, 1996;Build 134
SKIN(DFN) ; Control branching
 ;INPUT  : DFN      - Pointer to PATIENT file (#2)
 ;OUTPUT :
 ;  Data from V SKIN TEST (9000010.12) file
 ;  ^TMP("PXS,$J,SKIN,InvDt,IFN,0) = SKIN TEST [E;.01]
 ;     ^ EVENT DATE/TIME or VISIT/ADMIT DATE&TIME [I;1201 or .03]
 ;     ^ RESULTS CODE [I;.04] ^ RESULTS [E;.04] ^ READING [E;.05]
 ;     ^ DATE READ [I;.06] ^ ORDERING PROVIDER [E;1202]
 ;     ^ ENCOUNTER PROVIDER [E;1204]
 ;  ^TMP("PXS",$J,SKIN,InvDt,IFN,1) = ^ HOSPITAL LOCATION [E;9000010;.22]
 ;     ^ HOSP. LOC. ABBREVIATION [E;44;1]
 ;     ^ LOC OF ENCOUNTER [E;9000010;.06] ^ OUTSIDE LOC [E;9000010;2101]
 ;  ^TMP("PXS",$J,SKIN,InvDt,IFN,"P") = PLACEMENT HOSPITAL LOCATION [E;9000010;.22]
 ;     ^ PLACE. HOSP. LOC. ABBREVIATION [E;44;1]
 ;     ^ PLACE. LOC OF ENCOUNTER [E;9000010;.06] ^ PLACE. OUTSIDE LOC [E;9000010;2101]
 ;     ^ PLACE. DATA SOURCE
 ;  ^TMP("PXS",$J,SKIN,InvDt,IFN,"COM") = PLACEMENT COMMENTS [E;81101]
 ;  ^TMP("PXS",$J,SKIN,InvDt,IFN,"S") = DATA SOURCE [E;81203]
 ;
 ;   [] = [I(nternal)/E(xternal); Optional file #; Record #]
 ;   Subscripts:
 ;     SKIN  - Skin Test name
 ;     InvDt - Inverse FileMan date of DATE OF event or visit
 ;     IFN   - Internal Record #
 ;
 Q:$G(DFN)']""!'$D(^AUPNVSK("AA",DFN))
 N PXSK,PXIVD,PXIFN,IHSDATE
 N PXPLACEIEN,PXPLACE12,PXPLACEVST,PVDATA,PSOURCE
 S IHSDATE=9999999-$$HSDATE^PXRHS01
 K ^TMP("PXS",$J)
 S PXSK=""
 F  S PXSK=$O(^AUPNVSK("AA",DFN,PXSK)) Q:PXSK=""  D
 . S PXIVD=0
 . F  S PXIVD=$O(^AUPNVSK("AA",DFN,PXSK,PXIVD)) Q:PXIVD'>0  Q:PXIVD>IHSDATE  D
 . . S PXIFN=0
 . . F  S PXIFN=$O(^AUPNVSK("AA",DFN,PXSK,PXIVD,PXIFN)) Q:PXIFN'>0  D
 . . . N DIC,DIQ,DR,DA,REC,VDATA,SKIN,SKDT,RESULTC,RESULT,READING,RDT
 . . . N OPROV,EPROV,HLOC,HLOCABB,SOURCE,IDT,COMMENT,PXSKIEN
 . . . S (PXPLACEIEN,PXPLACE12,PXPLACEVST)=""
 . . . ; Filter out placement entries
 . . . I $D(^AUPNVSK("APT",PXIFN)) Q
 . . . S DIC=9000010.12,DA=PXIFN,DIQ="REC(",DIQ(0)="IE"
 . . . S DR=".01;.03;.04;.05;.06;1201;1202;1204;1208;81203;81101"
 . . . D EN^DIQ1
 . . . Q:'$D(REC)
 . . . S VDATA=$$GETVDATA^PXRHS03(+REC(9000010.12,DA,.03,"I"))
 . . . I REC(9000010.12,DA,1208,"I") D
 . . . . S PXPLACEIEN=REC(9000010.12,DA,1208,"I")
 . . . . S PXPLACE12=$G(^AUPNVSK(PXPLACEIEN,12))
 . . . . S PXPLACEVST=$P($G(^AUPNVSK(PXPLACEIEN,0)),U,3)
 . . . S SKIN=REC(9000010.12,DA,.01,"E")  ;+ORIG
 . . . S PXSKIEN=REC(9000010.12,DA,.01,"I")  ;get SKIN TEST IEN
 . . . ;replace Name with PRINT NAME for National records
 . . . I $P($G(^AUTTSK(+PXSKIEN,12)),U)]"" S SKIN=$P(^AUTTSK(+PXSKIEN,12),U)
 . . . I $L(SKIN)>11 D  ;name longer than 11 characters
 . . . . S SKIN=$E(SKIN,1,10)_"*"  ;truncate
 . . . S SKDT=REC(9000010.12,DA,1201,"I")
 . . . S:SKDT']"" SKDT=$P(VDATA,U)
 . . . I PXPLACEIEN D
 . . . . S SKDT=$P(PXPLACE12,U,1)
 . . . . I 'SKDT S SKDT=$P($G(^AUPNVSIT(+PXPLACEVST,0)),U,1)
 . . . S IDT=9999999-SKDT
 . . . S RESULTC=REC(9000010.12,DA,.04,"I")
 . . . S RESULT=REC(9000010.12,DA,.04,"E")
 . . . S READING=REC(9000010.12,DA,.05,"E")
 . . . S RDT=REC(9000010.12,DA,.06,"I")
 . . . S OPROV=REC(9000010.12,DA,1202,"E")
 . . . S EPROV=REC(9000010.12,DA,1204,"E")
 . . . S HLOC=$P(VDATA,U,5)
 . . . S HLOCABB=$P(VDATA,U,6)
 . . . S SOURCE=REC(9000010.12,DA,81203,"E")
 . . . S COMMENT=REC(9000010.12,DA,81101,"E")
 . . . I PXPLACEIEN D
 . . . . S OPROV=$P(PXPLACE12,U,2)
 . . . . S OPROV=$P($G(^VA(200,+OPROV,0)),U,1)
 . . . . S EPROV=$P(PXPLACE12,U,4)
 . . . . S EPROV=$P($G(^VA(200,+EPROV,0)),U,1)
 . . . . S COMMENT=$G(^AUPNVSK(PXPLACEIEN,811))
 . . . . S PSOURCE=$P($G(^AUPNVSK(PXPLACEIEN,812)),U,3)
 . . . . S PSOURCE=$P($G(^PX(839.7,+PSOURCE,0)),U,1)
 . . . . S PVDATA=$$GETVDATA^PXRHS03(+PXPLACEVST)
 . . . . S ^TMP("PXS",$J,SKIN,IDT,DA,"P")=$P(PVDATA,U,5)_U_$P(PVDATA,U,6)_U_$P(PVDATA,U,2)_U_$P(PVDATA,U,4)_U_PSOURCE
 . . . S ^TMP("PXS",$J,SKIN,IDT,DA,0)=SKIN_U_SKDT_U_RESULTC_U_RESULT_U_READING_U_RDT_U_OPROV_U_EPROV
 . . . S ^TMP("PXS",$J,SKIN,IDT,DA,1)=HLOC_U_HLOCABB_U_$P(VDATA,U,2)_U_$P(VDATA,U,4)
 . . . S ^TMP("PXS",$J,SKIN,IDT,DA,"S")=SOURCE
 . . . S ^TMP("PXS",$J,SKIN,IDT,DA,"COM")=COMMENT
 Q