<?
//夜间下降率
$nightSbpUp = round(($sumSunArr['sbp']['average']-$sumNightArr['sbp']['average'])/$sumSunArr['sbp']['average'] * 100,2);
$nightDbpUp = round(($sumSunArr['dbp']['average']-$sumNightArr['dbp']['average'])/$sumSunArr['dbp']['average'] * 100,2);

function pinggu($sbp,$dbp, $sbpMax, $dbpMax){
    $text = '';
    $sbpTxt = $sbp;
    $dbpTxt = $dbp;
    if($sbp<$sbpMax && $dbp<$dbpMax){
        $text = '正常';
    }else if($sbp<$sbpMax && $dbp>=$dbpMax){
        //$text = '收缩压正常,舒张压升高';
        $text = '升高';
        $dbpTxt = '<span class="light">'.$dbp.'</span>';
    }else if($sbp>=$sbpMax && $dbp<$dbpMax){
        //$text = '收缩压升高,舒张压正常';
        $text = '升高';
        $sbpTxt = '<span class="light">'.$sbp.'</span>';
    }else if($sbp>=$sbpMax && $dbp>=$dbpMax){
        $text = '升高';
        $sbpTxt = '<span class="light">'.$sbp.'</span>';
        $dbpTxt = '<span class="light">'.$dbp.'</span>';
    }
    $text .= ' ( '.$sbpTxt.' / '.$dbpTxt.' 参考 < '.$sbpMax.' / '.$dbpMax.' )';
    return $text;
}

function pinggu2($nightSbpUp,$nightDbpUp,$standardArr)
{
    $text = '正常';
    $nightSbpUp *= 1;
    $nightDbpUp *= 1;
    if($nightSbpUp<0 || $nightDbpUp<0){
        $text = '反杓型';
    }else if($nightSbpUp>$standardArr['nightUp']['max'] || $nightDbpUp>$standardArr['nightUp']['max']){
        $text = '超杓型';
    }else if(($nightSbpUp>0 && $nightSbpUp<$standardArr['nightUp']['min']) ||
        ($nightDbpUp>0 && $nightDbpUp<$standardArr['nightUp']['min'])
    ) {
        $text = '非杓型';
    }
    $nightSbpUpTxt = $nightSbpUp.'%';
    $nightDbpUpTxt = $nightDbpUp.'%';
    if($nightSbpUp<$standardArr['nightUp']['min'] || $nightSbpUp>$standardArr['nightUp']['max']){
        $nightSbpUpTxt = '<span class="light">'.$nightSbpUp.'%</span>';
    }
    if($nightDbpUp<$standardArr['nightUp']['min'] || $nightDbpUp>$standardArr['nightUp']['max']){
        $nightDbpUpTxt = '<span class="light">'.$nightDbpUp.'%</span>';
    }
    return '血压昼夜节律: '.$text . ' ( '.$nightSbpUpTxt.' / '.$nightDbpUpTxt.' 参考 > '.$standardArr['nightUp']['min'].'% ~ '.$standardArr['nightUp']['max'].'% )';
}
?>
<style>
.list-group-item span.light{color:red}
.text-muted {
    color: #333 !important;
}  
.card-text{line-height:1rem}

.sptable1{width:100%}

.sptable1 thead, .sptable1 tr {
border-top-width: 1px;
border-top-style: solid;
border-top-color: rgb(189, 189, 189);
}
.sptable1 {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: rgb(189, 189, 230);
}
.sptable1 thead th{
color:#000;
} 
 
/* Padding and font style */
.sptable1 td, .sptable1 th {
padding: 10px 10px;
font-size: 14px;
font-family: Verdana;
color: #797DA3;
}
 
 
/* Alternating background colors */
.sptable1 tr:nth-child(even) {
background: #D3DFED
}
.sptable1 tr:nth-child(odd) {
background: #FFF
}
</style>
<div class="list-group">
  <a href="#" class="list-group-item list-group-item-action flex-column align-items-start active">
    <div class="d-flex w-100 justify-content-between">
      <h5 class="mb-1">报告评估</h5>
      <small></small>
    </div>
  </a>
  <a href="javascript:;" class="list-group-item list-group-item-action flex-column align-items-start">
    <div class="d-flex w-100 justify-content-between">
      <small class="text-muted">24 h: <?=pinggu($sumAllArr['sbp']['average'],$sumAllArr['dbp']['average'],$standardArr[24]['max'],$standardArr[24]['min'])?></small>
    </div>
  </a>
  <a href="javascript:;" class="list-group-item list-group-item-action flex-column align-items-start">
    <div class="d-flex w-100 justify-content-between">
      <small class="text-muted">白天: <?=pinggu($sumSunArr['sbp']['average'],$sumSunArr['dbp']['average'],$standardArr['sbp']['sun']['max'],$standardArr['dbp']['sun']['max'])?></small>
      <small class="text-muted"></small>
    </div>
  </a>
  <a href="javascript:;" class="list-group-item list-group-item-action flex-column align-items-start">
    <div class="d-flex w-100 justify-content-between">
      <small class="text-muted">夜间: <?=pinggu($sumNightArr['sbp']['average'],$sumNightArr['dbp']['average'],$standardArr['sbp']['night']['max'],$standardArr['dbp']['night']['max'])?></small>
    </div>
  </a>
  <a href="javascript:;" class="list-group-item list-group-item-action flex-column align-items-start">
    <div class="d-flex w-100 justify-content-between">
      <small class="text-muted">晨峰: <?=pinggu($sumMorningArr['sbp']['average'],$sumMorningArr['dbp']['average'],$standardArr['sbp']['morning']['max'],$standardArr['dbp']['morning']['max'])?></small>
      
    </div>
  </a>
  <a href="javascript:;" class="list-group-item list-group-item-action flex-column align-items-start">
    <div class="d-flex w-100 justify-content-between">
      <small class="text-muted"><?=pinggu2($nightSbpUp,$nightDbpUp,$standardArr)?></small>
    </div>
  </a>
  <a href="javascript:;" class="list-group-item list-group-item-action flex-column align-items-start">
    <div class="d-flex w-100 justify-content-between">
      <? $slopeTxt = $slope >= 0.55 ? '升高 ( <span class="light">'.$slope.'</span>' : '正常 ( '.$slope;?>
      <small class="text-muted">动态动脉硬化指数: <?=$slopeTxt?> 参考 < 0.55 ) </small>
    </div>
  </a>
</div>