/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(CaseClosedCreateFormRequest $request) { // $caseClosed = new CaseClosed(array('status' => $request->get('status'), 'status_note' => $request->get('status_note'))); $user = \Auth::user(); $caseClosed->creater()->associate($user); $POrecord = POcase::findOrFail($request->get('POrecord_id')); $POrecord->status = 'CaseClosed'; $POrecord->save(); $caseClosed->POrecord()->associate($POrecord); $caseClosed->save(); return \Redirect::to('research/ngs/projects/show/' . $POrecord->project->id)->with('message', 'Your Case Closed has been updated!'); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(ReportCheckCreateFormRequest $request, $id) { // $reportCheck = ReportCheck::findOrFail($id); $reportCheck->update(array('reviewDate' => $request->get('reviewDate'), 'note' => $request->get('note'), 'reviewer_id' => $request->get('reviewer'))); $reviewer = User::findOrFail($request->get('reviewer')); $reportCheck->reviewer()->associate($reviewer); $analysis = Analysis::findOrFail($request->get('analysis_id')); $reportCheck->analysis()->associate($analysis); $POrecord = POcase::findOrFail($request->get('POrecord_id')); $reportCheck->POrecord()->associate($POrecord); $reportCheck->save(); return \Redirect::to('research/ngs/projects/show/' . $POrecord->project->id)->with('message', 'Your Report Check has been updated!'); }
public function storeStatus(Request $request) { // $POrecord = POcase::findOrFail($request->get('POrecord_id')); $Sequencings = Sequencing::where('POrecord_id', '=', $POrecord->id)->get()->all(); foreach ($Sequencings as $Sequencing) { $Sequencing->status = $request->get('status'); $Sequencing->status_note = $request->get('status_note'); $Sequencing->save(); } return \Redirect::to('research/ngs/projects/show/' . $POrecord->project->id)->with('message', 'Your Sequencing has been updated!'); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(AnalysisCreateFormRequest $request, $id) { // $Analysis = Analysis::findOrFail($id); foreach ($request->get('analysisDetail') as &$Detail) { if (empty($analysisDetail)) { $analysisDetail = $Detail; } else { $analysisDetail = $analysisDetail . "|" . $Detail; } } $Analysis->update(array('caseType' => $request->get('caseType'), 'analysisDetail' => $analysisDetail, 'is_assignDB' => $request->get('is_assignDB'), 'assignDBver' => $request->get('assignDBver'), 'analysisDB' => $request->get('analysisDB'), 'analysisMethod' => $request->get('analysisMethod'), 'analyst' => $request->get('analyst'), 'analysisDate' => $request->get('analysisDate'), 'analysisHour' => $request->get('analysisHour'), 'runHour' => $request->get('runHour'), 'description' => $request->get('description'), 'downloadLink' => $request->get('downloadLink'))); $POrecord = POcase::findOrFail($request->get('POrecord_id')); return \Redirect::to('research/ngs/projects/show/' . $POrecord->project->id)->with('message', 'Your Analysis has been updated!'); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(Request $request, $id) { // $rules = ['QCtype' => 'required', 'operatorDate' => 'required|before:tomorrow', 'measureTool' => 'required', 'fragmentSize' => 'required', 'operator' => 'required', 'figure_1_Path' => 'image', 'figure_2_Path' => 'image', 'figure_3_Path' => 'image', 'figure_4_Path' => 'image', 'figure_nanodrop_Path' => 'image']; $validator = Validator::make($request->all(), $rules); if ($validator->fails()) { return back()->withErrors($validator)->withInput(); } $qualityControl = qualityControl::findOrFail($id); $na_flag = 0; foreach ($request->get('measureTool') as &$tool) { if ($tool == 'N/A') { $na_flag = 1; } if (empty($measureTools)) { $measureTools = $tool; } else { $measureTools = $measureTools . "|" . $tool; } } if ($na_flag == 1 && count($request->get('measureTool')) > 1) { return back()->withErrors(['measureTool' => 'measureTool can not choose N/A with other option.'])->withInput(); } if ($request->get('QCtype') == 'DNA') { $qualityControl->update(array('QCtype' => $request->get('QCtype'), 'operatorDate' => $request->get('operatorDate'), 'measureTool' => $measureTools, 'fragmentSize' => $request->get('fragmentSize'), 'measureNote' => $request->get('measureNote'), 'reportDescription' => $request->get('reportDescription'), 'note' => $request->get('note'), 'operator' => $request->get('operator'))); } elseif ($request->get('QCtype') == 'RNA') { $qualityControl->update(array('QCtype' => $request->get('QCtype'), 'operatorDate' => $request->get('operatorDate'), 'measureTool' => $measureTools, 'fragmentSize' => $request->get('fragmentSize'), 'measureNote' => $request->get('measureNote'), 'rin_28S18S_measure' => $request->get('rin_28S18S_measure'), 'is_differentMethods' => $request->get('is_differentMethods'), 'is_interpretation' => $request->get('is_interpretation'), 'reportDescription' => $request->get('reportDescription'), 'note' => $request->get('note'), 'operator' => $request->get('operator'))); } $operator = User::findOrFail($request->get('operator')); $qualityControl->operator()->associate($operator); $POrecord = POcase::findOrFail($request->get('POrecord_id')); $qualityControl->POrecord()->associate($POrecord); $qualityControl->save(); if (empty($request->file('figure_1_Path'))) { $figure_1_Path = null; } else { $fileName_1 = $qualityControl->id . '_1.' . $request->file('figure_1_Path')->getClientOriginalExtension(); $request->file('figure_1_Path')->move(base_path() . '/storeFiles/ngs/qualityControl/', $fileName_1); $figure_1_Path = base_path() . '/storeFiles/ngs/qualityControl/' . $fileName_1; $qualityControl->update(['figure_1_Path' => $figure_1_Path]); } if (empty($request->file('figure_2_Path'))) { $figure_2_Path = null; } else { $fileName_2 = $qualityControl->id . '_2.' . $request->file('figure_2_Path')->getClientOriginalExtension(); $request->file('figure_2_Path')->move(base_path() . '/storeFiles/ngs/qualityControl/', $fileName_2); $figure_2_Path = base_path() . '/storeFiles/ngs/qualityControl/' . $fileName_2; $qualityControl->update(['figure_2_Path' => $figure_2_Path]); } if (empty($request->file('figure_3_Path'))) { $figure_3_Path = null; } else { $fileName_3 = $qualityControl->id . '_3.' . $request->file('figure_3_Path')->getClientOriginalExtension(); $request->file('figure_3_Path')->move(base_path() . '/storeFiles/ngs/qualityControl/', $fileName_3); $figure_3_Path = base_path() . '/storeFiles/ngs/qualityControl/' . $fileName_3; $qualityControl->update(['figure_3_Path' => $figure_3_Path]); } if (empty($request->file('figure_4_Path'))) { $figure_4_Path = null; } else { $fileName_4 = $qualityControl->id . '_4.' . $request->file('figure_4_Path')->getClientOriginalExtension(); $request->file('figure_4_Path')->move(base_path() . '/storeFiles/ngs/qualityControl/', $fileName_4); $figure_4_Path = base_path() . '/storeFiles/ngs/qualityControl/' . $fileName_4; $qualityControl->update(['figure_4_Path' => $figure_4_Path]); } if (empty($request->file('figure_nanodrop_Path'))) { $figure_nanodrop_Path = null; } else { $fileName_nanodrop = $qualityControl->id . '_nanodrop.' . $request->file('figure_nanodrop_Path')->getClientOriginalExtension(); $request->file('figure_nanodrop_Path')->move(base_path() . '/storeFiles/ngs/qualityControl/', $fileName_nanodrop); $figure_nanodrop_Path = base_path() . '/storeFiles/ngs/qualityControl/' . $fileName_nanodrop; $qualityControl->update(['figure_nanodrop_Path' => $figure_nanodrop_Path]); } $old_QC_Samples = QC_Samples::where('qualityControl_id', '=', $qualityControl->id)->get(); if (!empty($request->get('sampleName'))) { $sampleName = $request->get('sampleName'); $vol_ul = $request->get('vol_ul'); $conc_ng = $request->get('conc_ng'); $qty_ng = $request->get('qty_ng'); $_260_280 = $request->get('260_280'); $_260_230 = $request->get('260_230'); $_28S_18S = $request->get('28S_18S'); $rin = $request->get('rin'); $lane = $request->get('lane'); $comment = $request->get('comment'); $is_buildLibrary = $request->get('is_buildLibrary'); $figure_Path = $request->file('figure_Path'); $max = 0; $indexs = array_keys($sampleName); foreach ($indexs as $index) { if ($index > $max) { $max = $index; } } for ($i = 1; $i <= $max; $i++) { if (!empty($sampleName[$i])) { if ($request->get('QCtype') == 'DNA') { $QC_Samples = new QC_Samples(array('sampleName' => $sampleName[$i], 'vol_ul' => $vol_ul[$i], 'conc_ng' => $conc_ng[$i], 'qty_ng' => $qty_ng[$i], '260_280' => $_260_280[$i], '260_230' => $_260_230[$i], 'lane' => $lane[$i], 'comment' => $comment[$i], 'is_buildLibrary' => $is_buildLibrary[$i], 'operator_id' => $request->get('operator'))); } elseif ($request->get('QCtype') == 'RNA') { $QC_Samples = new QC_Samples(array('sampleName' => $sampleName[$i], 'vol_ul' => $vol_ul[$i], 'conc_ng' => $conc_ng[$i], 'qty_ng' => $qty_ng[$i], '260_280' => $_260_280[$i], '260_230' => $_260_230[$i], '28S_18S' => $_28S_18S[$i], 'rin' => $rin[$i], 'lane' => $lane[$i], 'comment' => $comment[$i], 'is_buildLibrary' => $is_buildLibrary[$i], 'operator_id' => $request->get('operator'))); } $QC_Samples->qualityControl()->associate($qualityControl); $QC_Samples->operator()->associate($operator); $user = \Auth::user(); $QC_Samples->creater()->associate($user); $QC_Samples->save(); $images = glob(base_path() . '/storeFiles/ngs/tmpImage' . \Auth::id() . '/' . $i . '/' . '{*.gif,*.jpg,*.png}', GLOB_BRACE); if (empty($images)) { if (empty($old_QC_Samples)) { $figure_Path = null; } else { if ($i <= count($old_QC_Samples)) { if (!empty($old_QC_Samples[$i - 1]->figure_Path)) { if (preg_match("/\\.(.+)/", $old_QC_Samples[$i - 1]->figure_Path, $matches)) { // Valid match $fileExtesion = $matches[1]; } $fileName = $QC_Samples->id . '.' . $fileExtesion; $flag = \File::move($old_QC_Samples[$i - 1]->figure_Path, base_path() . '/storeFiles/ngs/QC_Samples/' . $fileName); $figure_Path = base_path() . '/storeFiles/ngs/QC_Samples/' . $fileName; } } else { $figure_Path = null; } } } else { if (preg_match("/\\.(.+)/", $images[0], $matches)) { // Valid match $fileExtesion = $matches[1]; } $fileName = $QC_Samples->id . '.' . $fileExtesion; $flag = \File::move($images[0], base_path() . '/storeFiles/ngs/QC_Samples/' . $fileName); $figure_Path = base_path() . '/storeFiles/ngs/QC_Samples/' . $fileName; } if (!empty($figure_Path)) { $QC_Samples->update(['figure_Path' => $figure_Path]); } } } } foreach ($old_QC_Samples as $old_QC_Sample) { if (!empty($old_QC_Sample->figure_Path)) { if (\File::exists($old_QC_Sample->figure_Path)) { \File::delete($old_QC_Sample->figure_Path); } } $old_QC_Sample->delete(); } return \Redirect::to('research/ngs/projects/show/' . $POrecord->project->id)->with('message', 'Your Quality Control has been updated!'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // $user = \Auth::user(); $POcase = POcase::findOrFail($id); $project = $POcase->project; $POcase->delete(); return \Redirect::to('research/ngs/projects/show/' . $project->id)->with('message', 'Your Case has been deleted!'); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(ExaminationCreateFormRequest $request) { $POrecord = POcase::findOrFail($request->get('POrecord_id')); Examination::where('POrecord_id', '=', $POrecord->id)->delete(); $sampleName = $request->get('sampleName'); $indexNo = $request->get('indexNo'); $barcode = $request->get('barcode'); $sequencingDate = $request->get('sequencingDate'); $afterQuantity = $request->get('afterQuantity'); $Q20 = $request->get('Q20'); $Q30 = $request->get('Q30'); $operator = $request->get('operator'); $operatorDate = $request->get('operatorDate'); $note = $request->get('note'); $Sequencing_id = $request->get('Sequencing_id'); $max = sizeof($sampleName); for ($i = 0; $i < $max; $i++) { if (!empty($sampleName[$i])) { $Examination = new Examination(array('sampleName' => $sampleName[$i], 'indexNo' => $indexNo[$i], 'barcode' => $barcode[$i], 'sequencingDate' => $sequencingDate[$i], 'afterQuantity' => $afterQuantity[$i], 'Q20' => $Q20[$i], 'Q30' => $Q30[$i], 'operatorDate' => $operatorDate[$i], 'note' => $note[$i])); $Examination->POrecord()->associate($POrecord); $sampleOperator = User::findOrFail($operator[$i]); $Examination->operator()->associate($sampleOperator); $Sequencing = Sequencing::findOrFail($Sequencing_id[$i]); $Examination->Sequencing()->associate($Sequencing); $Examination->save(); } } return \Redirect::to('research/ngs/examination/edit/' . $POrecord->project->id)->with('message', 'Your Examination has been updated!'); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(Request $request, $id) { // $rules = array('speices' => 'required', 'classify' => 'required', 'type' => 'required', 'condition' => 'required', 'SampleExtration' => 'required', 'ribosomalDepletion' => 'required', 'operator' => 'required', 'sender' => 'required', 'sampleNum' => 'required', 'shippingCondition' => 'required', 'salesman' => 'required_with:salesmanGetDate', 'labman' => 'required_with:labmanGetDate', 'salesmanGetDate' => 'date|required_without:labmanGetDate|required_with:salesman|before:tomorrow', 'labmanGetDate' => 'date|required_without:salesmanGetDate|required_with:labman|before:tomorrow'); if (empty($request->get('salesmanGetDate'))) { $rules['sampleGetDate'] = 'required|date|before:labmanGetDate'; } elseif (empty($request->get('labmanGetDate'))) { $rules['sampleGetDate'] = 'required|date|before:salesmanGetDate'; } else { if ($request->get('salesmanGetDate') > $request->get('labmanGetDate')) { $rules['sampleGetDate'] = 'required|date|before:labmanGetDate'; } else { $rules['sampleGetDate'] = 'required|date|before:salesmanGetDate'; } } $validator = Validator::make($request->all(), $rules); if ($validator->fails()) { return back()->withErrors($validator)->withInput(); } $extraction = Extraction::findOrFail($id); $extraction->update(['speices' => $request->get('speices'), 'classify' => $request->get('classify'), 'type' => $request->get('type'), 'condition' => $request->get('condition'), 'is_treatRNase' => $request->get('is_treatRNase'), 'RNAisolationMethod' => $request->get('RNAisolationMethod'), 'note' => $request->get('note'), 'SampleExtration' => $request->get('SampleExtration'), 'ribosomalDepletion' => $request->get('ribosomalDepletion'), 'operator' => $request->get('operator'), 'create_at' => $request->get('create_at')]); $operator = User::findOrFail($request->get('operator')); $extraction->operator()->associate($operator); $POrecord = POcase::findOrFail($request->get('POrecord_id')); $extraction->POrecord()->associate($POrecord); $Shipment = new Shipment(array('sender' => $request->get('sender'), 'sampleGetDate' => $request->get('sampleGetDate'), 'sampleNum' => $request->get('sampleNum'), 'salesman' => $request->get('salesman'), 'salesmanGetDate' => $request->get('salesmanGetDate'), 'shippingCondition' => $request->get('shippingCondition'), 'labman' => $request->get('labman'), 'labmanGetDate' => $request->get('labmanGetDate'))); $user = User::find(\Auth::id()); $Shipment->creater()->associate($user); $Shipment->extraction()->associate($extraction); $Shipment->save(); $extraction->Shipment_id = $Shipment->id; $extraction->save(); $POrecord->save(); return \Redirect::to('research/ngs/projects/show/' . $POrecord->project->id)->with('message', 'Your Extraction has been updated!'); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(Request $request, $id) { $rules = ['libraryKit' => 'required', 'operatorDate' => 'required', 'measureTool' => 'required', 'fragmentSize' => 'required', 'operator' => 'required']; $validator = Validator::make($request->all(), $rules); if ($validator->fails()) { return back()->withErrors($validator)->withInput(); } $library = Library::findOrFail($id); $library->update(array('libraryKit' => $request->get('libraryKit'), 'operatorDate' => $request->get('operatorDate'), 'measureTool' => $request->get('measureTool'), 'fragmentSize' => $request->get('fragmentSize'), 'measureNote' => $request->get('measureNote'), 'reportDescription' => $request->get('reportDescription'), 'note' => $request->get('note'), 'operator' => $request->get('operator'))); $operator = User::findOrFail($request->get('operator')); $library->operator()->associate($operator); $POrecord = POcase::findOrFail($request->get('POrecord_id')); $library->POrecord()->associate($POrecord); $library->save(); $old_library_Samples = Library_Samples::where('library_id', '=', $library->id)->get(); if (!empty($request->get('sampleName'))) { $sampleName = $request->get('sampleName'); $vol = $request->get('vol'); $index = $request->get('index'); $barcode = $request->get('barcode'); $Qubit_ngul = $request->get('Qubit_ngul'); $B_TS_bp = $request->get('B_TS_bp'); $B_TS_ngul = $request->get('B_TS_ngul'); $B_TS_nM = $request->get('B_TS_nM'); $ND_ngul = $request->get('ND_ngul'); $OD_260_280 = $request->get('OD_260_280'); $OD_260_230 = $request->get('OD_260_230'); $result = $request->get('result'); $figure_Path = $request->file('figure_Path'); $max = 0; $sampleIndexs = array_keys($sampleName); foreach ($sampleIndexs as $sampleIndex) { if ($sampleIndex > $max) { $max = $sampleIndex; } } for ($i = 1; $i <= $max; $i++) { if (!empty($sampleName[$i])) { $library_Samples = new Library_Samples(array('sampleName' => $sampleName[$i], 'vol' => $vol[$i], 'index' => $index[$i], 'barcode' => $barcode[$i], 'Qubit_ngul' => $Qubit_ngul[$i], 'B_TS_bp' => $B_TS_bp[$i], 'B_TS_ngul' => $B_TS_ngul[$i], 'B_TS_nM' => $B_TS_nM[$i], 'ND_ngul' => $ND_ngul[$i], 'OD_260_280' => $OD_260_280[$i], 'OD_260_230' => $OD_260_230[$i], 'result' => $result[$i])); $library_Samples->library()->associate($library); $user = \Auth::user(); $library_Samples->creater()->associate($user); $library_Samples->save(); $images = glob(base_path() . '/storeFiles/ngs/tmpImage' . \Auth::id() . '/' . $i . '/' . '{*.gif,*.jpg,*.png}', GLOB_BRACE); if (empty($images)) { if (empty($old_library_Samples)) { $figure_Path = null; } else { if ($i <= count($old_library_Samples)) { if (!empty($old_library_Samples[$i - 1]->figure_Path)) { if (preg_match("/\\.(.+)/", $old_library_Samples[$i - 1]->figure_Path, $matches)) { // Valid match $fileExtesion = $matches[1]; } $fileName = $library_Samples->id . '.' . $fileExtesion; $flag = \File::move($old_library_Samples[$i - 1]->figure_Path, base_path() . '/storeFiles/ngs/library_Samples/' . $fileName); $figure_Path = base_path() . '/storeFiles/ngs/library_Samples/' . $fileName; } } else { $figure_Path = null; } } } else { if (preg_match("/\\.(.+)/", $images[0], $matches)) { // Valid match $fileExtesion = $matches[1]; } $fileName = $library_Samples->id . '.' . $fileExtesion; $flag = \File::move($images[0], base_path() . '/storeFiles/ngs/library_Samples/' . $fileName); $figure_Path = base_path() . '/storeFiles/ngs/library_Samples/' . $fileName; } if (!empty($figure_Path)) { $library_Samples->update(['figure_Path' => $figure_Path]); } } } } foreach ($old_library_Samples as $old_library_Sample) { if (!empty($old_library_Sample->figure_Path)) { if (\File::exists($old_library_Sample->figure_Path)) { \File::delete($old_library_Sample->figure_Path); } } $old_library_Sample->delete(); } return \Redirect::to('research/ngs/projects/show/' . $POrecord->project->id)->with('message', 'Your Library has been updated!'); }