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

BCHUADD1.m

Go to the documentation of this file.
  1. BCHUADD1 ; IHS/CMI/LAB - NO DESCRIPTION PROVIDED ;
  1. ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
  1. ;IHS/CMI/LAB - fixed dir call to allow 1-30 characters
  1. ;
  1. ;
  1. GETPAT ;EP
  1. W:$D(IOF) @IOF W !!!!!?15,"****** P A T I E N T I N F O R M A T I O N ******",!!
  1. W !,"If this encounter involved a particular patient, please enter the patient's",!,"chart # or name now. If this is not a single patient encounter,",!,"but a group encounter or an Non-Patient encounter, simply HIT the"
  1. W !,"ENTER key to exit back and Enter N for All Other Activities.",!
  1. W !,"Please enter the patient information now.",!
  1. S DFN=""
  1. S DIR(0)="FO^1:30",DIR("A")="Enter PATIENT NAME or CHART #"
  1. S DIR("?",1)=" To find a patient, you can enter the patient's chart number;"
  1. S DIR("?",2)=" lastname,firstname; SSN; or DOB."
  1. S DIR("?",3)=" "
  1. S DIR("?",4)=" If the patient cannot be found in the Patient Registration"
  1. S DIR("?",5)=" database and you would like to capture demographic information"
  1. S DIR("?",6)=" for this patient into the CHR database, answer NO when asked"
  1. S DIR("?",7)=" if you would like to try another lookup. You will then be"
  1. S DIR("?",8)=" given the opportunity to capture the patient's demographic"
  1. S DIR("?",9)=" data on the following screen."
  1. S DIR("?",10)=""
  1. S DIR("?",11)=" Registered patient demographic data can only be edited via the"
  1. S DIR("?")=" Patient Registration system."
  1. D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I X="" W !!,"No Patient entered. Required " G ASK
  1. I $D(DIRUT) W !,"No patient entered!! - Required." G ASK
  1. S (X,BCHNAME)=Y,DIC="^AUPNPAT(",DIC(0)="MQE" D ^DIC K DIC
  1. ;I X="" W !!,"No Patient entered. If this is not a patient related encounter use the ",!,"'All Other Activities option'.",! D PAUSE^BCHUTIL1 Q
  1. I Y=-1 D NOREG Q
  1. W !?25,"Ok" S %=1 D YN^DICN I %'=1 W !!,"Try again.",! G GETPAT
  1. S DFN=+Y D DIRX^BCHUADD S BCHF=".04",BCHV=""
  1. S DIE="^BCHR(",DA=BCHR,DR=".04///`"_DFN D ^DIE K DA,DIE,DR
  1. I $D(Y) W !!,"PATIENT NOT VALID! TRY AGAIN" K Y G GETPAT
  1. Q
  1. ;
  1. NOREG ;
  1. W !,"That patient cannot be found in the Registration database."
  1. W ! S DIR(0)="Y",DIR("A")="Do you want to try to lookup the patient in registration again",DIR("B")="Y" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) W !,"Exiting..." S BCHQUIT=1 Q
  1. I Y G GETPAT
  1. W !!,"Please select a patient from the Non-Registered Patient Database",!,"or enter a new Non-Registered Patient.",!
  1. S DIC("B")=BCHNAME S DIC="^BCHRPAT(",DIC(0)="AEMQL" D ^DIC K DIC
  1. ;SCREENMAN CALL
  1. ;S DIE="^BCHR(",DA=BCHR,DR="1101///"_BCHNAME D ^DIE K DIE,DR,DA,DIU,DIV,DIW
  1. ;S DA=BCHR,DDSFILE=90002,DR="[BCH ENTER PATIENT DATA]" D ^DDS
  1. ;K DR,DA,DDSFILE,DIC,DIE
  1. ;I $D(DIMSG) W !!,"ERROR IN SCREENMAN FORM!! ***NOTIFY PROGRAMMER***" S BCHQUIT=1 K DIMSG Q
  1. ;Q:$G(^BCHR(BCHR,11))]""
  1. I Y=-1 W !!,"A patient is Required" G ASK
  1. S BCHNRPAT=+Y
  1. I $P(Y,U,3) D I 1
  1. .W !!,"Please review and update if necessary this non-registered patient's data:"
  1. .S DIE="^BCHRPAT(",DR="[BCH EDIT NON REG PT]",DA=BCHNRPAT D ^DIE K DA,DIE,DR
  1. E D
  1. .W !!,"You now have the opportunity to update this patient's demographic data,"
  1. .W !,"(DOB, Gender, Community of Residene, Tribe)",!
  1. .S DIR(0)="Y",DIR("A")="Do you want to update this patient's demographic information?",DIR("B")="N" KILL DA D ^DIR KILL DIR
  1. .I 'Y Q
  1. .I $D(DIRUT) Q
  1. .S DIE="^BCHRPAT(",DR="[BCH EDIT NON REG PT]",DA=BCHNRPAT D ^DIE K DA,DIE,DR
  1. ;UPDATE CHR RECORD FILE
  1. S DA=BCHR,DIE="^BCHR(",DR="1112////"_BCHNRPAT D ^DIE K DA,DIE,DR
  1. Q
  1. ASK ;
  1. S DIR(0)="Y",DIR("A")="Do you wish to EXIT and DELETE this record",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) S BCHQUIT=1 Q
  1. I Y S BCHQUIT=1 Q
  1. G GETPAT
  1. ;
  1. RECCHECK ;EP
  1. K BCHOKAY,BCHERROR
  1. S BCHR0=^BCHR(BCHR,0)
  1. I $P(BCHR0,U,2)="" W !,"PROGRAM Missing! " S BCHERROR=1
  1. I $P(BCHR0,U,3)="" W !,"PROVIDER/CHR Missing! " S BCHERROR=1
  1. I $P(BCHR0,U,6)="" W !,"ACTIVITY LOCATION Missing! " S BCHERROR=1
  1. I $P(BCHR0,U,11)="" W !,"TRAVEL TIME Missing!" S BCHERROR=1
  1. I $P(BCHR0,U,12)="" W !,"# SERVED Missing!" S BCHERROR=1
  1. I '$D(^BCHRPROB("AD",BCHR)) W !,"At least one ASSESSMENT/POV is Required and is Missing! " S BCHERROR=1
  1. NEW X,Y
  1. S X=0 F S X=$O(^BCHRPROB("AD",BCHR,X)) Q:X'=+X D
  1. .I $P(^BCHRPROB(X,0),U,1)="" W !,"Assessment Problem code Missing!" S BCHERROR=1
  1. .I $P(^BCHRPROB(X,0),U,4)="" W !,"Service Code for Assessment ",$$VAL^XBDIQ1(90002.01,X,.01)," is Missing!" S BCHERROR=1
  1. .I $P(^BCHRPROB(X,0),U,5)="" W !,"Service Minutes for Assessment ",$$VAL^XBDIQ1(90002.01,X,.01)," is Missing!" S BCHERROR=1
  1. .I $P(^BCHRPROB(X,0),U,6)="" W !,"Narrative for Assessment ",$$VAL^XBDIQ1(90002.01,X,.01)," is Missing!" S BCHERROR=1
  1. I $P(^BCHR(BCHR,0),U,4)="",$P($G(^BCHR(BCHR,11)),U,12)="" G E
  1. I '$P(^BCHR(BCHR,0),U,12) G E ;non patient
  1. I $P(^BCHR(BCHR,0),U,29) G E
  1. I '$O(^BCHR(BCHR,41,0)) W !,"REFERRED TO CHR BY is Missing and is Required! " S BCHERROR=1
  1. I '$O(^BCHR(BCHR,42,0)) W !,"REFERRED BY CHR TO is Missing and is Required! " S BCHERROR=1
  1. E ;do you wish to edit? if not, delete, if yes, go back to edit
  1. Q:'$G(BCHERROR)
  1. S DIR(0)="S^E:Edit the Record and Correct the Error;D:Delete the Record",DIR("A")="Do you wish to",DIR("B")="E" KILL DA D ^DIR KILL DIR
  1. I $D(DIRUT) Q
  1. I $G(BCHUEDT) D EDIT Q
  1. I Y="D" Q
  1. D GETRECD^BCHUADD
  1. G RECCHECK
  1. EDIT ;
  1. I Y="D" D EXITMSG^BCHUADD S BCHRWDEL=1 Q
  1. D 2^BCHUEDT
  1. G RECCHECK
  1. PROTOCOL ;PEP - announce chr record has been added
  1. Q ;NO PCC LINK PER V2.0 SPECS
  1. D SETARRAY
  1. S X=+$O(^ORD(101,"B","BCH CHR RECORD EVENT",0))_";ORD(101,"
  1. D EN^XQOR
  1. K BCHEV ;kill event array
  1. Q
  1. SETARRAY ;set up array for pcc protocol call
  1. S BCHEV("PKG")=$O(^DIC(9.4,"C","BCH","")),BCHPKG=BCHEV("PKG") ;apcdpkg - system wide, required by pcc link
  1. S BCHEV("SITE")=^BCHSITE(DUZ(2),0) ;pass site parameters
  1. S BCHEV("CHR IEN")=BCHR ;record in CHR RECORD FILE
  1. S BCHEV("DATA0")=^BCHR(BCHR,0)
  1. S BCHEV("DATA12")=$G(^BCHR(BCHR,12))
  1. S BCHEV("DATA13")=$G(^BCHR(BCHR,13))
  1. I $P(BCHEV("DATA0"),U,6) S BCHEV("ACTLOC")=^BCHTACTL($P(BCHEV("DATA0"),U,6),0)
  1. S (X,C)=0 F S X=$O(^BCHRPROB("AD",BCHR,X)) Q:X="" D
  1. .Q:'$D(^BCHRPROB(X,0))
  1. .Q:$P(^BCHRPROB(X,0),U)=""
  1. .Q:$P(^BCHRPROB(X,0),U,4)=""
  1. .Q:$P(^BCHRPROB(X,0),U,6)=""
  1. .S C=C+1,BCHEV("POV",C)=^BCHRPROB(X,0),BCHEV("POV",C,"ICD9")=$P(^BCHTPROB($P(^BCHRPROB(X,0),U),0),U,5),BCHEV("POV",C,"SRV")=^BCHTSERV($P(^BCHRPROB(X,0),U,4),0)
  1. S (X,C)=0 F S X=$O(^BCHRPED("AD",BCHR,X)) Q:X="" D
  1. .Q:'$D(^BCHRPED(X,0))
  1. .Q:$P(^BCHRPED(X,0),U)=""
  1. .S C=C+1,BCHEV("EDUC",C)=^BCHRPED(X,0)
  1. K C,X
  1. Q
  1. UPNONREG ;EP
  1. W !!,"Please select a patient from the Non-Registered Patient Database",!,"or enter a new Non-Registered Patient.",!
  1. S DIC="^BCHRPAT(",DIC(0)="AEMQL" D ^DIC K DIC
  1. ;SCREENMAN CALL
  1. ;S DIE="^BCHR(",DA=BCHR,DR="1101///"_BCHNAME D ^DIE K DIE,DR,DA,DIU,DIV,DIW
  1. ;S DA=BCHR,DDSFILE=90002,DR="[BCH ENTER PATIENT DATA]" D ^DDS
  1. ;K DR,DA,DDSFILE,DIC,DIE
  1. ;I $D(DIMSG) W !!,"ERROR IN SCREENMAN FORM!! ***NOTIFY PROGRAMMER***" S BCHQUIT=1 K DIMSG Q
  1. ;Q:$G(^BCHR(BCHR,11))]""
  1. I Y=-1 K DIC,Y Q
  1. S BCHNRPAT=+Y
  1. W !!,"Please review and update if necessary this non-registered patient's data:"
  1. S DIE="^BCHRPAT(",DR="[BCH EDIT NON REG PT]",DA=BCHNRPAT D ^DIE K DA,DIE,DR
  1. Q