Announcement

Collapse
No announcement yet.

Database Writer Using Javascript w(functions and sequences)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Database Writer Using Javascript w(functions and sequences)

    We are new to Mirth and are using an Appliance. The version of MirthConnect is 3.0.2.7140 and soon to upgrade to 3.0.3 because the appliance will auto update as the information reads.

    I have a database writer where I'm using SQL, but I would like to use javascript if possible. Here is what I'm using to insert into an Oracle database:

    INSERT IGNORE INTO PATIENTS (ID, OFFICE, FIRSTNAME, LASTNAME, MIDDLENAME, GENDER, BIRTHDATE, DATE_FORMAT, SOURCEID, STREET1, CITY, STATE, POSTCODE, HOMEPHONE, WORKPHONE, NOTES, PHYSICIAN_DEA, PHYSICIAN_FIRSTNAME, PHYSICIAN_LASTNAME, INSURANCE_STRING, MEMBER_ID_NUMBER, GROUP_NUMBER, RELATIONSHIP_CODE, APPT_DATE, APPT_DATE_FORMAT)

    VALUES (SEQ_PATIENTS.NEXTVAL, FNC_GET_IIDOFFICE(${thischannelName}, ${patientVisit_assignedPatientLocation_pointOfCare }),

    ${patientIdentification_patientName_givenName},
    ${patientIdentification_patientName_familyName},
    ${patientIdentification_patientName_middleInitialO rName},
    ${patientIdentification_sex_value},
    ${patientIdentification_dateOrTimeOfBirth_value},
    'YYYY-MM-DD',
    ${patientIdentification_patientIdExternalId_id},
    ${patientIdentification_patientAddress_streetAddre ss},
    ${patientIdentification_patientAddress_city},
    ${patientIdentification_patientAddress_stateOrProv ince},
    ${patientIdentification_patientAddress_zipOrPostal Code},
    ${patientIdentification_phoneNumber_home_number},
    ${patientIdentification_phoneNumber_business_numbe r},
    ${patientVisit_visitNumber_id},
    FNC_GET_PRESCRIBER_DEA_NPI(${thischannelName}, ${patientVisit_attendingDoctor_idNumber}, 'DEA'),
    ${patientVisit_attendingDoctor_givenName},
    ${patientVisit_attendingDoctor_familyName},
    ${insurance0_insuranceCompanyName_organizationName },
    ${insurance0_policyNumber_value},
    ${insurance0_groupNumber_value},
    ${insurance0_insuredsRelationshipToPatient_value},
    ${patientVisit_admitDateOrTime_value},
    'YYYY-MM-DD'
    )

    Can someone help with translating the function and sequence statements (bolded above) using the correct syntax for javascript? I am having trouble figuring out the seq.nextval and the function. $('SEQ.PATIENTS.NEXTVAL') + "','" + (FNC_GET_OFFICE(${thischannelName}).
    I'm having trouble with the syntax.

    Thank you for your help please and thank you again.

    Sincerely,
    Not Knowing and
Working...
X