新增查看患者病例接口
This commit is contained in:
parent
63f4c41cc3
commit
523242ff4c
@ -3,9 +3,7 @@
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Request\InquiryRequest;
|
||||
use App\Request\OrderInquiryRequest;
|
||||
use App\Services\InquiryService;
|
||||
use App\Services\OrderInquiryService;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
@ -40,4 +38,15 @@ class InquiryController extends AbstractController
|
||||
$data = $InquiryService->addInquiryOrder();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者问诊病例
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getPatientInquiryCase(): ResponseInterface
|
||||
{
|
||||
$InquiryService = new InquiryService();
|
||||
$data = $InquiryService->getPatientInquiryCase();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -223,4 +223,15 @@ class UserDoctorController extends AbstractController
|
||||
$data = $UserDoctorService->getDoctorCret();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取处方详情
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function getPrescriptionInfo(): ResponseInterface
|
||||
{
|
||||
$UserDoctorService = new UserDoctorService();
|
||||
$data = $UserDoctorService->getPrescriptionInfo();
|
||||
return $this->response->json($data);
|
||||
}
|
||||
}
|
||||
@ -57,7 +57,7 @@ class PatientFamily extends Model
|
||||
/**
|
||||
* The attributes that should be cast to native types.
|
||||
*/
|
||||
protected array $casts = ['family_id' => 'integer', 'patient_id' => 'integer', '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 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";
|
||||
|
||||
|
||||
60
app/Model/PatientFamilyHealth.php
Normal file
60
app/Model/PatientFamilyHealth.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $family_health_id 主键id
|
||||
* @property int $family_id 家庭成员id
|
||||
* @property int $patient_id 患者id
|
||||
* @property string $disease_name 疾病名称
|
||||
* @property string $diagnosis_date 确诊日期
|
||||
* @property string $diagnosis_hospital 确诊医院
|
||||
* @property string $drugs_name 正在服药名称
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class PatientFamilyHealth extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'patient_family_health';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['family_health_id', 'family_id', 'patient_id', 'disease_name', 'diagnosis_date', 'diagnosis_hospital', 'drugs_name', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "family_health_id";
|
||||
|
||||
/**
|
||||
* 获取数据-单
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据-多
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getList(array $params = [], array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
}
|
||||
68
app/Model/PatientFamilyPersonal.php
Normal file
68
app/Model/PatientFamilyPersonal.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
|
||||
|
||||
use Hyperf\Database\Model\Collection;
|
||||
use Hyperf\Snowflake\Concern\Snowflake;
|
||||
|
||||
/**
|
||||
* @property int $family_personal_id 主键id
|
||||
* @property int $family_id 信息表id
|
||||
* @property int $patient_id 患者id
|
||||
* @property int $is_allergy_history 是否存在过敏史(0:否 1:是)
|
||||
* @property string $allergy_history 过敏史描述
|
||||
* @property int $is_family_history 是否存在家族病史(0:否 1:是)
|
||||
* @property string $family_history 家族病史描述
|
||||
* @property int $is_pregnant 是否备孕、妊娠、哺乳期(0:否 1:是)
|
||||
* @property string $pregnant 备孕、妊娠、哺乳期描述
|
||||
* @property int $is_operation 是否存在手术(0:否 1:是)
|
||||
* @property string $operation 手术描述
|
||||
* @property int $drink_wine_status 饮酒状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒酒)
|
||||
* @property int $smoke_status 吸烟状态(1:从不 2:偶尔 3:经常 4:每天 5:已戒烟)
|
||||
* @property int $chemical_compound_status 化合物状态(1:从不 2:偶尔 3:经常 4:每天)
|
||||
* @property string $chemical_compound_describe 化合物描述
|
||||
* @property \Carbon\Carbon $created_at 创建时间
|
||||
* @property \Carbon\Carbon $updated_at 修改时间
|
||||
*/
|
||||
class PatientFamilyPersonal extends Model
|
||||
{
|
||||
use Snowflake;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'patient_family_personal';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected array $fillable = ['family_personal_id', 'family_id', 'patient_id', 'is_allergy_history', 'allergy_history', 'is_family_history', 'family_history', 'is_pregnant', 'pregnant', 'is_operation', 'operation', 'drink_wine_status', 'smoke_status', 'chemical_compound_status', 'chemical_compound_describe', 'created_at', 'updated_at'];
|
||||
|
||||
protected string $primaryKey = "family_personal_id";
|
||||
|
||||
/**
|
||||
* 获取数据-单
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return object|null
|
||||
*/
|
||||
public static function getOne(array $params, array $fields = ['*']): object|null
|
||||
{
|
||||
return self::where($params)->first($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据-多
|
||||
* @param array $params
|
||||
* @param array $fields
|
||||
* @return Collection|array
|
||||
*/
|
||||
public static function getList(array $params = [], array $fields = ['*']): Collection|array
|
||||
{
|
||||
return self::where($params)->get($fields);
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,8 @@ use App\Model\OrderInquiry;
|
||||
use App\Model\OrderInquiryCase;
|
||||
use App\Model\OrderInquiryCoupon;
|
||||
use App\Model\PatientFamily;
|
||||
use App\Model\PatientFamilyHealth;
|
||||
use App\Model\PatientFamilyPersonal;
|
||||
use App\Model\Product;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Utils\PcreMatch;
|
||||
@ -257,6 +259,83 @@ class InquiryService extends BaseService
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取患者问诊病例
|
||||
* @return array
|
||||
*/
|
||||
public function getPatientInquiryCase(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
$inquiry_case_id = $this->request->route('inquiry_case_id');
|
||||
|
||||
// 获取病例信息
|
||||
$params = array();
|
||||
$params['inquiry_case_id'] = $inquiry_case_id;
|
||||
$order_inquiry_case = OrderInquiryCase::getOne($params);
|
||||
if (empty($order_inquiry_case)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
// 获取患者家庭成员信息表-基本信息
|
||||
$params = array();
|
||||
$params['family_id'] = $order_inquiry_case['family_id'];
|
||||
$patient_family = PatientFamily::getOne($params);
|
||||
$order_inquiry_case['height'] = $order_inquiry_case['height'] ?: $patient_family['height'] ?: NULL;
|
||||
$order_inquiry_case['weight'] = $order_inquiry_case['weight'] ?: $patient_family['weight'] ?: NULL;
|
||||
$order_inquiry_case['job_name'] = $patient_family['job_name'] ?? "";
|
||||
$order_inquiry_case['nation_name'] = $patient_family['nation_name'] ?? "";
|
||||
|
||||
// 获取患者家庭成员信息表-健康情况
|
||||
$params = array();
|
||||
$params['family_id'] = $order_inquiry_case['family_id'];
|
||||
$patient_family_health = PatientFamilyHealth::getOne($params);
|
||||
$order_inquiry_case['diagnosis_hospital'] = $patient_family_health['diagnosis_hospital'] ?? "";
|
||||
|
||||
// 获取患者家庭成员信息表-个人情况
|
||||
$params = array();
|
||||
$params['family_id'] = $order_inquiry_case['family_id'];
|
||||
$patient_family_personal = PatientFamilyPersonal::getOne($params);
|
||||
$order_inquiry_case['drink_wine_status'] = $patient_family_personal['drink_wine_status'] ?? 1;
|
||||
$order_inquiry_case['smoke_status'] = $patient_family_personal['smoke_status'] ?? 1;
|
||||
$order_inquiry_case['chemical_compound_status'] = $patient_family_personal['chemical_compound_status'] ?? 1;
|
||||
$order_inquiry_case['chemical_compound_describe'] = $patient_family_personal['chemical_compound_describe'] ?? "";
|
||||
$order_inquiry_case['is_operation'] = $patient_family_personal['is_operation'] ?? 0;
|
||||
$order_inquiry_case['operation'] = $patient_family_personal['operation'] ?? "";
|
||||
|
||||
// 获取用药意向
|
||||
$product = [];
|
||||
$fields = [
|
||||
'inquiry_case_id',
|
||||
'product_id',
|
||||
'case_product_num',
|
||||
];
|
||||
$params = array();
|
||||
$params['inquiry_case_id'] = $order_inquiry_case['inquiry_case_id'];
|
||||
$inquiry_case_product = InquiryCaseProduct::getWithProductList($params,$fields);
|
||||
if (!empty($inquiry_case_product)){
|
||||
foreach ($inquiry_case_product as &$item){
|
||||
if (!empty($item['Product'])){
|
||||
$product[] = $item['Product']['product_name'] . ' ' . $item['Product']['product_spec'] . '(' . $item['case_product_num'] . $item['Product']['packaging_unit'] . ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$order_inquiry_case['product'] = $product;
|
||||
unset($inquiry_case_product);
|
||||
|
||||
// 复诊凭证
|
||||
if (!empty($order_inquiry_case['diagnose_images'])){
|
||||
$diagnose_images = explode(',',$order_inquiry_case['diagnose_images']);
|
||||
foreach ($diagnose_images as &$item){
|
||||
$item = addAliyunOssWebsite($item);
|
||||
}
|
||||
|
||||
$order_inquiry_case['diagnose_images'] = $diagnose_images;
|
||||
}
|
||||
|
||||
return success($order_inquiry_case->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取医生未接诊订单数量
|
||||
* @param string $doctor_id 医生id
|
||||
|
||||
@ -49,17 +49,17 @@ class PatientCaseService extends BaseService
|
||||
$inquiry_case_product = InquiryCaseProduct::getWithProductList($params);
|
||||
if (!empty($inquiry_case_product)){
|
||||
foreach ($inquiry_case_product as &$item){
|
||||
if (!empty($item['product'])){
|
||||
$item['product_name'] = $item['product']['product_name'];
|
||||
$item['product_price'] = $item['product']['product_price'];
|
||||
$item['product_type'] = $item['product']['product_type'];
|
||||
$item['product_cover_img'] = addAliyunOssWebsite($item['product']['product_cover_img']);
|
||||
$item['product_spec'] = $item['product']['product_spec'];
|
||||
$item['license_number'] = $item['product']['license_number'];
|
||||
$item['manufacturer'] = $item['product']['manufacturer'];
|
||||
$item['packaging_unit'] = $item['product']['packaging_unit'];
|
||||
if (!empty($item['Product'])){
|
||||
$item['product_name'] = $item['Product']['product_name'];
|
||||
$item['product_price'] = $item['Product']['product_price'];
|
||||
$item['product_type'] = $item['Product']['product_type'];
|
||||
$item['product_cover_img'] = addAliyunOssWebsite($item['Product']['product_cover_img']);
|
||||
$item['product_spec'] = $item['Product']['product_spec'];
|
||||
$item['license_number'] = $item['Product']['license_number'];
|
||||
$item['manufacturer'] = $item['Product']['manufacturer'];
|
||||
$item['packaging_unit'] = $item['Product']['packaging_unit'];
|
||||
|
||||
unset($item['product']);
|
||||
unset($item['Product']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -783,6 +783,18 @@ class UserDoctorService extends BaseService
|
||||
return success($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取处方详情
|
||||
* @return array
|
||||
*/
|
||||
public function getPrescriptionInfo(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$order_prescription_id = $this->request->route('order_prescription_id');
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测医生身份认证
|
||||
|
||||
@ -47,7 +47,7 @@ return [
|
||||
"patient" => [
|
||||
"app_id" => env('PATIENT_WECHAT_APP_ID', 'wx70a196902e0841b6'),
|
||||
"mchid" => env('PATIENT_WECHAT_MCH_ID', '1636644248'),
|
||||
"secret" => env('PATIENT_WECHAT_APP_SECRET', '817665d3763637fe66d56548f8484622'),
|
||||
"apiv3_secret" => env('PATIENT_WECHAT_APIv3_SECRET', 'gdxz292sjSOadN3m2pCda03NfCsmNadY'),
|
||||
],
|
||||
]
|
||||
],
|
||||
|
||||
@ -73,7 +73,7 @@ Router::addGroup('/doctor', function () {
|
||||
Router::put('/config', [UserDoctorController::class, 'putInquiryConfig']);
|
||||
|
||||
// 获取患者问诊病例
|
||||
Router::get('/case', [InquiryController::class, 'getPatientInquiryCase']);
|
||||
Router::get('/case/{inquiry_case_id:\d+}', [InquiryController::class, 'getPatientInquiryCase']);
|
||||
|
||||
});
|
||||
|
||||
@ -132,6 +132,9 @@ Router::addGroup('/doctor', function () {
|
||||
Router::addGroup('/prescription', function () {
|
||||
// 获取处方列表
|
||||
Router::get('', [UserDoctorController::class, 'getPrescriptionList']);
|
||||
|
||||
// 获取处方详情
|
||||
Router::get('/{order_prescription_id:\d+}', [UserDoctorController::class, 'getPrescriptionInfo']);
|
||||
});
|
||||
|
||||
// 常用语
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user