TYPE=VIEW
query=(select `heatwatch`.`cow`.`varCowCode` AS `varCowCode`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,\'人工报告\' AS `sort`,concat(\'牛舍:\',if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\'),\'h，DIM:\',`heatwatch`.`cow`.`lactationDays`,\'，配后天数:\',if((`heatwatch`.`cow`.`dateCurPz` is not null),`heatwatch`.`cow`.`hybriDays`,\'\')) AS `DISCRIBE`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId`,1 AS `rtype`,round(timestampdiff(HOUR,`heatwatch`.`assist`.`eventDateTime`,now()),0) AS `afterwarn` from (`heatwatch`.`cow` join `heatwatch`.`assist` on(((`heatwatch`.`cow`.`intCowId` = `heatwatch`.`assist`.`intCowId`) and (`heatwatch`.`assist`.`sort` = 1) and ((to_days(curdate()) - to_days(`heatwatch`.`assist`.`eventDateTime`)) < 3) and (`heatwatch`.`cow`.`sireClass` <> \'已孕\') and isnull(`heatwatch`.`assist`.`checkDateTime`))))) union all (select `heatwatch`.`cow`.`varCowCode` AS `varCowCode`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,concat(\'高活动量\',if((`heatwatch`.`v_v_hact`.`actlevel` = 3),\'+++\',if((`heatwatch`.`v_v_hact`.`actlevel` = 2),\'++\',\'+\')),\'， 配后天数:\',if((`heatwatch`.`cow`.`dateCurPz` is not null),`heatwatch`.`cow`.`hybriDays`,\'\')) AS `sort`,concat(\'牛舍:\',if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\'),\'，报警后：\',round(timestampdiff(HOUR,`heatwatch`.`v_v_hact`.`datetime`,now()),0),\'h，DIM:\',`heatwatch`.`cow`.`lactationDays`) AS `DISCRIBE`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId`,1 AS `rtype`,round(timestampdiff(HOUR,`heatwatch`.`v_v_hact`.`datetime`,now()),0) AS `afterwarn` from (`heatwatch`.`cow` join `heatwatch`.`v_v_hact` on(((`heatwatch`.`cow`.`varCowCode` = `heatwatch`.`v_v_hact`.`varcowcode`) and (`heatwatch`.`cow`.`sireClass` <> \'已孕\')))) where (((to_days(ifnull(`heatwatch`.`cow`.`dateCurPz`,\'2016-12-01\')) - to_days(`heatwatch`.`v_v_hact`.`datetime`)) < 0) and ((`heatwatch`.`cow`.`hybriDays` > 3) or ((`heatwatch`.`cow`.`hybriDays` = 0) and (`heatwatch`.`cow`.`lactationDays` >= 50))) and (`heatwatch`.`cow`.`sireClass` <> \'禁配\')))
md5=abb7c07ebde7af4895c4310cfc0b030d
updatable=0
algorithm=0
definer_user=roo
definer_host=%
suid=1
with_check_option=0
timestamp=2022-12-14 10:07:39
create-version=1
source=(select `cow`.`varCowCode` AS `varCowCode`,if(`cow`.`intCurBar` > 0,`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,\'人工报告\' AS `sort`,concat(\'牛舍:\',if(`cow`.`intCurBar` > 0,`cow`.`intCurBarName`,\'待分配\'),\'h，DIM:\',`cow`.`lactationDays`,\'，配后天数:\',if(`cow`.`dateCurPz` is not null,`cow`.`hybriDays`,\'\')) AS `DISCRIBE`,`cow`.`intPastureId` AS `intPastureId`,1 AS `rtype`,round(timestampdiff(HOUR,`assist`.`eventDateTime`,current_timestamp()),0) AS `afterwarn` from (`cow` join `assist` on(`cow`.`intCowId` = `assist`.`intCowId` and `assist`.`sort` = 1 and to_days(curdate()) - to_days(`assist`.`eventDateTime`) < 3 and `cow`.`sireClass` <> \'已孕\' and `assist`.`checkDateTime` is null))) union all (select `cow`.`varCowCode` AS `varCowCode`,if(`cow`.`intCurBar` > 0,`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,concat(\'高活动量\',if(`v_v_hact`.`actlevel` = 3,\'+++\',if(`v_v_hact`.`actlevel` = 2,\'++\',\'+\')),\'， 配后天数:\',if(`cow`.`dateCurPz` is not null,`cow`.`hybriDays`,\'\')) AS `sort`,concat(\'牛舍:\',if(`cow`.`intCurBar` > 0,`cow`.`intCurBarName`,\'待分配\'),\'，报警后：\',round(timestampdiff(HOUR,`v_v_hact`.`datetime`,current_timestamp()),0),\'h，DIM:\',`cow`.`lactationDays`) AS `DISCRIBE`,`cow`.`intPastureId` AS `intPastureId`,1 AS `rtype`,round(timestampdiff(HOUR,`v_v_hact`.`datetime`,current_timestamp()),0) AS `afterwarn` from (`cow` join `v_v_hact` on(`cow`.`varCowCode` = `v_v_hact`.`varcowcode` and `cow`.`sireClass` <> \'已孕\')) where to_days(ifnull(`cow`.`dateCurPz`,\'2016-12-01\')) - to_days(`v_v_hact`.`datetime`) < 0 and (`cow`.`hybriDays` > 3 or `cow`.`hybriDays` = 0 and `cow`.`lactationDays` >= 50) and `cow`.`sireClass` <> \'禁配\')
client_cs_name=utf8
connection_cl_name=utf8_general_ci
view_body_utf8=(select `heatwatch`.`cow`.`varCowCode` AS `varCowCode`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,\'人工报告\' AS `sort`,concat(\'牛舍:\',if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\'),\'h，DIM:\',`heatwatch`.`cow`.`lactationDays`,\'，配后天数:\',if((`heatwatch`.`cow`.`dateCurPz` is not null),`heatwatch`.`cow`.`hybriDays`,\'\')) AS `DISCRIBE`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId`,1 AS `rtype`,round(timestampdiff(HOUR,`heatwatch`.`assist`.`eventDateTime`,now()),0) AS `afterwarn` from (`heatwatch`.`cow` join `heatwatch`.`assist` on(((`heatwatch`.`cow`.`intCowId` = `heatwatch`.`assist`.`intCowId`) and (`heatwatch`.`assist`.`sort` = 1) and ((to_days(curdate()) - to_days(`heatwatch`.`assist`.`eventDateTime`)) < 3) and (`heatwatch`.`cow`.`sireClass` <> \'已孕\') and isnull(`heatwatch`.`assist`.`checkDateTime`))))) union all (select `heatwatch`.`cow`.`varCowCode` AS `varCowCode`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,concat(\'高活动量\',if((`heatwatch`.`v_v_hact`.`actlevel` = 3),\'+++\',if((`heatwatch`.`v_v_hact`.`actlevel` = 2),\'++\',\'+\')),\'， 配后天数:\',if((`heatwatch`.`cow`.`dateCurPz` is not null),`heatwatch`.`cow`.`hybriDays`,\'\')) AS `sort`,concat(\'牛舍:\',if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\'),\'，报警后：\',round(timestampdiff(HOUR,`heatwatch`.`v_v_hact`.`datetime`,now()),0),\'h，DIM:\',`heatwatch`.`cow`.`lactationDays`) AS `DISCRIBE`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId`,1 AS `rtype`,round(timestampdiff(HOUR,`heatwatch`.`v_v_hact`.`datetime`,now()),0) AS `afterwarn` from (`heatwatch`.`cow` join `heatwatch`.`v_v_hact` on(((`heatwatch`.`cow`.`varCowCode` = `heatwatch`.`v_v_hact`.`varcowcode`) and (`heatwatch`.`cow`.`sireClass` <> \'已孕\')))) where (((to_days(ifnull(`heatwatch`.`cow`.`dateCurPz`,\'2016-12-01\')) - to_days(`heatwatch`.`v_v_hact`.`datetime`)) < 0) and ((`heatwatch`.`cow`.`hybriDays` > 3) or ((`heatwatch`.`cow`.`hybriDays` = 0) and (`heatwatch`.`cow`.`lactationDays` >= 50))) and (`heatwatch`.`cow`.`sireClass` <> \'禁配\')))
