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

PXVUTL.m

Go to the documentation of this file.
PXVUTL ;BIR/ADM - SKIN TEST UTILITY ROUTINE ;Dec 20, 2022@13:11:53
 ;;1.0;PCE PATIENT CARE ENCOUNTER;**210,217,233**;Aug 12, 1996;Build 3
 ;
 ; Reference to OVERDL^ORWU in ICR #7388
 ;
HR ; called by AH new style x-ref in V SKIN TEST file
 ; set number of hours between placement and reading of test
 N PXVPLACE,PXVREAD,PXVX,X1,X2,X3
 S X1=$P($G(^AUPNVSK(DA,0)),"^",6) ; DATE READ
 S PXVREAD=$O(^AUPNVSK("APT",DA,0))
 I PXVREAD S X1=$P($G(^AUPNVSK(PXVREAD,0)),"^",6)
 S X2=$P($G(^AUPNVSK(DA,12)),"^") ; EVENT DATE AND TIME
 I X2="" S X2=$P($G(^AUPNVSIT(+$P($G(^AUPNVSK(DA,0)),"^",3),0)),U,1)
 S PXVPLACE=$P($G(^AUPNVSK(DA,12)),"^",8) ; PLACEMENT SKIN TEST
 I PXVPLACE D
 . S X2=$P($G(^AUPNVSK(PXVPLACE,12)),"^")
 . I X2="" S X2=$P($G(^AUPNVSIT(+$P($G(^AUPNVSK(PXVPLACE,0)),"^",3),0)),U,1)
 I X1=""!(X2="") Q
 S X3=2 ; return difference in seconds
 S PXVX=""
 I $G(X1),$L(X1)>7,$G(X2),$L(X2)>7,$G(X2)'>$G(X1) S PXVX=$$FMDIFF^XLFDT(X1,X2,X3)\3600
 I PXVREAD S $P(^AUPNVSK(PXVREAD,12),"^",14)=PXVX Q
 S $P(^AUPNVSK(DA,12),"^",14)=PXVX
 Q
CODSYS ; set logic for AC x-ref on SKIN TEST field to populate CODE SYSTEM multiple
 N PXVCODE,PXVSK,PXVTN
 S PXVCODE=$$CODX(X,DA)
 Q
CODX(PXVSK,PXVTN) ; populate CODE SYSTEM multiple
 N DA,DD,DO,DIC,DR,PXVC,PXVCOD,PXVIEN,PXVM,PXVSYS,X S PXVCODE=0
 S PXVM=0 F  S PXVM=$O(^AUTTSK(PXVSK,3,PXVM)) Q:'PXVM  D
 .S PXVSYS=$P(^AUTTSK(PXVSK,3,PXVM,0),"^") Q:PXVSYS=""  S PXVCODE=1
 .K DA,DD,DO,DIC S DA(1)=PXVTN,DIC="^AUPNVSK(PXVTN,3,",DIC(0)="L",X=PXVSYS D FILE^DICN K DA,DD,DIC,DO,DR S PXVIEN=+Y I PXVIEN'>0 S PXVCODE=0 Q
 .S PXVC=0 F  S PXVC=$O(^AUTTSK(PXVSK,3,PXVM,1,PXVC)) Q:'PXVC  D
 ..S PXVCOD=$P(^AUTTSK(PXVSK,3,PXVM,1,PXVC,0),"^")
 ..S PXVY(9000010.1231,"+1,"_PXVIEN_","_PXVTN_",",.01)=PXVCOD D UPDATE^DIE("","PXVY") K PXVY
 Q PXVCODE
KCODSYS ; kill logic for AC x-ref
 N PXVCODE,PXVTN
 S PXVCODE=$$KCODX(DA)
 Q
KCODX(PXVTN) ;
 N DA,DD,DO,DIC,DR,PXVJ S PXVCODE=0
 S PXVJ=0 F  S PXVJ=$O(^AUPNVSK(PXVTN,3,PXVJ)) Q:'PXVJ  D  S PXVCODE=1
 .S PXVY(9000010.123,PXVJ_","_PXVTN_",",.01)="@" D FILE^DIE("","PXVY")
 Q PXVCODE
 ;
TIME() ; determine if future time
 N PXMAX,PXOVERDL,PXCHECKDT
 S PXCHECKDT=X
 ;
 D
 . N X,Y
 . S PXOVERDL=0
 . D OVERDL^ORWU(.PXOVERDL)  ; get value of ORPARAM OVER DATELINE.  ICR #7388
 . S PXMAX=$$FMADD^XLFDT($$NOW^XLFDT,0,0,1)
 . I PXOVERDL S PXMAX=$$FMADD^XLFDT($$DT^XLFDT,2)
 ;
 Q $S(PXCHECKDT>PXMAX:1,1:0)
 ;