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

APCDELAB.m

Go to the documentation of this file.
  1. APCDELAB ; IHS/CMI/LAB - LAB LOG ENTRY ;
  1. ;;2.0;IHS PCC SUITE;**2**;MAY 14, 2009
  1. ;
  1. HDR ;
  1. W:$D(IOF) @IOF
  1. F APCDJ=1:1:5 S APCDX=$P($T(TEXT+APCDJ),";;",2) W !?80-$L(APCDX)\2,APCDX
  1. K APCDJ,APCDX
  1. W !!
  1. D ^APCDEIN
  1. Q:APCDFLG
  1. S APCDPAT="",APCDLAB=1
  1. S APCDLOC="" F D GETLOC Q:APCDLOC="" S APCDTYPE="" F D GETTYPE Q:APCDTYPE="" S APCDCAT="" F D GETCAT Q:APCDCAT="" D RESTOFIT
  1. D EOJ
  1. Q
  1. ;
  1. RESTOFIT S APCDDATE="" F D GETDATE Q:APCDDATE="" S APCDPATE="" F D RDPV Q:APCDPATE="" D PROCESS
  1. Q
  1. ;
  1. RDPV ;
  1. S APCDPATE=""
  1. W !
  1. S DIR(0)="S^1:TEST TYPE;2:PATIENT",DIR("A")="Enter Lab Test Results By" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. Q:Y=""
  1. I $D(DUOUT)!($D(DTOUT)) Q
  1. S Y=$E(Y),APCDPATE=$S(Y=1:"T",Y=2:"P")
  1. Q
  1. GETLOC ; GET LOCATION OF ENCOUNTER
  1. S APCDLOC=""
  1. S DIC="^AUTTLOC(",DIC(0)="AEMQ" D ^DIC K DIC,DA
  1. Q:Y<0
  1. S APCDLOC=+Y
  1. Q
  1. ;
  1. GETTYPE ; GET TYPE OF ENCOUNTER
  1. S APCDTYPE=""
  1. K DTOUT,DUOUT,DIRUT,DIROUT,DIR,DA
  1. S DIR(0)="9000010,.03O",DIR("A")="TYPE" D ^DIR K DIR
  1. I $D(DIRUT) S X="" Q
  1. S APCDTYPE=Y
  1. K DIR,DIRUT,DIROUT,DTOUT,DUOUT
  1. Q
  1. ;
  1. ;
  1. GETCAT ; GET SERVICE CATEGORY
  1. S APCDCAT=""
  1. K DTOUT,DUOUT,DIRUT,DIROUT,DIR,DA
  1. S DIR(0)="9000010,.07O",DIR("A")="SERVICE CATEGORY" D ^DIR K DIR
  1. I $D(DIRUT) S X="" Q
  1. S APCDCAT=Y
  1. K DIR,DIRUT,DIROUT,DTOUT,DUOUT,DA,X,Y
  1. Q
  1. ;
  1. GETDATE ; GET DATE
  1. W ! S APCDDATE="",%DT="AEPX",%DT("A")="Enter VISIT DATE: " D ^%DT
  1. Q:Y<0
  1. S APCDDATE=+Y
  1. K %DT("A")
  1. Q
  1. ;
  1. ;
  1. PROCESS ; PROCESS MNEMONIC
  1. I APCDPATE="P" D LABLOG Q
  1. I APCDPATE="T" D LABTEST Q
  1. Q
  1. ;
  1. GETPAT ; GET PATIENT
  1. D GETPAT^APCDEA
  1. Q:APCDPAT=""
  1. I AUPNDOB]"" S X2=AUPNDOB,X1=APCDDATE D ^%DTC S AUPNDAYS=X ; re-set days of age to visit date-dob
  1. Q
  1. ;
  1. LABLOG ;
  1. S X="LABLOG",DIC="^APCDTKW(",DIC(0)="",DIC("S")="I $L($P(^(0),U))>5" D ^DIC K DIC("B"),DIC("A"),DIC("S")
  1. I Y<0 W !!,$C(7),$C(7),"LAB LOG TEMPLATE MISSING, NOTIFY YOUR SUPERVISOR" Q
  1. S APCDTPLT=+Y,APCDTPLT("NAME")=$P(Y,U,2)
  1. S APCDPAT="" F D GETPAT Q:APCDPAT="" K APCDADD,APCDALVR D ^APCDEA2,GETMNEK
  1. Q
  1. LABTEST ;
  1. S APCDLABT=""
  1. S X="LABTEST",DIC="^APCDTKW(",DIC(0)="",DIC("S")="I $L($P(^(0),U))>3" D ^DIC K DIC
  1. I Y<0 W !!,$C(7),$C(7),"LAB TEST TEMPLATE MISSING, NOTIFY YOUR SUPERVISOR" Q
  1. S APCDTPLT=+Y,APCDTPLT("NAME")=$P(Y,U,2)
  1. S DIC("A")="Enter LAB TEST type: ",DIC="^LAB(60,",DIC(0)="AEMQ" D ^DIC I Y<0 K DIC Q
  1. K DIC S APCDLABT="`"_+Y
  1. S APCDPAT="" F D GETPAT Q:APCDPAT="" K APCDADD,APCDALVR D ^APCDEA2,GETMNEK
  1. Q
  1. GETMNEK ; KILL GETMNE SPECIFIC VARIABLES
  1. K APCDVSIT,APCDPATE
  1. Q
  1. ;
  1. EOJ ; END OF JOB
  1. D ^APCDEKL
  1. K POP,X,Y,DI,DX,DQ,D,DIG,DIH,DIW,DK,DL,DLOUT
  1. K APCDLAB,APCDLABT,APCDPATE
  1. K %DT,%
  1. Q
  1. ;
  1. TEXT ;
  1. ;;PCC Data Entry Module
  1. ;;
  1. ;;**************************
  1. ;;* Lab Log ENTER Mode *
  1. ;;**************************
  1. ;;