/*add HPV Vaccine */

-- person_vaccine

DELETE from person_vaccine WHERE export_vaccine_code IN('310','320','311');

SET @HPVs1 = (select max(person_vaccine_id)+1 from person_vaccine) ;

SET @HPVs2 = (select max(person_vaccine_id)+2 from person_vaccine) ;

SET @HPVs = (select max(person_vaccine_id)+3 from person_vaccine) ;

INSERT IGNORE INTO person_vaccine ( person_vaccine_id , vaccine_name , vaccine_code , vaccine_group , export_vaccine_code , hos_guid , combine_vaccine , icode ) VALUES (@HPVs1, 'HPVs1(.5) ICD10: Z258', 'HPVs1', 'HPVs', '310', NULL, 'N', NULL);

INSERT IGNORE INTO person_vaccine ( person_vaccine_id , vaccine_name , vaccine_code , vaccine_group , export_vaccine_code , hos_guid , combine_vaccine , icode ) VALUES (@HPVs2, 'HPVs2(.5) ICD10: Z258', 'HPVs2', 'HPVs', '320', NULL, 'N', NULL);

INSERT IGNORE INTO person_vaccine ( person_vaccine_id , vaccine_name , vaccine_code , vaccine_group , export_vaccine_code , hos_guid , combine_vaccine , icode ) VALUES (@HPVs, 'HPVs+ เข็มแรก15 ปีขึ้นไปICD10: Z258', 'HPVs+', 'HPVs', '311', NULL, 'N', NULL);

#===========

-- student_vaccine

DELETE from student_vaccine WHERE export_vaccine_code IN('310','320','311');

SET @studentHPVs1 = (select max(student_vaccine_id)+1 from student_vaccine) ;

SET @studentHPVs2 = (select max(student_vaccine_id)+2 from student_vaccine) ;

SET @studentHPVs3 = (select max(student_vaccine_id)+3 from student_vaccine) ;

INSERT IGNORE INTO student_vaccine ( student_vaccine_id , student_vaccine_name , vaccine_code , hos_guid , export_vaccine_code , combine_vaccine , check_code ) VALUES (@studentHPVs1, 'HPVs1(.5) ICD10: Z258', 'HPVs1', NULL, '310', 'N', 'HPVs1');

INSERT IGNORE INTO student_vaccine ( student_vaccine_id , student_vaccine_name , vaccine_code , hos_guid , export_vaccine_code , combine_vaccine , check_code ) VALUES (@studentHPVs2, 'HPVs2(.5) ICD10: Z258', 'HPVs2', NULL, '320', 'N', 'HPVs2');

INSERT IGNORE INTO student_vaccine ( student_vaccine_id , student_vaccine_name , vaccine_code , hos_guid , export_vaccine_code , combine_vaccine , check_code ) VALUES (@studentHPVs3, 'HPVs+ เข็มแรก15 ปีขึ้นไปICD10: Z258', 'HPVs+', NULL, '311', 'N', 'HPVs+');

#===========

-- vaccine_combination

DELETE from vaccine_combination WHERE vaccine_code IN('HPVs1','HPVs2','HPVs+');

SET @combination_HPVs1 = (select max(vaccine_combination_id)+1 from vaccine_combination) ;

SET @combination_HPVs2 = (select max(vaccine_combination_id)+2 from vaccine_combination) ;

SET @combination_HPVs = (select max(vaccine_combination_id)+3 from vaccine_combination) ;

INSERT IGNORE INTO vaccine_combination ( vaccine_combination_id , vaccine_code , vaccine_combine_code , hos_guid ) VALUES (@combination_HPVs1, 'HPVs1', 'HPVs1', NULL);

INSERT IGNORE INTO vaccine_combination ( vaccine_combination_id , vaccine_code , vaccine_combine_code , hos_guid ) VALUES (@combination_HPVs2, 'HPVs2', 'HPVs2', NULL);

INSERT IGNORE INTO vaccine_combination ( vaccine_combination_id , vaccine_code , vaccine_combine_code , hos_guid ) VALUES (@combination_HPVs, 'HPVs+', 'HPVs+', NULL);

#===========

-- provis_vcctype

DELETE from provis_vcctype WHERE code IN('310','320','311');

INSERT IGNORE INTO provis_vcctype ( code , name , hos_guid ) VALUES ('310', 'HPVs1', NULL);

INSERT IGNORE INTO provis_vcctype ( code , name , hos_guid ) VALUES ('311', 'HPVs+', NULL);

INSERT IGNORE INTO provis_vcctype ( code , name , hos_guid ) VALUES ('320', 'HPVs2', NULL);

select * from provis_vcctype WHERE code IN('310','320','311');

#=======