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

SROESNRA.m

Go to the documentation of this file.
SROESNRA ;BIR/ADM - NURSE REPORT E-SIG UTILITY ; [ 02/20/02  2:35 PM ]
 ;;3.0; Surgery ;**100**;24 Jun 93
 ;
 ;** NOTICE: This routine is part of an implementation of a nationally
 ;**         controlled procedure.  Local modifications to this routine
 ;**         are prohibited.
 ;
MULT ; process multiples
 S X=$P(SRFLD,"^",2),Y=$P(SRFLD,"^",3) I $P(X,";")=0 S:SRS=1 ^TMP("SRNSAVE",$J,SRTN,$P(SRFLD,"^"),0)=$G(^SRF(SRTN,$P(Y,","),0)) Q
 S SRCAT=$P(SRFLD,"^"),SRSUB=$P(SRFLD,"^",2),SRFF=$P(SRSUB,"-",3)
 I SRFF="130.16,3"!(SRFF="130.028,.01")!(SRFF="130.164,.01") Q:'$P($G(^SRF(SRTN,"TIU")),"^",6)
 I SRFF["130.18" Q:'$P($G(^SRF(SRTN,"TIU")),"^",7)
 S SRNP=$P(SRFLD,"^",3),SRN=$P(SRNP,";"),SRP=$P(SRNP,";",2)
 K SRL F I=1:1 S Y=$P(SRN,",",I) Q:Y=""  S SRL(I)=Y,SRL=I
 S SRW=$S($P(SRFF,";",2)["W":1,1:0)
 S SRE=0 F  S SRE=$O(^SRF(SRTN,SRL(1),SRE)) Q:'SRE  D
 .I SRL=2 D
 ..I SRS=1 D
 ...I $P(SRFF,",",2)=.01 S ^TMP("SRNSAVE",$J,SRTN,SRCAT,0)=$G(^SRF(SRTN,SRL(1),0))
 ...S ^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE,0,SRSUB)=$P($G(^SRF(SRTN,SRL(1),SRE,SRL(2))),"^",SRP)
 ..I $P(SRSUB,"-")'["X" S ^TMP("SRNRAD"_SRS,$J,SRTN,SRCAT,SRE,0,SRSUB)=$P($G(^SRF(SRTN,SRL(1),SRE,SRL(2))),"^",SRP)
 .I SRL=3 S SRE1=0 F  S SRE1=$O(^SRF(SRTN,SRL(1),SRE,SRL(2),SRE1)) Q:'SRE1  D
 ..I SRW D  Q
 ...I SRS=1 D
 ....S ^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE,0,SRSUB,0)=$G(^SRF(SRTN,SRL(1),SRE,SRL(2),0))
 ....S ^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE,0,SRSUB,SRE1)=$P($G(^SRF(SRTN,SRL(1),SRE,SRL(2),SRE1,SRL(3))),"^",SRP)
 ...I $P(SRSUB,"-")'["X" S ^TMP("SRNRAD"_SRS,$J,SRTN,SRCAT,SRE,0,SRSUB,SRE1)=$P($G(^SRF(SRTN,SRL(1),SRE,SRL(2),SRE1,SRL(3))),"^",SRP)
 ..I SRS=1 D
 ...I $P(SRFF,",",2)=.01 S ^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE,0,SRSUB)=$G(^SRF(SRTN,SRL(1),SRE,SRL(2),0))
 ...S ^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE,SRE1,SRSUB)=$P($G(^SRF(SRTN,SRL(1),SRE,SRL(2),SRE1,SRL(3))),"^",SRP)
 ..I $P(SRSUB,"-")'["X" S ^TMP("SRNRAD"_SRS,$J,SRTN,SRCAT,SRE,SRE1,SRSUB)=$P($G(^SRF(SRTN,SRL(1),SRE,SRL(2),SRE1,SRL(3))),"^",SRP)
 Q
REVRS ; restore pre-edit data in multiples
 D REMOVE
 S SRCAT="" F  S SRCAT=$O(^TMP("SRNRMULT1",$J,SRTN,SRCAT)) Q:SRCAT=""  D RESTORE
 Q
RESTORE ; enter multiple data saved in ^TMP("SRNSAVE"
 S (SRCNT,SRE)=0 F  S SRE=$O(^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE)) Q:'SRE  S SRE1="" F  S SRE1=$O(^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE,SRE1)) Q:SRE1=""  D
 .S SRSUB="" F  S SRSUB=$O(^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE,SRE1,SRSUB)) Q:SRSUB=""  S SRCNT=SRCNT+1 D FIELD
 Q
FIELD ; restore individual field
 S X=$P(SRSUB,"-",3),SRFILE=$P(X,","),Y=$P(X,",",2),SRFIELD=$P(Y,";"),SRW=$S($P(Y,";",2)["W":1,1:0)
 S:SRCNT=1 SRI="."_$P(SRFILE,".",2) S X=$E($P(SRSUB,"-"),1,2),SRJ=+X D REV^SROESNR1
 S SRNP=$P(SRFLD,"^",3),SRN=$P(SRNP,";"),SRP=$P(SRNP,";",2)
 K SRL F I=1:1 S Y=$P(SRN,",",I) Q:Y=""  S SRL(I)=Y,SRL=I
 I 'SRW S SRVAL=^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE,SRE1,SRSUB)
 K DA,DIE,DR
 I SRL=2,SRVAL'="" D
 .I SRL(1)=13,SRL(2)=2 S ^SRF(SRTN,13,SRE,2)=SRVAL K DA,DIK S DA(1)=SRTN,DA=SRE,DIK="^SRF("_SRTN_",13,",DIK(1)="3" D EN^DIK K DA,DIK Q
 .I SRE1=0,SRFIELD=.01 S ^SRF(SRTN,SRL(1),0)=^TMP("SRNSAVE",$J,SRTN,SRCAT,0)
 .S DA(1)=SRTN,DA=SRE,DIE="^SRF("_SRTN_","_$S(SRL(1):SRL(1),1:""""_SRL(1)_"""")_",",DR=SRFIELD_"////"_SRVAL D ^DIE K DA,DIE,DR
 I SRL=3 D
 .I SRE1=0,SRFIELD=.01,SRVAL'="" S ^SRF(SRTN,SRL(1),SRE,SRL(2),0)=SRVAL Q
 .I SRW D  Q
 ..S ^SRF(SRTN,SRL(1),SRE,SRL(2),0)=$G(^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE,SRE1,SRSUB,0))
 ..S SRLN=0 F  S SRLN=$O(^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE,SRE1,SRSUB,SRLN)) Q:'SRLN  S ^SRF(SRTN,SRL(1),SRE,SRL(2),SRLN,0)=$G(^TMP("SRNSAVE",$J,SRTN,SRCAT,SRE,SRE1,SRSUB,SRLN))
 .I SRVAL'="" S DA(2)=SRTN,DA(1)=SRE,DA=SRE1,DIE="^SRF("_SRTN_","_$S(SRL(1):SRL(1),1:""""_SRL(1)_"""")_","_SRE_","_$S(SRL(2):SRL(2),1:""""_SRL(2)_"""")_",",DR=SRFIELD_"////"_SRVAL D ^DIE K DA,DIE,DR
 Q
REMOVE ; delete edited multiples
 S SRCAT="" F  S SRCAT=$O(^TMP("SRNRMULT1",$J,SRTN,SRCAT)) Q:SRCAT=""  S SRE=$O(^TMP("SRNRMULT1",$J,SRTN,SRCAT,0)) Q:'SRE  S SRE1="",SRE1=$O(^TMP("SRNRMULT1",$J,SRTN,SRCAT,SRE,SRE1)) Q:SRE1=""  D
 .S SRSUB="",SRSUB=$O(^TMP("SRNRMULT1",$J,SRTN,SRCAT,SRE,SRE1,SRSUB))
 .S SRFF=$P(SRSUB,"-",3),SRK=$P(SRFF,","),SRI="."_$P(SRK,".",2),SRJ=1 D REV^SROESNR1
 .S SRNP=$P(SRFLD,"^",3),SRN=$P(SRNP,";"),SRP=$P(SRNP,";",2)
 .K SRL F I=1:1 S Y=$P(SRN,",",I) Q:Y=""  S SRL(I)=Y,SRL=I
 .D DEL
 Q
DEL ; delete all entries from multiple
 K DA,DIK S SRIEN=0 F  S SRIEN=$O(^SRF(SRTN,SRL(1),SRIEN)) Q:'SRIEN  S DA(1)=SRTN,DA=SRIEN,DIK="^SRF("_DA(1)_","_$S(SRL(1):SRL(1),1:""""_SRL(1)_"""")_"," D ^DIK K DA,DIK
 K ^SRF(SRTN,SRL(1))
 Q