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

SDES2EDITCLIN.m

Go to the documentation of this file.
SDES2EDITCLIN ;ALB/BWF,MGD/BLB,BWF,TJB - SDES2 EDIT CLINIC ;JAN 02, 2024
 ;;5.3;Scheduling;**853,857,864,866,871,885,890,893**;Aug 13, 1993;Build 6
 ;;Per VHA Directive 6402, this routine should not be modified
 ;
 Q
 ; Reference to ^DG(40.8 is supported by IA #2295
 ; Reference to ^DG(40.8 is supported by IA #7024
 ;
 ; SDNAME - [TEXT, REQ]  Clinic Name                                    (REQUIRED)
 ; SDABR - [TEXT]  ABBREVIATION
 ; SDPATNAME - [TEXT]  PATIENT FRIENDLY NAME
 ; SDMEETATFAC  - [Y/N]  CLINIC MEETS AT THIS FACILITY? (Default = Y)
 ; SDPATSCHED  - [Y/N, REQ]  ALLOW DIRECT PATIENT SCHEDULING?           (REQUIRED)
 ; SDDISPAPPT  - [Y/N, REQ]  DISPLAY CLIN APPT TO PATIENTS?             (REQUIRED)
 ; SDSERVICE  - [Set of codes, REQ]  SERVICE                            (REQUIRED)
 ; SDNONCOUNT  - [Y/N, REQ]  NON-COUNT CLINIC? (Y OR N)                 (REQUIRED)
 ; SDDIVISION  - [File 40.8]  DIVISION                                  (REQUIRED)
 ; SDAPPTTYP  - [File 409.1]  DEFAULT APPOINTMENT TYPE
 ; SDINPATMED  - [Y/N]  ADMINISTER INPATIENT MEDS?
 ; SDPHONE  - [TEXT]  TELEPHONE
 ; SDREQXRAY  - [Y/N]  REQUIRE X-RAY FILMS?
 ; SDREQPROFILE - [Y/N]  REQUIRE ACTION PROFILES?                       (REQUIRED)
 ; SDNOSHOWLET  - [File 407.5]  NO SHOW LETTER
 ; SDPREAPTLET  - [File 407.5]  PRE-APPOINTMENT LETTER
 ; SDCANLET  - [File 407.5]  CLINIC CANCELLATION LETTER
 ; SDAPTCANLET  - [File 407.5]  APPT. CANCELLATION LETTER
 ; SDINOUTTIME  - [Y/N]  ASK FOR CHECK IN/OUT TIME
 ; SDPROVIDER  - [File 200]  PROVIDER
 ; SDPRACTIONER  - [Y/N]  DEFAULT TO PC PRACTITIONER?
 ; SDDIAG  - [file 80]  DIAGNOSIS
 ; SDWORKLOAD  - [Y/N]  WORKLOAD VALIDATION AT CHK OUT
 ; SDALLOWNOSHW  - [NUM, REQ]  ALLOWABLE CONSECUTIVE NO-SHOWS           (REQUIRED)
 ; SDMAXFUTBOOK  - [NUM, REQ]  MAX # DAYS FOR FUTURE BOOKING            (REQUIRED)
 ; SDNOACCESS  - [Y/N]  PROHIBIT ACCESS TO CLINIC?
 ; SDLOCATION  - [TEXT]  PHYSICAL LOCATION
 ; SDPRINCLINIC  - [File 44]  PRINCIPAL Clinic
 ; SDOVBDAYMAX  - [NUM, REQ]  OVERBOOKS/DAY MAXIMUM                      (REQUIRED)
 ; SDSPECINSTRU  - [TEXT]  SPECIAL INSTRUCTIONS
 ; SDECHECKIN  - [Y/N]  E-CHECKIN ALLOWED                                (REQUIRED)
 ; SDPRECHECKIN  - [Y/N]  PRE-CHECKIN ALLOWED                            (REQUIRED)
 ; SDVARAPTLNG  - [TEXT]  VARIABLE APP'NTMENT LENGTH
 ; PRIAMIS - [NUM, OPT] AMIS Primary Stop Code
 ; CREDITAMIS - [NUM, OPT] AMIS Credit Stop Code
 ; CLINIC HASH - [TEXT] SHA-1 Hash value that the calling app has stored
 ; LENGTH OF APPOINTMENT - APPOINTMENT LENGTH
 ; VETERAN SELF-CANCEL - "Y" for Yes, "N" for No
 ;
 ; SDCONTEXT("ACHERON AUDIT ID") = Up to 40 Character unique ID number. Ex: 11d9dcc6-c6a2-4785-8031-8261576fca37
 ; SDCONTEXT("USER DUZ") = The DUZ of the user taking action in the calling application.
 ; SDCONTEXT("USER SECID") = The SECID of the user taking action in the calling application.
 ; SDCONTEXT("PATIENT DFN") = The DFN/IEN of the target patient from the calling application.
 ; SDCONTEXT("PATIENT ICN") = The ICN of the target patient from the calling application.
 ;
 ;
 ; To delete a single field, set that array element to "@" or ""
 ; SDCLINIC("FIELD NAME")="@" or SDCLINIC("FIELD NAME")=""
 ; SDCLINIC("CLINIC IEN")=CLINIC IEN                IEN of the clinic in file 44 - Hospital location
 ; SDCLINIC("NAME")=CLINIC NAME                     FREE TEXT 2-30 characters (Required)
 ; SDCLINIC("ABBREVIATION")=ABBREVIATION            FREE TEXT 1-7 characters
 ; SDCLINIC("PATIENT FRIENDLY NAME")                FREE TEXT 1-80 characters
 ; SDCLINIC("MEETS AT FACILITY")                    Y/N for (YES/NO) (Required)
 ; SDCLINIC("DIRECT PATIENT SCHEDULING")            Y/N for (YES/NO)
 ; SDCLINIC("DISPLAY APPOINTMENTS")                 Y/N for (YES/NO)
 ; SDCLINIC("SERVICE")                              SET OF CODES (M/S/P/R/N/0)
 ; SDCLINIC("NON-COUNT")                            Y/N for (YES/NO)
 ; SDCLINIC("DIVISION")                             POINTER TO MEDICAL CENTER DIVISION FILE (#40.8)
 ; SDCLINIC("DEFAULT APPOINTMENT TYPE")             POINTER TO APPOINTMENT TYPE FILE (#409.1)
 ; SDCLINIC("ADMIN INPATIENT MEDS")                 'Y' for 'Yes', blank/NULL for 'No'
 ; SDCLINIC("TELEPHONE")                            FREE TEXT 3-13 characters
 ; SDCLINIC("TELEPHONE EXTENSION")                  FREE TEXT 1-26 characters
 ; SDCLINIC("REQUIRE X-RAY")                        'Y' for 'Yes', null for No
 ; SDCLINIC("REQUIRE ACTION PROFILES")              Y/N for (YES/NO)
 ; SDCLINIC("NO-SHOW LETTER")                       LETTER NAME OR IEN POINTER TO LETTER FILE (#407.5)
 ; SDCLINIC("PRE-APPOINTMENT LETTER")               LETTER NAME OR IEN POINTER TO LETTER FILE (#407.5)
 ; SDCLINIC("CLINIC CANCELLATION LETTER")           LETTER NAME OR IEN POINTER TO LETTER FILE (#407.5)
 ; SDCLINIC("APPOINTMENT CANCELLATION LETTER")      LETTER NAME OR IEN POINTER TO LETTER FILE (#407.5)
 ; SDCLINIC("ASK CHECK IN/OUT")                     Y/N for (YES/NO)
 ; SDCLINIC("DEFAULT TO PC PRACTITIONER")           Y/N for (YES/NO)
 ; SDCLINIC("WORKLOAD VALIDATION")                  Y/N for (YES/NO)
 ; SDCLINIC("ALLOWABLE CONSECUTIVE NO-SHOWS")       NUMBER 0-999
 ; SDCLINIC("MAX DAYS FUTURE BOOKING")              NUMBER 11-999
 ; SDCLINIC("PROHIBIT ACCESS TO CLINIC")            'Y' for 'Yes'
 ; SDCLINIC("PHYSICAL LOCATION")                    FREE TEXT (1-25)
 ; SDCLINIC("PRINCIPAL CLINIC")                     POINTER to the Hospital location file (#44)
 ; SDCLINIC("OVERBOOKS/DAY MAX")                    NUMBER 0-9999
 ; SDCLINIC("E-CHECKIN ALLOWED")                    Y/N for (YES/NO)
 ; SDCLINIC("PRE-CHECKIN ALLOWED")                  Y/N for (YES/NO)
 ; SDCLINIC("VARIABLE APPOINTMENT LENGTH")          'Y' - for Variable appointment length, Null for not variable
 ; SDCLINIC("PRIMARY AMIS")                         NUMERIC AMIS CODE (1-999)
 ; SDCLINIC("CREDIT AMIS")                          NUMERIC AMIS CODE (1-999)
 ; SDCLINIC("INCLUDE ON FILE ROOM LISTS")           Y/N for (YES/NO)
 ; SDCLINIC("SCHEDULE ON HOLIDAYS")                 'Y' for 'Yes'
 ; SDCLINIC("LENGTH OF APPOINTMENT")                LENGTH OF APPOINTMENT
 ; SDCLINIC("DISPLAY INCREMENTS PER HOUR")          DISPLAY INCREMENTS PER HOUR
 ; SDCLINIC("CLINIC HASH")                          [TEXT] SHA-1 Hash value that the calling app has stored
 ; SDCLINIC("VETERAN SELF-CANCEL")                  'Y' for 'YES', 'N' for NO
 ;
 ; SDCLINIC("PROVIDER",PROVIDERIEN)=""              - ADD
 ; SDCLINIC("PROVIDER",PROVIDERIEN)="@"             - DELETE
 ; SDCLINIC("PROVIDER",PROVIDERIEN,"DEFAULT")=""    - DEFAULT PROVIDER
 ;
 ; SDCLINIC("DIAGNOSIS",DIAGNOSIS CODE)=""           - ADD
 ; SDCLINIC("DIAGNOSIS",DIAGNOSIS CODE)="@"          - DELETE
 ; SDCLINIC("DIAGNOSIS",DIAGNOSIS CODE,"DEFAULT")="" - DEFAULT DIAGNOSIS
 ;
 ; SDCLINIC("SPECIAL INSTRUCTIONS",NUMBER)="INSTRUCTION ID|@                                              - FOR DELETION
 ; SDCLINIC("SPECIAL INSTRUCTIONS",NUMBER)=" (null value) |SPECIAL INSTRUCTION TEXT UP TO 80 CHARACTERS"  - FOR ADDITION
 ; SDCLINIC("SPECIAL INSTRUCTIONS",NUMBER)="INSTRUCTION ID|SPECIAL INSTRUCTION TEXT UP TO 80 CHARACTERS"  - FOR EDIT
 ;
 ; SDCLINIC("PRIVILEGED USER",USERIEN)="@"          - DELETE
 ; SDCLINIC("PRIVILEGED USER",USERIEN)=""           - ADD
 ;
EDITCLINIC(RESULTS,SDCONTEXT,SDCLINIC) ;
 N ERRORS,SDIEN,CLINRETURN,FILEDATA,VRES,VETSELFCAN
 ; validate context array
 D VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
 I $D(ERRORS) S ERRORS("ClinicUpdate",1)="" D BUILDJSON^SDES2JSON(.RESULTS,.ERRORS) Q
 D VALCLINIEN^SDES2VAL44(.ERRORS,$G(SDCLINIC("CLINIC IEN")),1)
 I $D(ERRORS) S ERRORS("ClinicEdit",1)="" D BUILDJSON^SDES2JSON(.RESULTS,.ERRORS) Q
 ; validate clinic hash
 I $D(SDCLINIC("CLINIC HASH")) D VALCLINICHASH^SDES2VAL44A(.ERRORS,$G(SDCLINIC("CLINIC IEN")),$G(SDCLINIC("CLINIC HASH")))
 I $D(ERRORS) S ERRORS("ClinicEdit",1)="" D BUILDJSON^SDES2JSON(.RESULTS,.ERRORS) Q
 ; validate required fields
 I $D(SDCLINIC("ALLOWABLE CONSECUTIVE NO-SHOWS")) D VALALLOWNOSHOW^SDES2VAL44(.ERRORS,$G(SDCLINIC("ALLOWABLE CONSECUTIVE NO-SHOWS")),.FILEDATA)
 I $D(SDCLINIC("DIRECT PATIENT SCHEDULING")) D VALDIRPATSCHED^SDES2VAL44(.ERRORS,$G(SDCLINIC("DIRECT PATIENT SCHEDULING")),.FILEDATA)
 I $D(SDCLINIC("DISPLAY APPOINTMENTS")) D VALDISPAPPT^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("DIVISION")) D VALDIV^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("E-CHECKIN ALLOWED")) D VALCHECKIN^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("MAX DAYS FUTURE BOOKING")) D VALMAXFUTBOOK^SDES2VAL44(.ERRORS,$G(SDCLINIC("MAX DAYS FUTURE BOOKING")),.FILEDATA)
 I $D(SDCLINIC("NAME")) D VALNAME^SDES2VAL44(.ERRORS,$G(SDCLINIC("NAME")),.FILEDATA)
 I $D(SDCLINIC("NON-COUNT")) D VALNONCOUNT^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("OVERBOOKS/DAY MAX")) D VALOVBDAYMAX^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("PRIMARY AMIS")) D VALPRIMAMIS^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("PRE-CHECKIN ALLOWED")) D VALPRECHECKIN^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("REQUIRE ACTION PROFILES")) D VALPROFILE^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("SERVICE")) D VALSERVICE^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("MEETS AT FACILITY")) D VALMEETATFACIL^SDES2VAL44(.ERRORS,$G(SDCLINIC("MEETS AT FACILITY")),.FILEDATA)
 D VALVETSLFCAN^SDES2VAL44A(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(ERRORS) S ERRORS("ClinicUpdate",1)="" D BUILDJSON^SDES2JSON(.RESULTS,.ERRORS) Q
 ;
 ; validate non-required fields
 I $D(SDCLINIC("PBSPID")) D VALPBSPID^SDES2VAL44(.ERRORS,$G(SDCLINIC("PBSPID")),.FILEDATA)
 I $G(SDCLINIC("LENGTH OF APPOINTMENT"))'="" D VALAPPTLENGTH^SDES2VAL44(.ERRORS,$G(SDCLINIC("LENGTH OF APPOINTMENT")),$G(SDCLINIC("CLINIC IEN")),$G(SDCLINIC("DISPLAY INCREMENTS PER HOUR")),.FILEDATA)
 I $D(SDCLINIC("ABBREVIATION")) D VALABBR^SDES2VAL44(.ERRORS,$G(SDCLINIC("ABBREVIATION")),.FILEDATA)
 I $D(SDCLINIC("ADMIN INPATIENT MEDS")) D VALINPATMED^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("ASK CHECK IN/OUT")) D VALINOUTTIME^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("DEFAULT APPOINTMENT TYPE")) D VALAPPTTYPE^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("PATIENT FRIENDLY NAME")) D VALPATFNAME^SDES2VAL44(.ERRORS,$G(SDCLINIC("PATIENT FRIENDLY NAME")),.FILEDATA)
 I $D(SDCLINIC("TELEPHONE")) D VALPHONE^SDES2VAL44(.ERRORS,$G(SDCLINIC("TELEPHONE")),.FILEDATA)
 I $D(SDCLINIC("TELEPHONE EXTENSION")) D VALPHONEEXT^SDES2VAL44(.ERRORS,$G(SDCLINIC("TELEPHONE EXTENSION")),.FILEDATA)
 I $D(SDCLINIC("REQUIRE X-RAY")) D VALXRAY^SDES2VAL44(.ERRORS,$G(SDCLINIC("REQUIRE X-RAY")),.FILEDATA)
 I $D(SDCLINIC("NO-SHOW LETTER")) D VALNOSHOWLET^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("PRE-APPOINTMENT LETTER")) D VALPREAPTLET^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("CLINIC CANCELLATION LETTER")) D VALCANLET^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("APPOINTMENT CANCELLATION LETTER")) D VALAPTCANLET^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("DEFAULT TO PC PRACTITIONER")) D VALDEFAULTTOPRAC^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("WORKLOAD VALIDATION")) D VALWORKLOAD^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("PROHIBIT ACCESS TO CLINIC")) D VALNOACCESS^SDES2VAL44(.ERRORS,$G(SDCLINIC("PROHIBIT ACCESS TO CLINIC")),.FILEDATA)
 I $D(SDCLINIC("PHYSICAL LOCATION")) D VALLOCATION^SDES2VAL44(.ERRORS,$G(SDCLINIC("PHYSICAL LOCATION")),.FILEDATA)
 I $D(SDCLINIC("PRINCIPAL CLINIC")) D VALPRINCLINIC^SDES2VAL44(.ERRORS,$G(SDCLINIC("PRINCIPAL CLINIC")),.FILEDATA)
 I $D(SDCLINIC("VARIABLE APPOINTMENT LENGTH")) D VALVARAPTLENGTH^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 I $D(SDCLINIC("INCLUDE ON FILE ROOM LISTS")) D VALINCLUDEFROOM^SDES2VAL44(.ERRORS,$G(SDCLINIC("INCLUDE ON FILE ROOM LISTS")),.FILEDATA)
 I $D(SDCLINIC("SCHEDULE ON HOLIDAYS")) D VALSCHEDHOLIDAY^SDES2VAL44(.ERRORS,$G(SDCLINIC("SCHEDULE ON HOLIDAYS")),.FILEDATA)
 ; Credit AMIS
 I $D(SDCLINIC("CREDIT AMIS")) D VALCREDITAMIS^SDES2VAL44(.ERRORS,.SDCLINIC,.FILEDATA)
 ; Conditional amis check
 I $D(SDCLINIC("PRIMARY AMIS")),$D(SDCLINIC("CREDIT AMIS")) D CONDAMISCHECK^SDES2VAL44(.ERRORS,$G(SDCLINIC("PRIMARY AMIS")),$G(SDCLINIC("CREDIT AMIS")))
 ;
 S SDIEN=$G(SDCLINIC("CLINIC IEN"))
 ; validate subfile fields
 I $D(SDCLINIC("DIAGNOSIS")) D VALDIAG^SDES2VAL44A(.ERRORS,.SDCLINIC,.FILEDATA,SDIEN)
 I $D(SDCLINIC("PROVIDER")) D VALPROVIDERS^SDES2VAL44A(.ERRORS,.SDCLINIC,.FILEDATA,SDIEN)
 I $D(SDCLINIC("PRIVILEGED USER")),($G(SDCLINIC("PROHIBIT ACCESS TO CLINIC"))="Y"!($$GET1^DIQ(44,SDIEN,2500,"I")="Y")) D
 .D VALPRIVUSERS^SDES2VAL44A(.ERRORS,.SDCLINIC,.FILEDATA,SDIEN)
 I $D(SDCLINIC("SPECIAL INSTRUCTIONS")) D VALSPECINSTRUCT^SDES2VAL44A(.ERRORS,.SDCLINIC,.FILEDATA,SDIEN)
 I $D(ERRORS) D  Q
 .S ERRORS("ClinicEdit",1)="" D BUILDJSON^SDES2JSON(.RESULTS,.ERRORS) Q
 ;
 D FILECLINDATA(.ERRORS,.FILEDATA,SDIEN)
 ; always re-hash clinic, in case some fields were filed correctly, even if there were errors.
 D ADDHASH2CLIN^SDES2CLINUT(SDIEN)
 I $D(ERRORS) D  Q
 .S ERRORS("ClinicEdit",1)=""
 .D BUILDJSON^SDES2JSON(.RESULTS,.ERRORS) Q
 ;
 S CLINRETURN("ClinicEdit","ID")=SDIEN D BUILDJSON^SDES2JSON(.RESULTS,.CLINRETURN)
 Q
FILECLINDATA(ERRORS,FILEDATA,SDIEN) ;
 N SDIENS,CLINMSG,MESSINC,FDA
 Q:'SDIEN
 S SDIENS=SDIEN_","
 ; required fields
 I '$D(FILEDATA) D ERRLOG^SDES2JSON(.ERRORS,506) Q
 I $D(FILEDATA("NAME")) S FDA(44,SDIENS,.01)=FILEDATA("NAME")
 I $D(FILEDATA("DIRECT PATIENT SCHEDULING")) S FDA(44,SDIENS,61)=FILEDATA("DIRECT PATIENT SCHEDULING")
 I $D(FILEDATA("DISPLAY APPOINTMENTS")) S FDA(44,SDIENS,62)=FILEDATA("DISPLAY APPOINTMENTS")
 I $D(FILEDATA("SERVICE")) S FDA(44,SDIENS,9)=FILEDATA("SERVICE")
 I $D(FILEDATA("NON-COUNT")) S FDA(44,SDIENS,2502)=FILEDATA("NON-COUNT")
 I $D(FILEDATA("DIVISION")) S FDA(44,SDIENS,3.5)=FILEDATA("DIVISION")
 I $D(FILEDATA("PRIMARY AMIS")) S FDA(44,SDIENS,8)=FILEDATA("PRIMARY AMIS")
 I $D(FILEDATA("REQUIRE ACTION PROFILES")) S FDA(44,SDIENS,2000.5)=FILEDATA("REQUIRE ACTION PROFILES")
 I $D(FILEDATA("ALLOWABLE CONSECUTIVE NO-SHOWS")) S FDA(44,SDIENS,2001)=FILEDATA("ALLOWABLE CONSECUTIVE NO-SHOWS")
 I $D(FILEDATA("MAX DAYS FUTURE BOOKING")) S FDA(44,SDIENS,2002)=FILEDATA("MAX DAYS FUTURE BOOKING")
 I $D(FILEDATA("OVERBOOKS/DAY MAX")) S FDA(44,SDIENS,1918)=FILEDATA("OVERBOOKS/DAY MAX")
 I $D(FILEDATA("E-CHECKIN ALLOWED")) S FDA(44,SDIENS,20)=FILEDATA("E-CHECKIN ALLOWED")
 I $D(FILEDATA("PRE-CHECKIN ALLOWED")) S FDA(44,SDIENS,21)=FILEDATA("PRE-CHECKIN ALLOWED")
 ; non-required fields
 I $G(FILEDATA("PBSPID"))'="" S FDA(44,SDIENS,200)=$G(FILEDATA("PBSPID"))
 I $G(FILEDATA("LENGTH OF APPOINTMENT"))'="" S FDA(44,SDIENS,1912)=$G(FILEDATA("LENGTH OF APPOINTMENT"))
 I $G(FILEDATA("DISPLAY INCREMENTS PER HOUR"))'="" S FDA(44,SDIENS,1917)=$G(FILEDATA("DISPLAY INCREMENTS PER HOUR"))
 I $D(FILEDATA("ABBREVIATION")) S FDA(44,SDIENS,1)=FILEDATA("ABBREVIATION")
 I $D(FILEDATA("PATIENT FRIENDLY NAME")) S FDA(44,SDIENS,60)=FILEDATA("PATIENT FRIENDLY NAME")
 I $D(FILEDATA("DEFAULT APPOINTMENT TYPE")) S FDA(44,SDIENS,2507)=FILEDATA("DEFAULT APPOINTMENT TYPE")
 I $D(FILEDATA("ADMIN INPATIENT MEDS")) S FDA(44,SDIENS,2802)=FILEDATA("ADMIN INPATIENT MEDS")
 I $D(FILEDATA("MEETS AT FACILITY")) S FDA(44,SDIENS,2504)=FILEDATA("MEETS AT FACILITY")
 I $D(FILEDATA("TELEPHONE")) S FDA(44,SDIENS,99)=FILEDATA("TELEPHONE")
 I $D(FILEDATA("TELEPHONE EXTENSION")) S FDA(44,SDIENS,99.1)=FILEDATA("TELEPHONE EXTENSION")
 I $D(FILEDATA("REQUIRE X-RAY")) S FDA(44,SDIENS,2000)=FILEDATA("REQUIRE X-RAY")
 I $D(FILEDATA("NO-SHOW LETTER")) S FDA(44,SDIENS,2508)=FILEDATA("NO-SHOW LETTER")
 I $D(FILEDATA("PRE-APPOINTMENT LETTER")) S FDA(44,SDIENS,2509)=FILEDATA("PRE-APPOINTMENT LETTER")
 I $D(FILEDATA("CLINIC CANCELLATION LETTER")) S FDA(44,SDIENS,2510)=FILEDATA("CLINIC CANCELLATION LETTER")
 I $D(FILEDATA("APPOINTMENT CANCELLATION LETTER")) S FDA(44,SDIENS,2511)=FILEDATA("APPOINTMENT CANCELLATION LETTER")
 I $D(FILEDATA("ASK CHECK IN/OUT")) S FDA(44,SDIENS,24)=FILEDATA("ASK CHECK IN/OUT")
 I $D(FILEDATA("DEFAULT TO PC PRACTITIONER")) S FDA(44,SDIENS,2801)=FILEDATA("DEFAULT TO PC PRACTITIONER")
 I $D(FILEDATA("WORKLOAD VALIDATION")) S FDA(44,SDIENS,30)=FILEDATA("WORKLOAD VALIDATION")
 I $D(FILEDATA("PROHIBIT ACCESS TO CLINIC")) S FDA(44,SDIENS,2500)=FILEDATA("PROHIBIT ACCESS TO CLINIC")
 I $D(FILEDATA("PHYSICAL LOCATION")) S FDA(44,SDIENS,10)=FILEDATA("PHYSICAL LOCATION")
 I $D(FILEDATA("PRINCIPAL CLINIC")) S FDA(44,SDIENS,1916)=FILEDATA("PRINCIPAL CLINIC")
 I $D(FILEDATA("VARIABLE APPOINTMENT LENGTH")) S FDA(44,SDIENS,1913)=FILEDATA("VARIABLE APPOINTMENT LENGTH")
 I $D(FILEDATA("CREDIT AMIS")) S FDA(44,SDIENS,2503)=FILEDATA("CREDIT AMIS")
 I $D(FILEDATA("INCLUDE ON FILE ROOM LISTS")) S FDA(44,SDIENS,2502.5)=$G(FILEDATA("INCLUDE ON FILE ROOM LISTS"))
 I $D(FILEDATA("SCHEDULE ON HOLIDAYS")) S FDA(44,SDIENS,1918.5)=$G(FILEDATA("SCHEDULE ON HOLIDAYS"))
 I $D(FILEDATA("VETERAN SELF-CANCEL")) S FDA(44,SDIENS,63)=$G(FILEDATA("VETERAN SELF-CANCEL"))
 I $D(FDA) D
 .D FILE^DIE(,"FDA","CLINMSG") K FDA
 .I $D(CLINMSG) D
 ..F MESSINC=1:1:$G(CLINMSG("DIERR")) D ERRLOG^SDES2JSON(.ERRORS,52,$G(CLINMSG("DIERR",MESSINC,"TEXT",1)))
 ; Save subfile entries
 I $D(FILEDATA("PROVIDER")) D SAVEPROVIDERS^SDES2CLINUT(.ERRORS,.FILEDATA,SDIEN)
 I $D(FILEDATA("DIAGNOSIS")) D SAVEDIAG^SDES2CLINUT(.ERRORS,.FILEDATA,SDIEN)
 I $D(FILEDATA("SPECIAL INSTRUCTIONS")) D SAVEINSTRUCT^SDES2CLINUT(.ERRORS,.FILEDATA,SDIEN)
 I $D(FILEDATA("PRIVILEGED USER")) D SAVEPRIVUSERS^SDES2CLINUT(.ERRORS,.FILEDATA,SDIEN)
 Q