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

ACMADDM1.m

Go to the documentation of this file.
ACMADDM1 ; IHS/TUCSON/TMJ - CONTINUATION OF ADD IHS DM REGISTER ; [ 07/07/1999  4:00 PM ]
 ;;2.0;ACM CASE MANAGEMENT SYSTEM;*1*;JAN 10, 1996
 ;This routine allows the user to conver existing register data
 ;to IHS standard data.
 ;ROUTINE IS CALLED FROM ACMADDM AND ENTERED VIA TAG CDIAG OR CCOMP
 Q
 ;
CDIAG ;EP;CONVERTS USER DIAGNOSES TO IHS STANDARD DIAGNOSES
 W !,"I will now check your patient's diagnoses against the IHS standards:"
SETD ;FINDS STANDARD DIAGNOSIS AND PUT IN ^TMP($J,"STD"   
 K ACME S (ACMDIR,ACME)="" F I=1:1 S ACME=$T(DIAG+I^ACMRGA01) Q:ACME["*"  S ACME=$P(ACME,";;",3),ACMD="",ACMD=$O(^ACM(44.1,"B",ACME,ACMD)),^TMP($J,"STD",ACMD)=ACME,ACMDIR=ACMDIR_I_":"_ACME_";"
 S ACMDIR=ACMDIR_I_":DELETE ENTIRELY;"
 S ACMDIR=ACMDIR_(I+1)_":LEAVE AS IS"
 ;
FINDD ;FINDS REGISTER DIAGNOSIS AND PUT IN ^TMP($J,"REG"
 S ACME="" F I=1:1 S ACME=$O(^ACM(44,"E",ACMRG,ACME)) Q:ACME=""  S ACMD=$P(^ACM(44,ACME,0),U,1) I '$D(^TMP($J,"STD",ACMD)) S:'$D(^TMP($J,"REG",ACMD)) ^TMP($J,"REG",ACMD)="" S ^TMP($J,"REG",ACMD,ACME)=ACME_U_ACMD_U_$P(^ACM(44.1,ACMD,0),U,1)
 S ACMD="",ACMQ=0 F  S ACMD=$O(^TMP($J,"REG",ACMD)) Q:ACMD=""  D MATCHD Q:ACMQ
 Q:ACMQ
 D:$D(^TMP($J,"REG")) DIRYND
 D END
 Q
DIRYND S DIR(0)="YO",DIR("A")="Are you ready to change your patient's diagnoses to the new diagnoses",DIR("B")="YES"
 W ! D ^DIR K DIR Q:Y=0!(Y["^")  I Y=1 D CHGD
 Q
CHGD ;LOOPS AND CHANGES DIAGNOSES TO NEW VALUES
 W !,"Changing diagnosis..." S ACMD="" F  S ACMD=$O(^TMP($J,"REG",ACMD)) Q:ACMD=""  D CHGD1
 Q
CHGD1 Q:^TMP($J,"REG",ACMD)="LEAVE AS IS"
 I ^TMP($J,"REG",ACMD)="DELETE ENTIRELY" D CHGDD Q
 S ACME="" F  S ACME=$O(^TMP($J,"REG",ACMD,ACME)) Q:ACME=""  S DIE="^ACM(44,",DA=ACME,DR=".01///^S X=^TMP($J,""REG"",ACMD);.04///^S X=ACMRG" D ^DIE K DA,DR W "."
 K ^ACM(44,"AC") S DIK="^ACM(44,",DIK(1)=".04^AC" D ENALL^DIK K DIK
 Q
 ;
CHGDD ;
 S ACMX=0 F  S ACMX=$O(^ACM(44,"B",ACMD,ACMX)) Q:+ACMX=0  S DA=ACMX,DIK="^ACM(44," D ^DIK K DIK,DA W "."
 S DIK="^ACM(44.1,"_ACMD_",""RG"",",DA(1)=ACMD,DA=ACMRG D ^DIK K DA,DA(1),DIK
 I '$D(^ACM(44.1,ACMD,"RG","B")) S DIK="^ACM(44.1,",DA=ACMD D ^DIK K DA,DIK
 Q
MATCHD ;
 W !,"Choose a new diagnosis from the list below:",!
 W !,"for your diagnosis:  ",$P(^ACM(44.1,ACMD,0),U,1)
 S DIR(0)="S^"_ACMDIR,DIR("A")="Choose a Diagnosis: " D ^DIR
 I Y="" S ^TMP($J,"REG",ACMD)="LEAVE AS IS" Q
 I Y["^" S ACMQ=1 Q
 S ^TMP($J,"REG",ACMD)=Y(0) Q
 Q
 ;
CCOMP ;EP;CONVERTS USER COMPLICATIONS TO IHS STANDARD COMPLICATIONS
 W !,"I will now check your patient's complications against the IHS standards:"
 ;
SETC ;FINDS STANDARD COMPLICATIONS AND PUT IN ^TMP($J,"STD"   
 K ACME S (ACMDIR,ACME)="" F I=1:1 S ACME=$T(COMP+I^ACMRGA01) Q:ACME["*"  S ACME=$P(ACME,";;",3),ACMD="",ACMD=$O(^ACM(42.1,"B",ACME,ACMD)),^TMP($J,"STD",ACMD)=ACME,ACMDIR=ACMDIR_I_":"_ACME_";"
 S ACMDIR=ACMDIR_I_":DELETE ENTIRELY;"
 S ACMDIR=ACMDIR_(I+1)_":LEAVE AS IS"
 ;
FINDC ;FINDS REGISTER COMPLICATION AND PUT IN ^TMP($J,"REG"
 S ACME="" F I=1:1 S ACME=$O(^ACM(42,"E",ACMRG,ACME)) Q:ACME=""  S ACMD=$P(^ACM(42,ACME,0),U,1) I '$D(^TMP($J,"STD",ACMD)) S:'$D(^TMP($J,"REG",ACMD)) ^TMP($J,"REG",ACMD)="" S ^TMP($J,"REG",ACMD,ACME)=ACME_U_ACMD_U_$P(^ACM(42.1,ACMD,0),U,1)
 S ACMD="",ACMQ=0 F  S ACMD=$O(^TMP($J,"REG",ACMD)) Q:ACMD=""  D MATCHC Q:ACMQ
 Q:ACMQ
 D:$D(^TMP($J,"REG")) DIRYNC
 D END
 Q
DIRYNC S DIR(0)="YO",DIR("A")="Are you ready to change your patient's complications to the new complications",DIR("B")="YES"
 W ! D ^DIR K DIR Q:Y=0!(Y["^")  I Y=1 D CHGC
 Q
 ;
CHGC ;LOOPS AND CHANGES COMPLICATIONS TO NEW VALUES
 W !,"Changing complication..." S ACMD="" F  S ACMD=$O(^TMP($J,"REG",ACMD)) Q:ACMD=""  D CHGC1
 Q
CHGC1 Q:^TMP($J,"REG",ACMD)="LEAVE AS IS"
 I ^TMP($J,"REG",ACMD)="DELETE ENTIRELY" D CHGCD Q
 S ACME="" F  S ACME=$O(^TMP($J,"REG",ACMD,ACME)) Q:ACME=""  S DIE="^ACM(42,",DA=ACME,DR=".01///^S X=^TMP($J,""REG"",ACMD);.04///^S X=ACMRG" D ^DIE K DA,DR W "."
 K ^ACM(42,"AC") S DIK="^ACM(42,",DIK(1)=".04^AC" D ENALL^DIK K DIK
 Q
 ;
CHGCD ;
 S ACMX=0 F  S ACMX=$O(^ACM(42,"B",ACMD,ACMX)) Q:+ACMX=0  S DA=ACMX,DIK="^ACM(42," D ^DIK K DIK,DA W "."
 S DIK="^ACM(42.1,"_ACMD_",""RG"",",DA(1)=ACMD,DA=ACMRG D ^DIK K DA,DA(1),DIK
 I '$D(^ACM(42.1,ACMD,"RG","B")) S DIK="^ACM(42.1,",DA=ACMD D ^DIK K DA,DIK
 Q
MATCHC ;MATCHES COMPLICATION TO STD
 W !,"Choose a new complication from the list below:",!
 W !,"for your complication:  ",$P(^ACM(42.1,ACMD,0),U,1)
 S DIR(0)="S^"_ACMDIR,DIR("A")="Choose a Complication: " D ^DIR
 I Y="" S ^TMP($J,"REG",ACMD)="LEAVE AS IS" Q
 I Y["^" S ACMQ=1 Q
 S ^TMP($J,"REG",ACMD)=Y(0) Q
 Q
 ;
END ;CLEANUP IHS/OHPRD/TMJ Patch #1 - Removed Kill ACMQ
 K ^TMP($J,"REG"),^TMP($J,"STD"),ACMD,ACMDIR,ACME,DA,DIE,DIR,DR,I
 Q