request->getAttribute("userInfo") ?? []; $family_id = $this->request->input('family_id'); $result = array(); $result['is_exist'] = 0; // 获取病情记录 $params = array(); $params['user_id'] = $user_info['user_id']; $params['patient_id'] = $user_info['client_user_id']; $params['family_id'] = $family_id; $patient_pathography = PatientPathography::getLastOne($params); if (!empty($patient_pathography)){ $result['is_exist'] = 1; } return success($result); } /** * 获取家庭成员病情记录列表-分页 * @return array */ public function getFamilyPathographyPage(): array { $user_info = $this->request->getAttribute("userInfo") ?? []; $family_id = $this->request->input('family_id'); $page = $this->request->input('page', 1); $per_page = $this->request->input('per_page', 10); // 获取病情记录列表 $fields = [ "pathography_id", "created_at", "disease_class_name", "disease_desc" ]; $params = array(); $params['user_id'] = $user_info['user_id']; $params['patient_id'] = $user_info['client_user_id']; $params['family_id'] = $family_id; $patient_pathographys = PatientPathography::getPatientPathographyPage($params, $fields, $page, $per_page); return success($patient_pathographys); } /** * 获取家庭成员病情记录详情 * @return array */ public function getFamilyPathographyInfo(): array { $user_info = $this->request->getAttribute("userInfo") ?? []; $pathography_id = $this->request->route('pathography_id'); $params = array(); $params['user_id'] = $user_info['user_id']; $params['patient_id'] = $user_info['client_user_id']; $params['pathography_id'] = $pathography_id; $patient_pathography = PatientPathography::getOne($params); if (empty($patient_pathography)){ return success(null); } $result = $patient_pathography->toArray(); $result['order_prescription'] = null; // 处方数据 $result['patient_pathography_product'] = array(); // 用药意向 $result['diagnose_images'] = array(); // 复诊凭证 // 获取处方数据 if (!empty($patient_pathography['order_prescription_id'])){ $params = array(); $params['order_prescription_id'] = $patient_pathography['order_prescription_id']; $params['patient_id'] = $patient_pathography['patient_id']; $params['family_id'] = $patient_pathography['family_id']; $order_prescription = OrderPrescription::getOne($params); if (!empty($order_prescription)){ // 获取处方疾病数据 $params = array(); $params['order_prescription_id'] = $order_prescription['order_prescription_id']; $order_prescription_icds = OrderPrescriptionIcd::getList($params); if (empty($order_prescription_icds)){ return fail(); } $icd_name = array_column($order_prescription_icds->toArray(),"icd_name"); $result['order_prescription']['icd_name'] = implode(";",$icd_name); // 获取处方药品名称 $params = array(); $params['order_prescription_id'] = $order_prescription['order_prescription_id']; $order_prescription_products = OrderPrescriptionProduct::getList($params); if (empty($order_prescription_products)){ return fail(); } $result["order_prescription"]["product"] = $order_prescription_products->toArray(); } } // 获取用药意向 $params = array(); $params['pathography_id'] = $patient_pathography['pathography_id']; $patient_pathography_products = PatientPathographyProduct::getList($params); if (!empty($patient_pathography_products)){ foreach ($patient_pathography_products as $patient_pathography_product){ // 获取商品数据 $params =array(); $params['product_id'] = $patient_pathography_product['product_id']; $product = Product::getOne($params); if (empty($product)){ return fail(); } $item = array(); $item['product_cover_img'] = addAliyunOssWebsite($product['product_cover_img']); $item['product_name'] = $product['product_name']; // 名称 $item['product_spec'] = $product['product_spec']; // 商品规格 $item['packaging_unit'] = $product['packaging_unit']; // 基本包装单位(例:盒/瓶) $item['case_product_num'] = $patient_pathography_product['case_product_num']; // 药品数量 $result['patient_pathography_product'][] = $item; } } // 复诊凭证 if (!empty($patient_pathography['diagnose_images'])){ $diagnose_images = implode(',', $patient_pathography['diagnose_images']); $result['diagnose_images'] = PcreMatch::pregRemoveOssWebsite($diagnose_images); } return success($result); } }