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

APCDFH1.m

Go to the documentation of this file.
APCDFH1 ; IHS/CMI/LAB - LIST MANAGER API'S FOR FAMILY HISTORY AND API FOR REP FACTORS 19 Jun 2008 2:14 PM ; 
 ;;2.0;IHS PCC SUITE;**2,7,10,11,17**;MAY 14, 2009;Build 18
 ;
 ;
FM ;EP - called from d/e input template APCD FP (FP)
 S APCDREPI=DA
 D EN^XBNEW("FM1^APCDFH","APCDREPI;APCDDATE")
 K Y
 Q
FM1 ;EP - called from XBNEW call
 S APCDC=0 K APCDCM
 W !!,"Contraceptive Methods currently recorded:"
 I '$O(^AUPNREP(APCDREPI,2101,0)) S APCDC=0 W "  None recorded" G FM12
 D EN^DDIOL("Contraceptive Method","","!?3"),EN^DDIOL("Start Date","","?43"),EN^DDIOL("End Date","","?63")
 D EN^DDIOL($$REPEAT^XLFSTR("-",75),"","!?3")
 K APCDCM S X=0,APCDC=0 F  S X=$O(^AUPNREP(APCDREPI,2101,X)) Q:X'=+X  D
 .Q:$P($G(^AUPNREP(APCDREPI,2101,X,1)),U,1)]""  ;DELETED
 .S APCDC=APCDC+1,APCDCM(APCDC)=X
 .W !?2,APCDC,")  ",$P(^AUTTCM($P(^AUPNREP(APCDREPI,2101,X,0),U),0),U),?43,$$FMTE^XLFDT($P(^AUPNREP(APCDREPI,2101,X,0),U,2)),?63,$$FMTE^XLFDT($P(^AUPNREP(APCDREPI,2101,X,0),U,3))
 .I $P(^AUPNREP(APCDREPI,2101,X,0),U,6)]"" W !?4,"Comment: ",$P(^AUPNREP(APCDREPI,2101,X,0),U,6)
 .I $P(^AUPNREP(APCDREPI,2101,X,0),U,7)]"" W !?4,"Reason Discontinued: ",$P(^AUPNREP(APCDREPI,2101,X,0),U,7)
FM12 ;
 D EN^DDIOL("","","!!")
 K DIR
 S DIR(0)="S^A:ADD a new Contraceptive Method"_$S(APCDC:";E:Edit an Existing Contraceptive Method;D:Delete an Existing Contraceptive Method",1:"")_";Q:QUIT"
 S DIR("A")="Which action",DIR("B")="Q" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) G FM13
 I Y="Q" G FM13
 S Y="FM"_Y
 D @Y
 G FM1
FM13 ; 
 K Y
 Q
FMA ;
 NEW APCDY,DIC
 S DIC("A")="Enter CONTRACEPTIVE METHOD: ",DIC="^AUTTCM(",DIC(0)="AEMQ" D ^DIC
 I Y=-1 K DIC,Y Q
 S APCDCMI=+Y
 S DIC="^AUPNREP("_APCDREPI_",2101,"
 S DA(1)=APCDREPI
 S DIC("P")=$P(^DD(9000017,2101,0),U,2)
 S X=APCDCMI
 S DIE("NO^")=1
 S DIC("DR")=""
 K DD,D0,DO
 D FILE^DICN
 S DIE("NO^")=1
 S (APCDY,DA)=+Y,DA(1)=APCDREPI,DR=".04///^S X=$S($G(APCDDATE):$$FMTE^XLFDT(APCDDATE),1:$$FMTE^XLFDT(DT))"
 S DIE="^AUPNREP("_APCDREPI_",2101,",DIE("NO^")=1
 D ^DIE
 I $P(^AUTTCM(APCDCMI,0),U,1)'="NONE" D
 .S DA=APCDY,DA(1)=APCDREPI,DR=".02R;.03"
 .S DIE="^AUPNREP("_APCDREPI_",2101,",DIE("NO^")=1
 .D ^DIE
 I $P(^AUTTCM(APCDCMI,0),U,1)="NONE" D
 .S DA=APCDY,DA(1)=APCDREPI,DR=".02;.03"
 .S DIE="^AUPNREP("_APCDREPI_",2101,",DIE("NO^")=1
 .D ^DIE
 S DA=APCDY,DA(1)=APCDREPI,DR=".06"
 S DIE="^AUPNREP("_APCDREPI_",2101,",DIE("NO^")=1
 D ^DIE
 I $P(^AUPNREP(APCDREPI,2101,APCDY,0),U,3)]"" D
 .S DA(1)=APCDREPI,DA=APCDY,DR=".05",DIE="^AUPNREP("_APCDREPI_",2101," D ^DIE
 K DIE,DR,DA
 Q
FME ;
 NEW APCDY
 D EN^DDIOL("","","!")
 K DIR
 S DIR(0)="N^1:"_APCDC_":0",DIR("A")="Edit Which One" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) Q
FME1 K DIC,DA,DR
 NEW N
 S (DA,APCDY)=APCDCM(Y),DA(1)=APCDREPI
 ;is this None?
 S N=""
 I $P(^AUTTCM($P(^AUPNREP(APCDREPI,2101,APCDY,0),U),0),U)="NONE" S N=1
 S DR=".01;.02"_$S('N:"R",1:"")_";.03;.06;.04///^S X=$S($G(APCDDATE):$$FMTE^XLFDT(APCDDATE),1:$$FMTE^XLFDT(DT))"
 S DIE="^AUPNREP("_APCDREPI_",2101,",DIE("NO^")=1
 D ^DIE
 I $P(^AUPNREP(APCDREPI,2101,APCDY,0),U,3)]"" D
 .S DA(1)=APCDREPI,DA=APCDY,DR=".05",DIE="^AUPNREP("_APCDREPI_",2101," D ^DIE
 K DIE,DA,DR
 Q
FMD ;
 D EN^DDIOL("","","!")
 K DIR
 S DIR(0)="N^1:"_APCDC_":0",DIR("A")="Delete Which One" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) Q
 K DIC,DA,DR
 S APCDY=+Y
 S DA=APCDCM(APCDY),DA(1)=APCDREPI,DR="1.01////"_DUZ_";1.02////"_$$NOW^XLFDT_";1.03"
 S DIE="^AUPNREP("_APCDREPI_",2101,"
 D ^DIE
 K DA,DIE,DR
 I $P($G(^AUPNREP(APCDREPI,2101,APCDCM(APCDY),1)),U,3)="O" D
 .S DIE="^AUPNREP("_APCDREPI_",2101,"
 .S DA=APCDCM(APCDY),DA(1)=APCDREPI,DR="1.04R" D ^DIE K DA,DIE
 S DA=APCDCM(APCDY),DA(1)=APCDREPI D MULTOSET^APCDRF
 K DA
 Q
 ;
FMN ;;EP - called from d/e input template APCD FM (FM)
 S APCDREPI=DA
 D EN^XBNEW("FMN1^APCDFH1","APCDREPI;APCDDATE")
 K Y
 Q
FMN1 ;EP - called from XBNEW call
 S APCDRFS="",APCDPARS=""
 I '$D(^AUPNREP(APCDREPI)) S X=$$RFADD^APCDRF(APCDREPI) I 'X W $P(X,U,2) Q
FMN12 ;
 D FM1
 K Y
 Q
EDC ;EP - called from d/e input template APCD EDC (EDC)
 S APCDREPI=DA
 D EN^XBNEW("EDC1^APCDFH1","APCDREPI;APCDDATE")
 K Y
 Q
EDC1 ;EP - called from XBNEW call
 S APCDRFS="",APCDPARS=""
 I '$D(^AUPNREP(APCDREPI)) S X=$$RFADD^APCDRF(APCDREPI) I 'X W $P(X,U,2) Q
EDC11 ;
 S DIE="^AUPNREP(",DA=APCDREPI,DR="[APCD EDC EDIT]" D ^DIE
 K DIE,DA,DR
 K Y
 Q
LMP ;EP - called from d/e input template APCD LMP (LMP)
 S APCDREPI=DA
 D EN^XBNEW("LMP1^APCDFH1","APCDREPI;APCDDATE")
 K Y
 Q
LMP1 ;EP - called from XBNEW call
 S APCDRFS="",APCDPARS=""
 I '$D(^AUPNREP(APCDREPI)) S X=$$RFADD^APCDRF(APCDREPI) I 'X W $P(X,U,2) Q
LMP11 ;
 S DIE="^AUPNREP(",DA=APCDREPI,DR="[APCD LMP EDIT]" D ^DIE
 K DIE,DA,DR
 K Y
 Q
DELETE ;EP
 I 'APCDRCNT D EN^DDIOL("No Family History to Edit",,"!!") H 3 D BACK^APCDFH Q
 D EN^VALM2(XQORNOD(0),"OS")
 I '$D(VALMY) W !,"No FAMILY HISTORY entry selected." Q
 S APCDP=$O(VALMY(0)) I 'APCDP K APCDP,VALMY,XQORNOD W !,"No record selected." D BACK^APCDFH Q
 S (APCDFHI,APCDRELI)=0
 S (X,Y)=0 F  S X=$O(APCDFHA("IDX",X)) Q:X'=+X!(APCDFHI)  I $O(APCDFHA("IDX",X,0))=APCDP S Y=$O(APCDFHA("IDX",X,0)),APCDFHI=$P(APCDFHA("IDX",X,Y),U,1),APCDRELI=$P(APCDFHA("IDX",X,Y),U,2)
 I APCDFHI=0 D  D BACK^APCDFH Q
 .D FULL^VALM1
 .I $D(^AUPNFH("AE",APCDRELI)) W !!,"There are conditions associated with this relation, you cannot delete it." Q
 .W !,"There are no conditions associated with this relation ("_$$VAL^XBDIQ1(9000014.1,APCDRELI,.01),")."
 .S DIR(0)="Y",DIR("A")="Are you sure you want to delete this relation",DIR("B")="N" KILL DA D ^DIR KILL DIR
 .I $D(DIRUT) Q
 .I 'Y Q
 .S DA=APCDRELI,DIK="^AUPNFHR(" D ^DIK
 I '$D(^AUPNFH(APCDFHI,0)) W !,"Not a valid FAMILY HISTORY ENTRY." K APCDP S APCDFHI=0 D BACK^APCDFH Q
 D FULL^VALM1
 W !!
 S DIC="^AUPNFH(",DR=0,DA=APCDFHI
 D EN^DIQ
 W !
 S DIR(0)="Y",DIR("A")="Are you sure you want to delete this entry",DIR("B")="N" KILL DA D ^DIR KILL DIR
 I $D(DIRUT) D BACK^APCDFH Q
 I 'Y D BACK^APCDFH Q
 S DA=APCDFHI,DIK="^AUPNFH(" D ^DIK K DIK,DA
 D BACK^APCDFH
 Q
 ;
HS ;EP - called from protocol
 D FULL^VALM1
 S X="" I DUZ(2),$D(^APCCCTRL(DUZ(2),0))#2 S X=$P(^(0),U,3) I X,$D(^APCHSCTL(X,0)) S X=$P(^APCHSCTL(X,0),U)
 I $D(^DISV(DUZ,"^APCHSCTL(")) S Y=^("^APCHSCTL(") I $D(^APCHSCTL(Y,0)) S X=$P(^(0),U,1)
 S:X="" X="ADULT REGULAR"
 K DIC,DR,DD S DIC("B")=X,DIC="^APCHSCTL(",DIC(0)="AEMQ" D ^DIC K DIC,DA,DD,D0,D1,DQ
 I Y=-1 D PAUSE^APCDPL1,BACK^APCDFH Q
 S APCHSTYP=+Y,APCHSPAT=APCDPAT
 S APCDHDR="PCC Health Summary for "_$P(^DPT(APCHSPAT,0),U)
 D VIEWR^XBLM("EN^APCHS",APCDHDR)
 S (DFN,Y)=APCDPAT D ^AUPNPAT
 K APCHSPAT,APCHSTYP,APCHSTAT,APCHSMTY,AMCHDAYS,AMCHDOB,APCDHDR
 D BACK^APCDFH
 Q
WTPRE ;EP - CALLED FROM INPUT TEMPLATE
 W !!,"Patient documented as premenarchal, If they are no longer premenarchal change Patient Premenarchal field response to 'No.'",!,"You can use either the RF or FP mnemonics to change the value to 'No'.",!
 Q