พิมพ์
หมวด: แฟ้มบริการกึ่งสำรวจ
ฮิต: 307

/*

R23 :โรต้า3-6 6 เดือน (อายุไม่เกิน 32 สัปดาห์)

*/

# person_vaccine

DELETE FROM person_vaccine WHERE export_vaccine_code ='R23';

SET @R23 = (select max(person_vaccine_id)+1 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 (@R23, 'R23:โรต้า3-2 6 เดือนอายุไม่เกิน 32 สัปดาห์', 'RV3-3', 'RV', 'R23', NULL, 'N', NULL);

-- SELECT * FROM person_vaccine wHERE export_vaccine_code = 'R23';

# vaccine_combination

SET @c23 = ( SELECT MAX(vaccine_combination_id)+1 FROM vaccine_combination) ;

DELETE FROM vaccine_combination WHERE vaccine_code= 'RV3-3';

INSERT IGNORE INTO vaccine_combination (vaccine_combination_id, vaccine_code, vaccine_combine_code, hos_guid) VALUES (@c23, 'RV3-3', 'RV3-3', NULL);

UPDATE serial

SET serial_no = (SELECT MAX(vaccine_combination_id) FROM vaccine_combination)

WHERE serial.name = 'vaccine_combination_id';

-- select * FROM vaccine_combination WHERE vaccine_code= 'RV3-3';

# wbc_vaccine

DELETE FROM wbc_vaccine WHERE export_vaccine_code='R23';

SET @w23 = (

SELECT MAX(wbc_vaccine_id)+1

FROM wbc_vaccine) ;

INSERT IGNORE INTO wbc_vaccine (wbc_vaccine_id, wbc_vaccine_name, wbc_vaccine_code, age_min, age_max, export_vaccine_code, check_code, vaccine_in_use, hos_guid, icode, price, combine_vaccine) VALUES (@w23, 'R23:โรต้า3-2 6 เดือนอายุไม่เกิน 32 สัปดาห์', 'RV3-3', 24, 32, 'R23', 'R23', NULL, NULL, NULL, NULL, 'N');

-- select * FROM wbc_vaccine WHERE export_vaccine_code='R23';

# provis_vcctype

DELETE FROM provis_vcctype WHERE code='R23';

INSERT IGNORE INTO provis_vcctype (code, name, hos_guid) VALUES ('R23', 'RV3-3', NULL);

-- SELECT * FROM provis_vcctype v WHERE v.code ='R23';

# provis_aptype

delete FROM provis_aptype where code = 'R23';

INSERT IGNORE INTO provis_aptype (code,name,hos_guid,hos_guid_ext) VALUES ('R23','RV3-3',NULL,NULL);

-- SELECT * FROM provis_aptype as v where v.code = 'R23';

# baby_items

delete FROM baby_items where export_code = 'R23';

set @b23 = (SELECT max(baby_code)+1 FROM baby_items);

INSERT IGNORE INTO baby_items (baby_code, baby_group, service_code, baby_name, vaccine_code, display_order, export_code, hos_guid) VALUES (@b23, 4, NULL, 'R23:โรต้า3-2 6 เดือนอายุไม่เกิน 32 สัปดาห์', 'RV3-3', NULL, 'R23', NULL);

-- SELECT * FROM baby_items where export_code = 'R23';

# person_vaccine_group_lot

delete FROM person_vaccine_group_lot where vaccine_group = 'RV3-3';

SET @G23 = (select max(person_vaccine_group_lot_id)+1 from person_vaccine_group_lot) ;

INSERT IGNORE INTO person_vaccine_group_lot (person_vaccine_group_lot_id, vaccine_group, vaccine_lot, receive_date, expire_date, receive_qty, left_qty, vaccine_lot_active, hos_guid) VALUES (@G23, 'RV3-3', NULL, NULL, NULL, NULL, NULL, 'Y', NULL);

UPDATE serial

SET serial_no = (

select person_vaccine_group_lot_id

from person_vaccine_group_lot

where vaccine_group = 'RV3-3')

WHERE serial.name = 'person_vaccine_group_lot_id';

SELECT * FROM person_vaccine_group_lot o where o.vaccine_group = 'RV3-3';