新增 获取家庭成员用药记录列表
This commit is contained in:
parent
1772d4c20f
commit
e2486d8047
@ -210,9 +210,6 @@ class PatientFamilyController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function getFamilyProductRecord(): ResponseInterface
|
public function getFamilyProductRecord(): ResponseInterface
|
||||||
{
|
{
|
||||||
$request = $this->container->get(PatientFamilyRequest::class);
|
|
||||||
$request->scene('getFamilyProductRecordList')->validateResolved();
|
|
||||||
|
|
||||||
$patientFamilyService = new PatientFamilyService();
|
$patientFamilyService = new PatientFamilyService();
|
||||||
$data = $patientFamilyService->getFamilyProductRecord();
|
$data = $patientFamilyService->getFamilyProductRecord();
|
||||||
return $this->response->json($data);
|
return $this->response->json($data);
|
||||||
|
|||||||
@ -74,6 +74,30 @@ class OrderProduct extends Model
|
|||||||
return $this->HasMany(OrderProductItem::class, 'order_product_id','order_product_id');
|
return $this->HasMany(OrderProductItem::class, 'order_product_id','order_product_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联订单-处方表
|
||||||
|
*/
|
||||||
|
public function OrderPrescription(): HasOne
|
||||||
|
{
|
||||||
|
return $this->hasOne(OrderPrescription::class, 'order_prescription_id','order_prescription_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联患者家庭成员信息表-基本信息
|
||||||
|
*/
|
||||||
|
public function PatientFamily(): HasOne
|
||||||
|
{
|
||||||
|
return $this->hasOne(PatientFamily::class, 'family_id','family_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联处方关联疾病表
|
||||||
|
*/
|
||||||
|
public function OrderPrescriptionIcd(): HasMany
|
||||||
|
{
|
||||||
|
return $this->HasMany(OrderPrescriptionIcd::class, 'order_prescription_id','order_prescription_id');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取信息-单条
|
* 获取信息-单条
|
||||||
* @param array $params
|
* @param array $params
|
||||||
@ -162,4 +186,33 @@ class OrderProduct extends Model
|
|||||||
{
|
{
|
||||||
return self::create($data);
|
return self::create($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 患者用药记录查询
|
||||||
|
* @param array $params
|
||||||
|
* @param array $fields
|
||||||
|
* @param int|null $page
|
||||||
|
* @param int|null $per_page
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getProductRecordPage(array $params,array $fields = ["*"], int $page = null, ?int $per_page = 10): array
|
||||||
|
{
|
||||||
|
$result = self::with([
|
||||||
|
"OrderProductItem:product_item_id,order_product_id,product_id,product_name,amount,manufacturer,product_cover_img,product_spec",
|
||||||
|
"OrderPrescriptionIcd:prescription_icd_id,order_prescription_id,icd_id,icd_name",
|
||||||
|
"PatientFamily:family_id,card_name_mask,sex,age",
|
||||||
|
])
|
||||||
|
->where($params)
|
||||||
|
->paginate($per_page, $fields, "page", $page);
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['current_page'] = $result->currentPage();// 当前页码
|
||||||
|
$data['total'] = $result->total();// 数据总数
|
||||||
|
$data['data'] = $result->items();// 数据
|
||||||
|
$data['per_page'] = $result->perPage();// 每页个数
|
||||||
|
$data['last_page'] = $result->lastPage();// 最后一页
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,11 +54,6 @@ class PatientFamily extends Model
|
|||||||
*/
|
*/
|
||||||
protected array $fillable = ['family_id', 'patient_id', 'relation', 'status', 'is_default', 'card_name', 'card_name_mask', 'mobile', 'mobile_mask', 'type', 'id_number', 'id_number_mask', 'sex', 'age', 'province_id', 'province', 'city_id', 'city', 'county_id', 'county', 'height', 'weight', 'marital_status', 'nation_id', 'nation_name', 'job_id', 'job_name', 'created_at', 'updated_at'];
|
protected array $fillable = ['family_id', 'patient_id', 'relation', 'status', 'is_default', 'card_name', 'card_name_mask', 'mobile', 'mobile_mask', 'type', 'id_number', 'id_number_mask', 'sex', 'age', 'province_id', 'province', 'city_id', 'city', 'county_id', 'county', 'height', 'weight', 'marital_status', 'nation_id', 'nation_name', 'job_id', 'job_name', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
/**
|
|
||||||
* The attributes that should be cast to native types.
|
|
||||||
*/
|
|
||||||
protected array $casts = ['family_id' => 'string', 'patient_id' => 'string', 'relation' => 'integer', 'status' => 'integer', 'is_default' => 'integer', 'type' => 'integer', 'sex' => 'integer', 'age' => 'integer', 'province_id' => 'integer', 'city_id' => 'integer', 'county_id' => 'integer', 'marital_status' => 'integer', 'nation_id' => 'integer', 'job_id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
|
|
||||||
|
|
||||||
protected string $primaryKey = "family_id";
|
protected string $primaryKey = "family_id";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -87,9 +87,6 @@ class PatientFamilyRequest extends FormRequest
|
|||||||
'diagnosis_hospital',//确诊医院
|
'diagnosis_hospital',//确诊医院
|
||||||
'drugs_name', // 家族病史
|
'drugs_name', // 家族病史
|
||||||
],
|
],
|
||||||
'getFamilyProductRecord' => [ // 获取家庭成员用药记录列表
|
|
||||||
'family_id',
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -6,6 +6,7 @@ use App\Constants\HttpEnumCode;
|
|||||||
use App\Model\BasicJob;
|
use App\Model\BasicJob;
|
||||||
use App\Model\BasicNation;
|
use App\Model\BasicNation;
|
||||||
use App\Model\DiseaseClass;
|
use App\Model\DiseaseClass;
|
||||||
|
use App\Model\OrderProduct;
|
||||||
use App\Model\PatientFamily as PatientFamilyModel;
|
use App\Model\PatientFamily as PatientFamilyModel;
|
||||||
use App\Model\PatientFamilyHealth;
|
use App\Model\PatientFamilyHealth;
|
||||||
use App\Model\PatientFamilyPersonal as PatientFamilyPersonalModel;
|
use App\Model\PatientFamilyPersonal as PatientFamilyPersonalModel;
|
||||||
@ -859,16 +860,37 @@ class PatientFamilyService extends BaseService
|
|||||||
{
|
{
|
||||||
$user_info = $this->request->getAttribute("userInfo");
|
$user_info = $this->request->getAttribute("userInfo");
|
||||||
|
|
||||||
$family_id = $this->request->input('family_id');
|
$family_id = $this->request->input('family_id',0);
|
||||||
$page = $this->request->input('page', 1);
|
$page = $this->request->input('page', 1);
|
||||||
$per_page = $this->request->input('per_page', 10);
|
$per_page = $this->request->input('per_page', 10);
|
||||||
|
|
||||||
$params = array();
|
$params = array();
|
||||||
|
$params['patient_id'] = $user_info['client_user_id'];
|
||||||
|
if ($family_id != 0){
|
||||||
|
$params['family_id'] = $user_info['family_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$params['order_product_status'] = 4;// 订单状态(1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)
|
||||||
|
$params['pay_status'] = 2;// 支付状态(1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款)
|
||||||
|
|
||||||
|
$fields = [
|
||||||
|
'order_product_id',
|
||||||
|
'order_inquiry_id',
|
||||||
|
'order_prescription_id',
|
||||||
|
'family_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
$result = OrderProduct::getProductRecordPage($params,$fields,$page,$per_page);
|
||||||
return success();
|
if (!empty($result['data'])){
|
||||||
|
foreach ($result['data'] as &$item){
|
||||||
|
if (!empty($item['OrderProductItem'])){
|
||||||
|
foreach ($item['OrderProductItem'] as &$order_product_item){
|
||||||
|
$order_product_item['product_cover_img'] = addAliyunOssWebsite($order_product_item['product_cover_img']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return success($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user