830 lines
18 KiB
JavaScript
830 lines
18 KiB
JavaScript
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
const Insurances = db.insurances;
|
|
|
|
const Patients = db.patients;
|
|
|
|
const Referrals = db.referrals;
|
|
|
|
const Practice = db.practice;
|
|
|
|
const InsurancesData = [
|
|
{
|
|
payer_type: 'PPO',
|
|
|
|
aliases: 'Medicare Plan A',
|
|
|
|
payer_id: 'MCR123',
|
|
|
|
notes: 'Primary Medicare plan',
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
payer_type: 'Medicare',
|
|
|
|
aliases: 'Medicaid State Plan',
|
|
|
|
payer_id: 'MCD456',
|
|
|
|
notes: 'State Medicaid coverage',
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
payer_type: 'Medicare',
|
|
|
|
aliases: 'Blue Cross Blue Shield',
|
|
|
|
payer_id: 'BCBS789',
|
|
|
|
notes: 'Commercial insurance plan',
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
payer_type: 'PPO',
|
|
|
|
aliases: 'Kaiser Permanente',
|
|
|
|
payer_id: 'HMO101',
|
|
|
|
notes: 'HMO plan with limited network',
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
payer_type: 'Commercial',
|
|
|
|
aliases: 'United Healthcare PPO',
|
|
|
|
payer_id: 'PPO202',
|
|
|
|
notes: 'PPO plan with flexible network',
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
];
|
|
|
|
const PatientsData = [
|
|
{
|
|
first_name: 'John',
|
|
|
|
last_name: 'Doe',
|
|
|
|
date_of_birth: new Date('1980-05-15T00:00:00Z'),
|
|
|
|
gender: 'Female',
|
|
|
|
phone: '555-1234',
|
|
|
|
email: 'john.doe@example.com',
|
|
|
|
address_street: '123 Elm St',
|
|
|
|
address_city: 'Springfield',
|
|
|
|
address_state: 'IL',
|
|
|
|
address_zip: '62701',
|
|
|
|
primary_insurance_member: '123456789',
|
|
|
|
is_medicare: true,
|
|
|
|
patient_status: 'Active',
|
|
|
|
received_welcome_call: true,
|
|
|
|
documents_uploaded: true,
|
|
|
|
wound_case_count: 3,
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
first_name: 'Jane',
|
|
|
|
last_name: 'Smith',
|
|
|
|
date_of_birth: new Date('1992-11-23T00:00:00Z'),
|
|
|
|
gender: 'Male',
|
|
|
|
phone: '555-5678',
|
|
|
|
email: 'jane.smith@example.com',
|
|
|
|
address_street: '456 Oak St',
|
|
|
|
address_city: 'Springfield',
|
|
|
|
address_state: 'IL',
|
|
|
|
address_zip: '62702',
|
|
|
|
primary_insurance_member: '987654321',
|
|
|
|
is_medicare: true,
|
|
|
|
patient_status: 'OnHold',
|
|
|
|
received_welcome_call: false,
|
|
|
|
documents_uploaded: true,
|
|
|
|
wound_case_count: 1,
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
first_name: 'Alice',
|
|
|
|
last_name: 'Johnson',
|
|
|
|
date_of_birth: new Date('1975-07-30T00:00:00Z'),
|
|
|
|
gender: 'Male',
|
|
|
|
phone: '555-8765',
|
|
|
|
email: 'alice.johnson@example.com',
|
|
|
|
address_street: '789 Pine St',
|
|
|
|
address_city: 'Springfield',
|
|
|
|
address_state: 'IL',
|
|
|
|
address_zip: '62703',
|
|
|
|
primary_insurance_member: '112233445',
|
|
|
|
is_medicare: true,
|
|
|
|
patient_status: 'OnHold',
|
|
|
|
received_welcome_call: true,
|
|
|
|
documents_uploaded: true,
|
|
|
|
wound_case_count: 5,
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
first_name: 'Bob',
|
|
|
|
last_name: 'Brown',
|
|
|
|
date_of_birth: new Date('1985-02-10T00:00:00Z'),
|
|
|
|
gender: 'Other',
|
|
|
|
phone: '555-4321',
|
|
|
|
email: 'bob.brown@example.com',
|
|
|
|
address_street: '321 Maple St',
|
|
|
|
address_city: 'Springfield',
|
|
|
|
address_state: 'IL',
|
|
|
|
address_zip: '62704',
|
|
|
|
primary_insurance_member: '556677889',
|
|
|
|
is_medicare: false,
|
|
|
|
patient_status: 'Active',
|
|
|
|
received_welcome_call: true,
|
|
|
|
documents_uploaded: true,
|
|
|
|
wound_case_count: 2,
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
first_name: 'Charlie',
|
|
|
|
last_name: 'Davis',
|
|
|
|
date_of_birth: new Date('1990-09-18T00:00:00Z'),
|
|
|
|
gender: 'Male',
|
|
|
|
phone: '555-6789',
|
|
|
|
email: 'charlie.davis@example.com',
|
|
|
|
address_street: '654 Birch St',
|
|
|
|
address_city: 'Springfield',
|
|
|
|
address_state: 'IL',
|
|
|
|
address_zip: '62705',
|
|
|
|
primary_insurance_member: '998877665',
|
|
|
|
is_medicare: false,
|
|
|
|
patient_status: 'Active',
|
|
|
|
received_welcome_call: true,
|
|
|
|
documents_uploaded: true,
|
|
|
|
wound_case_count: 4,
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
];
|
|
|
|
const ReferralsData = [
|
|
{
|
|
intake_method: 'Email',
|
|
|
|
referral_reason: 'Routine check-up',
|
|
|
|
insurance_name_on_card: 'John Doe',
|
|
|
|
insurance_status: 'NeedsInfo',
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
assignment_method: 'Auto',
|
|
|
|
assignment_notes: 'Routine assignment',
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
intake_method: 'Email',
|
|
|
|
referral_reason: 'Follow-up visit',
|
|
|
|
insurance_name_on_card: 'Jane Smith',
|
|
|
|
insurance_status: 'Rejected',
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
assignment_method: 'Manual',
|
|
|
|
assignment_notes: 'Specialist required',
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
intake_method: 'Email',
|
|
|
|
referral_reason: 'New patient',
|
|
|
|
insurance_name_on_card: 'Alice Johnson',
|
|
|
|
insurance_status: 'Validated',
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
assignment_method: 'Manual',
|
|
|
|
assignment_notes: 'Urgent care',
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
intake_method: 'Fax',
|
|
|
|
referral_reason: 'Consultation',
|
|
|
|
insurance_name_on_card: 'Bob Brown',
|
|
|
|
insurance_status: 'NeedsInfo',
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
assignment_method: 'Auto',
|
|
|
|
assignment_notes: 'Insurance issues',
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
|
|
{
|
|
intake_method: 'Email',
|
|
|
|
referral_reason: 'Annual check-up',
|
|
|
|
insurance_name_on_card: 'Charlie Davis',
|
|
|
|
insurance_status: 'Rejected',
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
assignment_method: 'Manual',
|
|
|
|
assignment_notes: 'Routine check-up',
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
// type code here for "relation_one" field
|
|
},
|
|
];
|
|
|
|
const PracticeData = [
|
|
{
|
|
name: 'Richard Feynman',
|
|
},
|
|
|
|
{
|
|
name: 'William Herschel',
|
|
},
|
|
|
|
{
|
|
name: 'Leonard Euler',
|
|
},
|
|
|
|
{
|
|
name: 'Pierre Simon de Laplace',
|
|
},
|
|
|
|
{
|
|
name: 'Emil Kraepelin',
|
|
},
|
|
];
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
async function associateUserWithPractice() {
|
|
const relatedPractice0 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const User0 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0,
|
|
});
|
|
if (User0?.setPractice) {
|
|
await User0.setPractice(relatedPractice0);
|
|
}
|
|
|
|
const relatedPractice1 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const User1 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1,
|
|
});
|
|
if (User1?.setPractice) {
|
|
await User1.setPractice(relatedPractice1);
|
|
}
|
|
|
|
const relatedPractice2 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const User2 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2,
|
|
});
|
|
if (User2?.setPractice) {
|
|
await User2.setPractice(relatedPractice2);
|
|
}
|
|
|
|
const relatedPractice3 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const User3 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3,
|
|
});
|
|
if (User3?.setPractice) {
|
|
await User3.setPractice(relatedPractice3);
|
|
}
|
|
|
|
const relatedPractice4 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const User4 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4,
|
|
});
|
|
if (User4?.setPractice) {
|
|
await User4.setPractice(relatedPractice4);
|
|
}
|
|
}
|
|
|
|
async function associateInsuranceWithPractice() {
|
|
const relatedPractice0 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Insurance0 = await Insurances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0,
|
|
});
|
|
if (Insurance0?.setPractice) {
|
|
await Insurance0.setPractice(relatedPractice0);
|
|
}
|
|
|
|
const relatedPractice1 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Insurance1 = await Insurances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1,
|
|
});
|
|
if (Insurance1?.setPractice) {
|
|
await Insurance1.setPractice(relatedPractice1);
|
|
}
|
|
|
|
const relatedPractice2 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Insurance2 = await Insurances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2,
|
|
});
|
|
if (Insurance2?.setPractice) {
|
|
await Insurance2.setPractice(relatedPractice2);
|
|
}
|
|
|
|
const relatedPractice3 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Insurance3 = await Insurances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3,
|
|
});
|
|
if (Insurance3?.setPractice) {
|
|
await Insurance3.setPractice(relatedPractice3);
|
|
}
|
|
|
|
const relatedPractice4 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Insurance4 = await Insurances.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4,
|
|
});
|
|
if (Insurance4?.setPractice) {
|
|
await Insurance4.setPractice(relatedPractice4);
|
|
}
|
|
}
|
|
|
|
async function associatePatientWithPractice() {
|
|
const relatedPractice0 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Patient0 = await Patients.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0,
|
|
});
|
|
if (Patient0?.setPractice) {
|
|
await Patient0.setPractice(relatedPractice0);
|
|
}
|
|
|
|
const relatedPractice1 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Patient1 = await Patients.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1,
|
|
});
|
|
if (Patient1?.setPractice) {
|
|
await Patient1.setPractice(relatedPractice1);
|
|
}
|
|
|
|
const relatedPractice2 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Patient2 = await Patients.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2,
|
|
});
|
|
if (Patient2?.setPractice) {
|
|
await Patient2.setPractice(relatedPractice2);
|
|
}
|
|
|
|
const relatedPractice3 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Patient3 = await Patients.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3,
|
|
});
|
|
if (Patient3?.setPractice) {
|
|
await Patient3.setPractice(relatedPractice3);
|
|
}
|
|
|
|
const relatedPractice4 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Patient4 = await Patients.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4,
|
|
});
|
|
if (Patient4?.setPractice) {
|
|
await Patient4.setPractice(relatedPractice4);
|
|
}
|
|
}
|
|
|
|
async function associateReferralWithInsurance_validator() {
|
|
const relatedInsurance_validator0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral0 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0,
|
|
});
|
|
if (Referral0?.setInsurance_validator) {
|
|
await Referral0.setInsurance_validator(relatedInsurance_validator0);
|
|
}
|
|
|
|
const relatedInsurance_validator1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral1 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1,
|
|
});
|
|
if (Referral1?.setInsurance_validator) {
|
|
await Referral1.setInsurance_validator(relatedInsurance_validator1);
|
|
}
|
|
|
|
const relatedInsurance_validator2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral2 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2,
|
|
});
|
|
if (Referral2?.setInsurance_validator) {
|
|
await Referral2.setInsurance_validator(relatedInsurance_validator2);
|
|
}
|
|
|
|
const relatedInsurance_validator3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral3 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3,
|
|
});
|
|
if (Referral3?.setInsurance_validator) {
|
|
await Referral3.setInsurance_validator(relatedInsurance_validator3);
|
|
}
|
|
|
|
const relatedInsurance_validator4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral4 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4,
|
|
});
|
|
if (Referral4?.setInsurance_validator) {
|
|
await Referral4.setInsurance_validator(relatedInsurance_validator4);
|
|
}
|
|
}
|
|
|
|
async function associateReferralWithAssigned_provider() {
|
|
const relatedAssigned_provider0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral0 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0,
|
|
});
|
|
if (Referral0?.setAssigned_provider) {
|
|
await Referral0.setAssigned_provider(relatedAssigned_provider0);
|
|
}
|
|
|
|
const relatedAssigned_provider1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral1 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1,
|
|
});
|
|
if (Referral1?.setAssigned_provider) {
|
|
await Referral1.setAssigned_provider(relatedAssigned_provider1);
|
|
}
|
|
|
|
const relatedAssigned_provider2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral2 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2,
|
|
});
|
|
if (Referral2?.setAssigned_provider) {
|
|
await Referral2.setAssigned_provider(relatedAssigned_provider2);
|
|
}
|
|
|
|
const relatedAssigned_provider3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral3 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3,
|
|
});
|
|
if (Referral3?.setAssigned_provider) {
|
|
await Referral3.setAssigned_provider(relatedAssigned_provider3);
|
|
}
|
|
|
|
const relatedAssigned_provider4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral4 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4,
|
|
});
|
|
if (Referral4?.setAssigned_provider) {
|
|
await Referral4.setAssigned_provider(relatedAssigned_provider4);
|
|
}
|
|
}
|
|
|
|
async function associateReferralWithCreated_by_user() {
|
|
const relatedCreated_by_user0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral0 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0,
|
|
});
|
|
if (Referral0?.setCreated_by_user) {
|
|
await Referral0.setCreated_by_user(relatedCreated_by_user0);
|
|
}
|
|
|
|
const relatedCreated_by_user1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral1 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1,
|
|
});
|
|
if (Referral1?.setCreated_by_user) {
|
|
await Referral1.setCreated_by_user(relatedCreated_by_user1);
|
|
}
|
|
|
|
const relatedCreated_by_user2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral2 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2,
|
|
});
|
|
if (Referral2?.setCreated_by_user) {
|
|
await Referral2.setCreated_by_user(relatedCreated_by_user2);
|
|
}
|
|
|
|
const relatedCreated_by_user3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral3 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3,
|
|
});
|
|
if (Referral3?.setCreated_by_user) {
|
|
await Referral3.setCreated_by_user(relatedCreated_by_user3);
|
|
}
|
|
|
|
const relatedCreated_by_user4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Referral4 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4,
|
|
});
|
|
if (Referral4?.setCreated_by_user) {
|
|
await Referral4.setCreated_by_user(relatedCreated_by_user4);
|
|
}
|
|
}
|
|
|
|
async function associateReferralWithPractice() {
|
|
const relatedPractice0 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Referral0 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0,
|
|
});
|
|
if (Referral0?.setPractice) {
|
|
await Referral0.setPractice(relatedPractice0);
|
|
}
|
|
|
|
const relatedPractice1 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Referral1 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1,
|
|
});
|
|
if (Referral1?.setPractice) {
|
|
await Referral1.setPractice(relatedPractice1);
|
|
}
|
|
|
|
const relatedPractice2 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Referral2 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2,
|
|
});
|
|
if (Referral2?.setPractice) {
|
|
await Referral2.setPractice(relatedPractice2);
|
|
}
|
|
|
|
const relatedPractice3 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Referral3 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3,
|
|
});
|
|
if (Referral3?.setPractice) {
|
|
await Referral3.setPractice(relatedPractice3);
|
|
}
|
|
|
|
const relatedPractice4 = await Practice.findOne({
|
|
offset: Math.floor(Math.random() * (await Practice.count())),
|
|
});
|
|
const Referral4 = await Referrals.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4,
|
|
});
|
|
if (Referral4?.setPractice) {
|
|
await Referral4.setPractice(relatedPractice4);
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
await Insurances.bulkCreate(InsurancesData);
|
|
|
|
await Patients.bulkCreate(PatientsData);
|
|
|
|
await Referrals.bulkCreate(ReferralsData);
|
|
|
|
await Practice.bulkCreate(PracticeData);
|
|
|
|
await Promise.all([
|
|
// Similar logic for "relation_many"
|
|
|
|
await associateUserWithPractice(),
|
|
|
|
await associateInsuranceWithPractice(),
|
|
|
|
await associatePatientWithPractice(),
|
|
|
|
await associateReferralWithInsurance_validator(),
|
|
|
|
await associateReferralWithAssigned_provider(),
|
|
|
|
await associateReferralWithCreated_by_user(),
|
|
|
|
await associateReferralWithPractice(),
|
|
]);
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
await queryInterface.bulkDelete('insurances', null, {});
|
|
|
|
await queryInterface.bulkDelete('patients', null, {});
|
|
|
|
await queryInterface.bulkDelete('referrals', null, {});
|
|
|
|
await queryInterface.bulkDelete('practice', null, {});
|
|
},
|
|
};
|