ALTER TABLE `sb_personcertificate_temp`
ADD COLUMN `cityOrgId`  int(11) NULL COMMENT '市机构id' AFTER `orgid`,
ADD COLUMN `districtOrgId`  int(11) NULL COMMENT '区县机构id' AFTER `cityOrgId`;

ALTER TABLE `sb_personcertificate`
ADD COLUMN `cityOrgId`  int(11) NULL COMMENT '市机构id' AFTER `orgid`,
ADD COLUMN `districtOrgId`  int(11) NULL COMMENT '区县机构id' AFTER `cityOrgId`;

ALTER TABLE `sb_armtrainorg`
ADD COLUMN `cityOrgId`  int(11) NULL COMMENT '市机构id' AFTER `orgid`,
ADD COLUMN `districtOrgId`  int(11) NULL COMMENT '区县机构id' AFTER `cityOrgId`;

ALTER TABLE `sb_subsidiary`
ADD COLUMN `cityOrgId`  int(11) NULL COMMENT '市机构id' AFTER `orgid`,
ADD COLUMN `districtOrgId`  int(11) NULL COMMENT '区县机构id' AFTER `cityOrgId`;

ALTER TABLE `sb_sponsorlicense`
ADD COLUMN `cityOrgId`  int(11) NULL COMMENT '市机构id' AFTER `orgid`,
ADD COLUMN `districtOrgId`  int(11) NULL COMMENT '区县机构id' AFTER `cityOrgId`;

ALTER TABLE `sb_confesscompany`
ADD COLUMN `cityOrgId`  int(11) NULL COMMENT '市机构id' AFTER `orgid`,
ADD COLUMN `districtOrgId`  int(11) NULL COMMENT '区县机构id' AFTER `cityOrgId`;

ALTER TABLE `sb_crosscompany`
ADD COLUMN `cityOrgId`  int(11) NULL COMMENT '市机构id' AFTER `orgid`,
ADD COLUMN `districtOrgId`  int(11) NULL COMMENT '区县机构id' AFTER `cityOrgId`;

ALTER TABLE `sb_confesscompanyundo`
ADD COLUMN `cityOrgId`  int(11) NULL COMMENT '市机构id' AFTER `orgid`,
ADD COLUMN `districtOrgId`  int(11) NULL COMMENT '区县机构id' AFTER `cityOrgId`;

ALTER TABLE `sb_legalchange`
ADD COLUMN `cityOrgId`  int(11) NULL COMMENT '市机构id' AFTER `orgid`,
ADD COLUMN `districtOrgId`  int(11) NULL COMMENT '区县机构id' AFTER `cityOrgId`;

ALTER TABLE `yearreportdata`
ADD COLUMN `cityOrgId`  int(11) NULL COMMENT '市机构id' AFTER `orgid`,
ADD COLUMN `districtOrgId`  int(11) NULL COMMENT '区县机构id' AFTER `cityOrgId`;

ALTER TABLE `sb_traincompanyapply`
ADD COLUMN `cityOrgId`  int(11) NULL COMMENT '市机构id' AFTER `orgid`,
ADD COLUMN `districtOrgId`  int(11) NULL COMMENT '区县机构id' AFTER `cityOrgId`;

#旧数据处理
update sb_personcertificate sp,police p1
set sp.cityOrgId= p1.id
where sp.active=true
and sp.city= p1.areacode
and p1.orgtype=2;

update sb_armtrainorg sp,police p1
set sp.cityOrgId= p1.id
where sp.active=true
and sp.city= p1.areacode
and p1.orgtype=2;

update sb_subsidiary sp,police p1
set sp.cityOrgId= p1.id
where sp.active=true
and sp.city= p1.areacode
and p1.orgtype=2;

update sb_sponsorlicense sp,police p1
set sp.cityOrgId= p1.id
where sp.active=true
and sp.city= p1.areacode
and p1.orgtype=2;

update sb_confesscompany sp,police p1
set sp.cityOrgId= p1.id
where sp.active=true
and sp.city= p1.areacode
and p1.orgtype=2;

update sb_crosscompany sp,police p1
set sp.cityOrgId= p1.id
where sp.active=true
and sp.city= p1.areacode
and p1.orgtype=2;

update sb_confesscompanyundo sp,police p1
set sp.cityOrgId= p1.id
where sp.active=true
and sp.city= p1.areacode
and p1.orgtype=2;

update sb_legalchange sp,police p1
set sp.cityOrgId= p1.id
where sp.active=true
and sp.city= p1.areacode
and p1.orgtype=2;

update yearreportdata sp,police p1
set sp.cityOrgId= p1.id
where sp.active=true
and sp.city= p1.areacode
and p1.orgtype=2;

update sb_traincompanyapply sp,police p1
set sp.cityOrgId= p1.id
where sp.active=true
and sp.city= p1.areacode
and p1.orgtype=2;

update sb_personcertificate sp,police p2
set sp.districtOrgId=p2.id
where sp.active=true
and sp.district= p2.areacode
and p2.orgtype=3;

update sb_armtrainorg sp,police p2
set sp.districtOrgId=p2.id
where sp.active=true
and sp.district= p2.areacode
and p2.orgtype=3;

update sb_subsidiary sp,police p2
set sp.districtOrgId=p2.id
where sp.active=true
and sp.district= p2.areacode
and p2.orgtype=3;

update sb_sponsorlicense sp,police p2
set sp.districtOrgId=p2.id
where sp.active=true
and sp.district= p2.areacode
and p2.orgtype=3;

update sb_confesscompany sp,police p2
set sp.districtOrgId=p2.id
where sp.active=true
and sp.district= p2.areacode
and p2.orgtype=3;

update sb_crosscompany sp,police p2
set sp.districtOrgId=p2.id
where sp.active=true
and sp.district= p2.areacode
and p2.orgtype=3;

update sb_confesscompanyundo sp,police p2
set sp.districtOrgId=p2.id
where sp.active=true
and sp.district= p2.areacode
and p2.orgtype=3;

update sb_legalchange sp,police p2
set sp.districtOrgId=p2.id
where sp.active=true
and sp.district= p2.areacode
and p2.orgtype=3;

update yearreportdata sp,police p2
set sp.districtOrgId=p2.id
where sp.active=true
and sp.district= p2.areacode
and p2.orgtype=3;

update sb_traincompanyapply sp,police p2
set sp.districtOrgId=p2.id
where sp.active=true
and sp.district= p2.areacode
and p2.orgtype=3;

#血型分类
delete from sys_dict where codeType='bloodType';
INSERT INTO `sys_dict` ( `isActive`, `codeType`, `tableName`, `description`, `codeValue`, `label`, `seq`)
VALUES ('1', 'bloodType', NULL, '血型分类', 'A', 'A', '1'),
('1', 'bloodType', NULL, '血型分类', 'B', 'B', '2'),
('1', 'bloodType', NULL, '血型分类', 'AB', 'AB', '3'),
('1', 'bloodType', NULL, '血型分类', 'O', 'O', '4'),
('1', 'bloodType', NULL, '血型分类', 'Rh阳', 'Rh阳', '5'),
('1', 'bloodType', NULL, '血型分类', 'Rh阴', 'Rh阴', '6');