TYPE=VIEW
query=select distinct `heatwatch`.`cow`.`varCowCode` AS `varCowCode`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,\'正常发情\' AS `sort`,if(((to_days(curdate()) - to_days(`s1`.`dateEvtDate`)) > -(1)),concat(if((`v6`.`afterwarn` > 0),concat(\'高峰后\',`v6`.`afterwarn`,\'h，\'),concat(\'发情天数\',(to_days(curdate()) - to_days(`s1`.`dateEvtDate`)))),\',发情评分:\',if((`heatwatch`.`estrus`.`intScore` = 3),\'+++\',if((`heatwatch`.`estrus`.`intScore` = 2),\'++\',\'+\')),\' DIM:\',ifnull(`heatwatch`.`cow`.`lactationDays`,0)),concat(\'DIM:\',ifnull(`heatwatch`.`cow`.`lactationDays`,0))) AS `DESCRIB`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId` from ((((`heatwatch`.`cow` left join `heatwatch`.`events` `s1` on(((`heatwatch`.`cow`.`intCowId` = `s1`.`intCowId`) and (`s1`.`intClass` = \'发情\')))) left join `heatwatch`.`estrus` on((`s1`.`intEvtId` = `heatwatch`.`estrus`.`intEvtId`))) left join `heatwatch`.`v_a_eact` `v6` on((`heatwatch`.`cow`.`varCowCode` = `v6`.`varcowcode`))) join `heatwatch`.`manageparam` `m` on(((`heatwatch`.`cow`.`intPastureId` = `m`.`intPastureId`) and (`m`.`varDiscribe` = \'产后几天配种\')))) where (((to_days(curdate()) - to_days(`s1`.`dateEvtDate`)) < 4) and ((to_days(ifnull(`heatwatch`.`cow`.`dateCurPz`,\'2016-1-1\')) - to_days(`s1`.`dateEvtDate`)) < 0) and (ifnull(`heatwatch`.`cow`.`lactationDays`,0) >= `m`.`varVal`) and isnull(`heatwatch`.`cow`.`dateLeave`) and (not(`heatwatch`.`cow`.`intCowId` in (select `heatwatch`.`assist`.`intCowId` from `heatwatch`.`assist` where ((`heatwatch`.`assist`.`sort` in (1,2)) and ((to_days(curdate()) - to_days(`heatwatch`.`assist`.`eventDateTime`)) < 3) and isnull(`heatwatch`.`assist`.`checkDateTime`)))))) order by `heatwatch`.`cow`.`intCurBarName`,`heatwatch`.`cow`.`varCowCode`
md5=964421c460eac0d6bf36fb8c6358fb03
updatable=0
algorithm=0
definer_user=root
definer_host=%
suid=1
with_check_option=0
timestamp=2022-12-14 10:07:39
create-version=1
source=select distinct `cow`.`varCowCode` AS `varCowCode`,if(`cow`.`intCurBar` > 0,`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,\'正常发情\' AS `sort`,if(to_days(curdate()) - to_days(`s1`.`dateEvtDate`) > -1,concat(if(`v6`.`afterwarn` > 0,concat(\'高峰后\',`v6`.`afterwarn`,\'h，\'),concat(\'发情天数\',to_days(curdate()) - to_days(`s1`.`dateEvtDate`))),\',发情评分:\',if(`estrus`.`intScore` = 3,\'+++\',if(`estrus`.`intScore` = 2,\'++\',\'+\')),\' DIM:\',ifnull(`cow`.`lactationDays`,0)),concat(\'DIM:\',ifnull(`cow`.`lactationDays`,0))) AS `DESCRIB`,`cow`.`intPastureId` AS `intPastureId` from ((((`cow` left join `events` `s1` on(`cow`.`intCowId` = `s1`.`intCowId` and `s1`.`intClass` = \'发情\')) left join `estrus` on(`s1`.`intEvtId` = `estrus`.`intEvtId`)) left join `v_a_eact` `v6` on(`cow`.`varCowCode` = `v6`.`varcowcode`)) join `manageparam` `m` on(`cow`.`intPastureId` = `m`.`intPastureId` and `m`.`varDiscribe` = \'产后几天配种\')) where to_days(curdate()) - to_days(`s1`.`dateEvtDate`) < 4 and to_days(ifnull(`cow`.`dateCurPz`,\'2016-1-1\')) - to_days(`s1`.`dateEvtDate`) < 0 and ifnull(`cow`.`lactationDays`,0) >= `m`.`varVal` and `cow`.`dateLeave` is null and !(`cow`.`intCowId` in (select `assist`.`intCowId` from `assist` where `assist`.`sort` in (1,2) and to_days(curdate()) - to_days(`assist`.`eventDateTime`) < 3 and `assist`.`checkDateTime` is null)) order by `cow`.`intCurBarName`,`cow`.`varCowCode`
client_cs_name=utf8
connection_cl_name=utf8_general_ci
view_body_utf8=select distinct `heatwatch`.`cow`.`varCowCode` AS `varCowCode`,if((`heatwatch`.`cow`.`intCurBar` > 0),`heatwatch`.`cow`.`intCurBarName`,\'待分配\') AS `intCurBarName`,\'正常发情\' AS `sort`,if(((to_days(curdate()) - to_days(`s1`.`dateEvtDate`)) > -(1)),concat(if((`v6`.`afterwarn` > 0),concat(\'高峰后\',`v6`.`afterwarn`,\'h，\'),concat(\'发情天数\',(to_days(curdate()) - to_days(`s1`.`dateEvtDate`)))),\',发情评分:\',if((`heatwatch`.`estrus`.`intScore` = 3),\'+++\',if((`heatwatch`.`estrus`.`intScore` = 2),\'++\',\'+\')),\' DIM:\',ifnull(`heatwatch`.`cow`.`lactationDays`,0)),concat(\'DIM:\',ifnull(`heatwatch`.`cow`.`lactationDays`,0))) AS `DESCRIB`,`heatwatch`.`cow`.`intPastureId` AS `intPastureId` from ((((`heatwatch`.`cow` left join `heatwatch`.`events` `s1` on(((`heatwatch`.`cow`.`intCowId` = `s1`.`intCowId`) and (`s1`.`intClass` = \'发情\')))) left join `heatwatch`.`estrus` on((`s1`.`intEvtId` = `heatwatch`.`estrus`.`intEvtId`))) left join `heatwatch`.`v_a_eact` `v6` on((`heatwatch`.`cow`.`varCowCode` = `v6`.`varcowcode`))) join `heatwatch`.`manageparam` `m` on(((`heatwatch`.`cow`.`intPastureId` = `m`.`intPastureId`) and (`m`.`varDiscribe` = \'产后几天配种\')))) where (((to_days(curdate()) - to_days(`s1`.`dateEvtDate`)) < 4) and ((to_days(ifnull(`heatwatch`.`cow`.`dateCurPz`,\'2016-1-1\')) - to_days(`s1`.`dateEvtDate`)) < 0) and (ifnull(`heatwatch`.`cow`.`lactationDays`,0) >= `m`.`varVal`) and isnull(`heatwatch`.`cow`.`dateLeave`) and (not(`heatwatch`.`cow`.`intCowId` in (select `heatwatch`.`assist`.`intCowId` from `heatwatch`.`assist` where ((`heatwatch`.`assist`.`sort` in (1,2)) and ((to_days(curdate()) - to_days(`heatwatch`.`assist`.`eventDateTime`)) < 3) and isnull(`heatwatch`.`assist`.`checkDateTime`)))))) order by `heatwatch`.`cow`.`intCurBarName`,`heatwatch`.`cow`.`varCowCode`
