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

APCDEGP1.m

Go to the documentation of this file.
APCDEGP1 ; IHS/CMI/LAB - GROUP FORM DATA ENTRY ;
 ;;2.0;IHS PCC SUITE;**17**;MAY 14, 2009;Build 18
 ;
START ;
 W !
 K APCDALVR
 D EDITCHKS^APCDEGP2
 I $D(APCDEFLG) D XIT1 Q
 D GENVISIT
 I $G(APCDVSIT)="" D XIT1 Q
 S APCDEGP("VISIT")=APCDVSIT
 D GENPOV
 D GENPRV
 D GENEDUC
 S APCDVDSP=APCDVSIT D ^APCDEWHA K APCDVDSP
 K AUPNTALK,APCDALVR
 D MNEPROC
XIT ;
 ;set visit in the group file for formid ien
 S APCDEGP("FORMS",APCDEGP("VISIT"))=""
 ;call file^dicn to add to multiple of group file
 D ^XBFMK K DIADD,DLAYGO
 S DIC="^APCDGRP("_APCDFID_",11,",DIC(0)="L",DIC("P")=$P(^DD(9001002.3,11,0),U,2),DA(1)=APCDFID,X="`"_APCDEGP("VISIT") D ^DIC
 I Y=-1 W !!,"adding visit to group file entry failed.  Notify supervisor." H 2
 D ^XBFMK K DIADD,DLAYGO
XIT1 K APCDEG1,APCDEG2,APCDEGPR,APCDEGY,APCDTACC,APCDEGX,Y,APCDALVR,APCDEGP("VISIT")
 Q
GENVISIT ;
 S APCDALVR("APCDLOC")=APCDLOC
 S APCDALVR("APCDCAT")=APCDCAT
 S APCDALVR("APCDTYPE")=APCDTYPE
 S APCDALVR("APCDPAT")=APCDPAT
 S APCDALVR("APCDDATE")=APCDDATE
 S APCDALVR("APCDCLN")=APCDCLIN
 ;
 W !,"Creating PCC Visit",!
 S APCDALVR("APCDNOK")=""
 S APCDALVR("APCDPAT")=APCDPAT
 S APCDNOXV="" D ^APCDALV K APCDNOXV
 I $D(APCDALVR("APCDAFLG")),APCDALVR("APCDAFLG")=1 W !,$C(7),"No Visit Selected",! K APCDALVR("APCDAFLG"),APCDVSIT Q
 I $D(APCDALVR("APCDAFLG")),APCDALVR("APCDAFLG")=2 W !,$C(7),"Error encountered when creating visit!," K APCDALVR("APCDAFLG"),APCDVSIT Q
 ;I $D(APCDVSIT("NEW")),$P(^APCCCTRL(DUZ(2),0),U,12)]"",$P($P(^AUPNVSIT(APCDVSIT,0),U),".")'<$P(^APCCCTRL(DUZ(2),0),U,12) S DA=APCDVSIT,DIE="^AUPNVSIT(",DR="1111///R" D ^DIE K DIE,DA,DR
 ;above added for EHR and auditing of visits, d/e created
 Q
GENPOV ;
 W !,"Creating POV Record"
 S APCDALVR("APCDATMP")="[APCDALVR 9000010.07 (ADD)]"
 K APCDEGPR S (APCDEG1,APCDEG2)=0,APCDEGPR="" F  S APCDEG2=$O(^AUPNVPOV("AD",APCDVSIT,APCDEG2)) Q:APCDEG2=""  S APCDEGPR($P(^AUPNVPOV(APCDEG2,0),U))=""
 D POV
 Q
POV ;
 S APCDEGX=0 F  S APCDEGX=$O(^TMP("APCDEGP",$J,"POV",APCDEGX)) Q:APCDEGX=""  D SETPOV
 Q
SETPOV ;
 K APCDALVR("APCDTACC"),APCDALVR("APCDAFLG")
 Q:$D(APCDEGPR($P($P(^TMP("APCDEGP",$J,"POV",APCDEGX,"APCDTPOV"),U),"`",2)))  ;skip if already there
 S APCDALVR("APCDTPOV")=$P(^TMP("APCDEGP",$J,"POV",APCDEGX,"APCDTPOV"),U),APCDALVR("APCDTNQ")=$P(^("APCDTPOV"),U,2),APCDALVR("APCDTFR")=$P(^("APCDTPOV"),U,3)
 S:$D(APCDTACC) APCDALVR("APCDTACC")=DUZ
 D ^APCDALVR
 I $D(APCDALVR("APCDAFLG")) D ERROR
 Q
 ;
GENPRV ;
 W !,"Creating Provider Record"
 K APCDEGPR S (APCDEG1,APCDEG2)=0,APCDEGPR="" F  S APCDEG2=$O(^AUPNVPRV("AD",APCDVSIT,APCDEG2)) Q:APCDEG2=""  S APCDEGPR($P(^AUPNVPRV(APCDEG2,0),U))=""
 D PROV
 Q
MNEPROC ; PROCESS MNEMONICS UNTIL DONE
 S APCDMPQ=0
 F  D GETMNE D:$D(APCDEQX) CHKEHR2^APCDVCHK I APCDMPQ Q
 D GETMNEK
 K APCDMPQ
 Q
 ;
GETMNE ; GET MNEMONIC
 W !
 S DIC="^APCDTKW(",DIC(0)="AEMQ",DIC("A")="MNEMONIC: ",DIC("S")="I $L($P(^(0),U))<5" D ^DIC K DIC("A"),DIC("S")
 I Y<0 D CHECK^APCDEGP0 Q
 S APCDMNE=+Y,APCDMNE("NAME")=$P(Y,U,2)
 K APCDMOD
 D ^APCDEA3
 I $D(APCDEQX) D ^APCDEQX I $D(APCDEQX) S APCDMPQ=1 Q
 I $D(APCDMOD) W !!,"Switching to Modify Mode for ONE Mnemonic ONLY!" S APCDMODE="M",APCDVLK=APCDVSIT D GETMNE K APCDVLK,APCDMOD S APCDMODE="A" W !!,"Switching back to ENTER Mode!" Q
 Q
 ;
GETMNEK ; KILL GETMNE SPECIFIC VARIABLES
 K APCDVSIT,APCDEGX,APCDEQX
 Q
PROV ;
 S APCDEGX=0,APCDALVR("APCDATMP")="[APCDALVR 9000010.06 (ADD)]" F  S APCDEGX=$O(^TMP("APCDEGP",$J,"PROV",APCDEGX)) Q:APCDEGX=""  D SETPROV
 Q
SETPROV ;
 Q:$D(APCDEGPR($P($P(^TMP("APCDEGP",$J,"PROV",APCDEGX,"APCDTPRV"),U),"`",2)))  ;skip if already there
 S APCDALVR("APCDTPRO")=$P(^TMP("APCDEGP",$J,"PROV",APCDEGX,"APCDTPRV"),U),APCDALVR("APCDTPS")=$P(^("APCDTPRV"),U,2)
 D ^APCDALVR
 I $D(APCDALVR("APCDAFLG")) D ERROR
 Q
ERROR ;
 I APCDALVR("APCDAFLG")=1 W !,$C(7),"Template Missing - Notify Site Manager",! Q
 I APCDALVR("APCDAFLG")=2 W !,$C(7),"Error in V File Creation!" Q
 Q
TSKMN ;for queueing when need to queue (call from setprov,setpov)
 K ZTSAVE F APCDEGY="APCDALVR(","DUZ(","DUZ","DT" S ZTSAVE(APCDEGY)=""
 S ZTRTN="ZTSK^APCDEGP2",ZTDESC="PCC GROUP FORM DATA ENTRY",ZTIO="",ZTDTH=DT D ^%ZTLOAD K ZTSK
 K ZTRTN,ZTDESC,ZTIO,ZTDTH,ZTSAVE
 Q
GENEDUC ;
 W !,"Creating Patient Education Record"
 K APCDEGPR S (APCDEG1,APCDEG2)=0,APCDEGPR="" F  S APCDEG2=$O(^AUPNVPED("AD",APCDVSIT,APCDEG2)) Q:APCDEG2=""  S APCDEGPR($P(^AUPNVPED(APCDEG2,0),U))=""
 D EDUC
 Q
EDUC ;
 S APCDEGX=0 F  S APCDEGX=$O(^TMP("APCDEGP",$J,"EDUC",APCDEGX)) Q:APCDEGX=""  D SETEDUC
 Q
SETEDUC ;
 Q:$D(APCDEGPR($P($P(^TMP("APCDEGP",$J,"EDUC",APCDEGX,"APCDTTOP"),U),"`",2)))  ;skip if already there
 K APCDALVR
 S APCDALVR("APCDPAT")=APCDPAT
 S APCDALVR("APCDVSIT")=APCDVSIT
 S APCDALVR("APCDATMP")="[APCDALVR 9000010.16 (ADD)]"
 S APCDALVR("APCDTTOP")=$P(^TMP("APCDEGP",$J,"EDUC",APCDEGX,"APCDTTOP"),U)
 I $P(^TMP("APCDEGP",$J,"EDUC",APCDEGX,"APCDTTOP"),U,3)]"" S APCDALVR("APCDTPRO")="`"_$P(^TMP("APCDEGP",$J,"EDUC",APCDEGX,"APCDTTOP"),U,3)
 S APCDALVR("APCDTLOU")=4
 S APCDALVR("APCDTIG")="G"
 S APCDALVR("APCDTMIN")=$P(^TMP("APCDEGP",$J,"EDUC",APCDEGX,"APCDTTOP"),U,2)
 I $P(^TMP("APCDEGP",$J,"EDUC",APCDEGX,"APCDTTOP"),U,4)]"" S APCDALVR("APCDTOBJ")=$P(^TMP("APCDEGP",$J,"EDUC",APCDEGX,"APCDTTOP"),U,4)
 D ^APCDALVR
 I $D(APCDALVR("APCDAFLG")) D ERROR
 Q