
/* patient_symptom_disease */	
DELETE 
FROM
	patient_symptom_disease 
WHERE
	patient_symptom_disease.opd_ipd_ot_flag = 'O';
	
/* patient_vitals */	
DELETE 
FROM
	patient_vitals 
WHERE
	patient_vitals.opd_ipd_ot_flag = 'O';
    
/* patient_service_charge_details */
DELETE
	patient_service_charge_details.* 
FROM
	patient_service_charge_details
	INNER JOIN patient_service_charges ON patient_service_charges.id = patient_service_charge_details.patient_service_charge_id 
WHERE
	patient_service_charges.billing_module_id = 3;

/* patient_service_charges */
DELETE 
FROM
	patient_service_charges 
WHERE
	patient_service_charges.billing_module_id = 3;
	
/* visit_details */	
DELETE
	visit_details.* 
FROM
	visit_details
	INNER JOIN case_details ON case_details.id = visit_details.case_id 
WHERE
	case_details.opd_ipd_ot_flag = 'O';

/* case_details */
DELETE
FROM
	case_details 
WHERE
	case_details.opd_ipd_ot_flag = 'O';

/* opd_doctor_appointments */
DELETE
FROM
	opd_doctor_appointments;