/*DTP_HB_Hib1,2,3*/

delete FROM person_vaccine WHERE export_vaccine_code IN ('d21','d22','d23');

DELETE FROM wbc_vaccine WHERE export_vaccine_code IN ('d21','d22','d23');

delete FROM vaccine_combination

WHERE vaccine_code IN ('DTP-HB-Hib 1','DTP-HB-Hib 2','DTP-HB-Hib 3',@vaccine_code1,@vaccine_code2,@vaccine_code3);

delete FROM provis_vcctype WHERE CODE IN ('d21','d22','d23');

delete FROM provis_aptype WHERE CODE IN ('d21','d22','d23');

DELETE FROM baby_items WHERE export_code IN ('d21','d22','d23');

DELETE FROM person_vaccine_group_lot

WHERE vaccine_group IN('DTP-HB-Hib 1','DTP-HB-Hib 2','DTP-HB-Hib 3',@vaccine_code1,@vaccine_code2,@vaccine_code3);

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

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

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

set @vaccine_code1 = 'DTP-HB-Hib 1' ;

set @vaccine_code2 = 'DTP-HB-Hib 2' ;

set @vaccine_code3 = 'DTP-HB-Hib 3' ;

REPLACE INTO person_vaccine (person_vaccine_id, vaccine_name, vaccine_code, vaccine_group, export_vaccine_code, hos_guid, combine_vaccine, icode)

VALUES (@Hib1, 'ดีทีพีตับอักเสบบีฮิบ 1', @vaccine_code1, 'DTPHB', 'D21', NULL, NULL, NULL);

REPLACE INTO person_vaccine (person_vaccine_id, vaccine_name, vaccine_code, vaccine_group, export_vaccine_code, hos_guid, combine_vaccine, icode)

VALUES (@Hib2, 'ดีทีพีตับอักเสบบีฮิบ 2',@vaccine_code2, 'DTPHB', 'D22', NULL, NULL, NULL);

REPLACE INTO person_vaccine (person_vaccine_id, vaccine_name, vaccine_code, vaccine_group, export_vaccine_code, hos_guid, combine_vaccine, icode)

VALUES (@Hib3, 'ดีทีพีตับอักเสบบีฮิบ 3',@vaccine_code3, 'DTPHB', 'D23', NULL, NULL, NULL);

/*

SELECT * FROM person_vaccine

WHERE export_vaccine_code IN ('d21','d22','d23');*/

#----------------------wbc_vaccine

SET @hib_w1 =(select max(wbc_vaccine_id)+1 from wbc_vaccine);

SET @hib_w2 =(select max(wbc_vaccine_id)+2 from wbc_vaccine);

SET @hib_w3 =(select max(wbc_vaccine_id)+3 from wbc_vaccine);

INSERT 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 (@hib_w1, 'ดีทีพีตับอักเสบบีฮิบ 1',@vaccine_code1, 2, 4, 'D21','DTP_HBHib1', NULL, NULL, NULL, NULL, 'N');

INSERT 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 (@hib_w2, 'ดีทีพีตับอักเสบบีฮิบ 2',@vaccine_code2, 2, 4, 'D22','DTP_HBHib2', NULL, NULL, NULL, NULL, 'N');

INSERT 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 (@hib_w3, 'ดีทีพีตับอักเสบบีฮิบ 3',@vaccine_code3, 2, 4, 'D23','DTP_HBHib3', NULL, NULL, NULL, NULL, 'N');

#SELECT * FROM wbc_vaccine WHERE export_vaccine_code IN ('d21','d22','d23');

#----------------------vaccine_combination

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

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

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

INSERT INTO vaccine_combination (vaccine_combination_id, vaccine_code, vaccine_combine_code, hos_guid)

VALUES (@hib_c1,@vaccine_code1, 'DTP-HB-Hib 1', NULL);

INSERT INTO vaccine_combination (vaccine_combination_id, vaccine_code, vaccine_combine_code, hos_guid)

VALUES (@hib_c2,@vaccine_code2, 'DTP-HB-Hib 2', NULL);

INSERT INTO vaccine_combination (vaccine_combination_id, vaccine_code, vaccine_combine_code, hos_guid)

VALUES (@hib_c3,@vaccine_code3, 'DTP-HB-Hib 3', NULL);

/*SELECT * FROM vaccine_combination

WHERE vaccine_code IN ('DTP-HB-Hib 1','DTP-HB-Hib 2','DTP-HB-Hib 3');*/

UPDATE serial AS s

SET s.serial_no = @hib_c3

WHERE NAME LIKE 'vaccine_combination_id%';

#----------------------provis_vcctype

INSERT INTO provis_vcctype (code, name, hos_guid)

VALUES ('D21',@vaccine_code1, NULL);

INSERT INTO provis_vcctype (code, name, hos_guid)

VALUES ('D22',@vaccine_code2, NULL);

INSERT INTO provis_vcctype (code, name, hos_guid)

VALUES ('D23',@vaccine_code3, NULL);

/*SELECT * FROM provis_vcctype

WHERE CODE IN ('d21','d22','d23');*/

#----------------------provis_aptype

INSERT INTO provis_aptype (code, name, hos_guid, hos_guid_ext)

VALUES ('D21',@vaccine_code1, NULL, NULL);

INSERT INTO provis_aptype (code, name, hos_guid, hos_guid_ext)

VALUES ('D22',@vaccine_code2, NULL, NULL);

INSERT INTO provis_aptype (code, name, hos_guid, hos_guid_ext)

VALUES ('D23',@vaccine_code3, NULL, NULL);

/*SELECT * FROM provis_aptype

WHERE CODE IN ('d21','d22','d23');*/

#----------------------baby_items

SET @baby_code = (SELECT MAX(baby_code)+1 FROM baby_items);

SET @baby_code2 = (SELECT MAX(baby_code)+2 FROM baby_items);

SET @baby_code3 = (SELECT MAX(baby_code)+3 FROM baby_items);

INSERT INTO baby_items (baby_code, baby_group, service_code, baby_name, vaccine_code, display_order, export_code, hos_guid)

VALUES (@baby_code, 2, NULL, 'ดีทีพีตับอักเสบบีฮิบ 1',@vaccine_code1, NULL, 'D21', NULL);

INSERT INTO baby_items (baby_code, baby_group, service_code, baby_name, vaccine_code, display_order, export_code, hos_guid)

VALUES (@baby_code2, 2, NULL, 'ดีทีพีตับอักเสบบีฮิบ 2',@vaccine_code2, NULL, 'D22', NULL);

INSERT INTO baby_items (baby_code, baby_group, service_code, baby_name, vaccine_code, display_order, export_code, hos_guid)

VALUES (@baby_code3, 2, NULL, 'ดีทีพีตับอักเสบบีฮิบ 3',@vaccine_code3, NULL, 'D23', NULL);

/*SELECT * FROM baby_items

WHERE export_code IN ('d21','d22','d23');*/

#-----------------------person_vaccine_group_lot

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

SET @Hibg2 = (select max(person_vaccine_group_lot_id)+2 from person_vaccine_group_lot) ;

SET @Hibg3 = (select max(person_vaccine_group_lot_id)+3 from person_vaccine_group_lot) ;

INSERT 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 (@Hibg1,@vaccine_code1, NULL, NULL, NULL, NULL, NULL, 'Y', NULL);

INSERT 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 (@Hibg2,@vaccine_code2, NULL, NULL, NULL, NULL, NULL, 'Y', NULL);

INSERT 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 (@Hibg3,@vaccine_code3, NULL, NULL, NULL, NULL, NULL, 'Y', NULL);

UPDATE serial

SET serial_no = @Hibg3

WHERE NAME LIKE 'person_vaccine_group_lot_id%';

SELECT *

FROM person_vaccine_group_lot AS g

WHERE g.vaccine_group IN(@vaccine_code1,@vaccine_code2,@vaccine_code3);

#-----------------------

/*

ทำวัคซีนexport_vaccine_codeJ11,J12.ให้แสดงหน้าบัญชี4

*/

SET @vcode1= 'LAJE1';

SET @vcode2 = 'LAJE2';

# --------------------------------

UPDATE person_vaccine AS p

SET p.vaccine_code = @vcode1

WHERE p.export_vaccine_code = 'J11';

# --------------------------------

UPDATE person_vaccine AS p

SET p.vaccine_code = @vcode2

WHERE p.export_vaccine_code = 'J12';

# --------------------------------

UPDATE epi_vaccine AS e

SET e.vaccine_code =@vcode1

WHERE e.export_vaccine_code = 'J11';

# --------------------------------

UPDATE epi_vaccine AS e

SET e.vaccine_code =@vcode2

WHERE e.export_vaccine_code = 'J12';

# --------------------------------

UPDATE vaccine_combination AS b

SET b.vaccine_code =@vcode1,b.vaccine_combine_code=@vcode1

WHERE b.vaccine_code='LAJE1' OR b.vaccine_code ='laje1' OR b.vaccine_code='J11';

# --------------------------------

UPDATE vaccine_combination AS b

SET b.vaccine_code =@vcode2,b.vaccine_combine_code=@vcode2

WHERE b.vaccine_code='LAJE2' OR b.vaccine_code ='laje2' OR b.vaccine_code='J12';

# --------------------------------

UPDATE provis_vcctype AS t

SET t.name = @vcode1

WHERE t.code ='J11' OR t.code = 'j11';

# --------------------------------

UPDATE provis_vcctype AS t

SET t.name = @vcode2

WHERE t.code ='J12' OR t.code = 'j12';

# --------------------------------

UPDATE provis_aptype AS a

SET a.name = @vcode1

WHERE a.code ='J11' OR a.code = 'j11';

# --------------------------------

UPDATE provis_aptype AS a

SET a.name = @vcode2

WHERE a.code ='J12' OR a.code = 'j12';

# --------------------------------

/*ตรวจสอบว่ามีวัคซีน MR ผู้ใหญหรือไม'*/

SELECT person_vaccine_id,vaccine_name

FROM person_vaccine

WHERE export_vaccine_code = '074'

#-------------

test mr

หากไม่มี นำคำสั่งเพิ่มไป RUN

delete FROM person_vaccine WHERE export_vaccine_code = '074';

delete FROM vaccine_combination WHERE vaccine_code = '074';

delete FROM provis_vcctype WHERE CODE = '074');

SET @MRC = (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 (@MRC, '074 : MRR หัด หัดเยอรมัน รณรงค์ (Z244,Z245)', 'MRC', 'MMC\r\n', '074', NULL, 'N', NULL);

#--------------

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

INSERT IGNORE INTO`vaccine_combination` (`vaccine_combination_id`, `vaccine_code`, `vaccine_combine_code`, `hos_guid`) VALUES (@cmrc, 'MRC', 'MRC', NULL);

#--------------

INSERT IGNORE INTO `provis_vcctype` (`code`, `name`, `hos_guid`)

VALUES ('074', 'MRC', NULL);

SELECT person_vaccine_id,vaccine_name

FROM person_vaccine

WHERE export_vaccine_code = '074';

DT วัคซีนผู้ใหญ่

ตรวจสอบก่อนว่ามีวัคซีน DT คอตีบ บาดทะยัก หรือไม่

SELECT * FROM provis_vcctype

where CODE = '106';

code name hos_guid
106 DT

หาก มี code 106 แต่ name ไม่ตรง ต้องแก้ไขคำสั่ง ตรง 


set @dtp = 'DT';/*แก้ 'DT' เป็น name ที่ต้องการ */


delete FROM person_vaccine WHERE export_vaccine_code ='106';

delete FROM vaccine_combination WHERE export_vaccine_code ='106';

delete FROM anc_service WHERE export_vaccine_code ='106';

set @dtp = 'DT';/*แก้ 'DT' เป็น name ที่ต้องการ */

INSERT IGNORE INTO `provis_vcctype` (`code`, `name`, `hos_guid`)

VALUES ('106',@dtp, NULL);

#-------

SET @DT = (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 (@DT, 'คอตีบ บาดทะยัก Z23.5, Z23.6 ', @dtp, 'dT', '106', '{482CFB70-D662-11DF-BC2C-00215E472B30}', NULL, NULL);

#-------

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

INSERT IGNORE INTO `vaccine_combination` (`vaccine_combination_id`, `vaccine_code`, `vaccine_combine_code`, `hos_guid`)

VALUES (@dt,@dtp,'DT', NULL);

#--------

set @dtn = 'DT';/*แก้ 'DT' เป็นชื่อที่ต้องการ */

SET @DT = (SELECT MAX(anc_service_id)+1 FROM anc_service) ;

INSERT IGNORE INTO `anc_service`(`anc_service_id`, `anc_service_name`, `anc_service_code`, `export_vaccine_code`, `icode`, `price`, `hos_guid`) VALUES (@DT, @dtn, @dtn, '106', '', NULL, NULL);

#-------------

SELECT * FROM person_vaccine WHERE export_vaccine_code = '106';

CHRONICFU

ขอบเขตข้อมูล 1. ผ้ปู่วยโรคเรื้อรัง (เบาหวาน ความดันโลหติสูง) ที่ได้รับการตรวจติดตาม โดยโรงพยาบาลและสถานบริการระดับปฐมภูมิ

เวลา/รอบที่ทำการบันทึก 1. บันทึกข้อมูลทุกครั้งที่มารับบริการผู้ป่วยโรคเรื้อรัง

- ข้อมูลการตรวจภาวะแทรกซ้อน เป็นการตรวจร่างกาย คือการตรวจเท้า และการตรวจตา หากตรวจพบภาวะแทรกซ้อน ให้บันทึกภาวะแทรกซ้อนที่พบ
ในแฟ้มข้อมูล DIAG_OPD ในส่วนของการวินิจฉัย

- การตรวจติดตามผ้ปู่วย 1 ครั้ง จะมี 1 record ถึงแม้ผ้ปู่วยจะมีทั้งโรคเบาหวานและความดันโลหิตสูง แต่หากเป็นการตรวจครั้งเดียวกัน ก็จะมีเพียง 1 record

นิยามที่เกี่ยวข้อง - ผ้ปู่วยโรคเรื้อรังที่ได้รับการตรวจติดตาม หมายถึง ทั้งที่อาศัยในเขตรับผิดชอบ และนอกเขตรับผิดชอบ

โหลด CHRONICFU