|
@@ -32,6 +32,29 @@ class Cyd extends Model
|
|
|
return $this->belongsTo('underTake', 'undertake_id', 'id');
|
|
|
}
|
|
|
|
|
|
+ //监管端获取抽样单
|
|
|
+ public function getCydListDetail($where,$pageNum=1,$pageSize=null)
|
|
|
+ {
|
|
|
+ $result = $this
|
|
|
+ ->alias('cyd')
|
|
|
+ ->field('sample_id,sample_name,cyd.task_id,place,sample_date,sample_status,test_status,brand,level,sample_base,sample_ground,unit_id as lead_id')
|
|
|
+
|
|
|
+ ->leftjoin('t_undertake a','a.id=cyd.undertake_id')
|
|
|
+ ->field('bear_name,check_name,report_name,a.task_id as underTake_task_id') //bear-抽样单位,report-报告单位,check-检测单位
|
|
|
+
|
|
|
+ ->leftjoin('t_jcdw e','e.id=a.unit_id')
|
|
|
+ ->field('e.name lead_name')//lead_name牵头单位名称
|
|
|
+
|
|
|
+
|
|
|
+ ->leftjoin('t_unit_test b','cyd.id=b.cyd_id')//受检单位
|
|
|
+ ->leftjoin('t_unit_production d','cyd.id=d.cyd_id')//生产单位
|
|
|
+ ->field('unit_test_name,unit_production_name,cyd.undertake_id')
|
|
|
+ ->where($where)
|
|
|
+ ->page($pageNum,$pageSize)
|
|
|
+ ->select();
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
public function getCydListByUndertakeId($undertake_id,$pageNum,$pageSize)
|
|
|
{
|
|
|
$data = $this->with(['undertake','unitTest'])
|
|
@@ -79,14 +102,14 @@ class Cyd extends Model
|
|
|
//这里保留两个task_id是为了以后可能会删除一个
|
|
|
$result = $this
|
|
|
->alias('cyd')
|
|
|
- ->field('sample_id,sample_name,cyd.task_id,place,sample_date,sample_status,test_status')
|
|
|
- ->leftjoin('t_undertake a','a.id=cyd.undertake_id')
|
|
|
- //bear-抽样单位,report-报告单位,check-检测单位
|
|
|
+ ->field('sample_id,sample_name,cyd.task_id,place,sample_date,sample_status,test_status,brand,level,sample_base,sample_ground')
|
|
|
+ ->field('unit_test_name,unit_production_name,cyd.undertake_id')
|
|
|
->field('bear_name,check_name,report_name,a.task_id as underTake_task_id')
|
|
|
|
|
|
+ ->leftjoin('t_undertake a','a.id=cyd.undertake_id')
|
|
|
+ //bear-抽样单位,report-报告单位,check-检测单位
|
|
|
->leftjoin('t_unit_test b','cyd.id=b.cyd_id')//受检单位
|
|
|
->leftjoin('t_unit_production d','cyd.id=d.cyd_id')//生产单位
|
|
|
- ->field('unit_test_name,unit_production_name,cyd.undertake_id')
|
|
|
->where($where)
|
|
|
->page($pageNum,$pageSize)
|
|
|
->select();
|