Compare commits

...

6 Commits

Author SHA1 Message Date
919b47eceb update 2025-09-13 01:28:29 +08:00
1a4b8551a0 update 2025-09-13 01:22:15 +08:00
155e05fd6d update 2025-09-13 01:10:27 +08:00
42140987ff update 2025-09-13 01:09:27 +08:00
d76a5ba5a5 update 2025-09-13 01:08:51 +08:00
f65d07884f update 2025-09-13 00:47:18 +08:00
715 changed files with 149112 additions and 1 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/vendor/
/.idea

View File

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
if(!defined('APP_PATH')) define('APP_PATH', dirname(__DIR__));
return [
// Retrieve the list of modules for this application.
'modules' => include __DIR__ . '/modules.config.php',
// This should be an array of paths in which modules reside.
// If a string key is provided, the listener will consider that a module
// namespace, the value of that key the specific path to that module's
// Module class.
'module_listener_options' => [
'module_paths' => [
'./module',
'./vendor',
],
// Using __DIR__ to ensure cross-platform compatibility. Some platforms --
// e.g., IBM i -- have problems with globs that are not qualified.
'config_glob_paths' => [realpath(__DIR__) . '/autoload/{,*.}{global,local}.php'],
'config_cache_key' => 'application.config.cache',
'config_cache_enabled' => true,
'module_map_cache_key' => 'application.module.cache',
'module_map_cache_enabled' => true,
'cache_dir' => 'data/cache/',
],
];

4
config/autoload/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
local.php
local-development.php
*.local.php
*.local-development.php

View File

@ -0,0 +1,8 @@
About this directory:
=====================
By default, this application is configured to load all configs in
`./config/autoload/{,*.}{global,local}.php`. Doing this provides a
location for a developer to drop in configuration override files provided by
modules, as well as cleanly provide individual, application-wide config files
for things like database connections, etc.

View File

@ -0,0 +1,8 @@
<?php
return [
'api-tools-api-problem' => [
// 不走框架默认的Api报错页面
'accept_filters' => ['skipAcceptFilter']
],
];

View File

@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
return [
'view_manager' => [
'strategies' => [
'ViewJsonStrategy',
],
],
];

View File

@ -0,0 +1,20 @@
<?php
/**
* This file was autogenerated by laminas-api-tools/api-tools-mvc-auth (bin/api-tools-mvc-auth-oauth2-override.php),
* and overrides the Laminas\ApiTools\OAuth2\Service\OAuth2Server to provide the ability to create named
* OAuth2\Server instances.
*/
declare(strict_types=1);
use Laminas\ApiTools\MvcAuth\Factory\NamedOAuth2ServerFactory;
use Laminas\ApiTools\OAuth2\Service\OAuth2Server;
return [
'service_manager' => [
'factories' => [
OAuth2Server::class => NamedOAuth2ServerFactory::class,
],
],
];

View File

@ -0,0 +1,6 @@
<?php
return [
'exception' => [
'throw_exceptions' => true,
]
];

View File

@ -0,0 +1,23 @@
<?php
return [
'identity' => [
// 指定为一个用户
// 返回false 则不验证
'fakeId' => false,
// 前端header传递token的key
'tokenKey' => 'token',
// pc token 可用时长, 默认40分钟
'expire' => 60 * 40,
// 小程序token可用时长, 默认2小时
'miniExpire' => 60 * 60 * 2,
// debugMode token 可用时长
'debugExpire' => 60 * 60 * 24,
]
];

View File

@ -0,0 +1,38 @@
<?php
return $config = [
// 'Yansongda' => [
// // 必填-商户号,服务商模式下为服务商商户号
// 'mch_id' => '',
// // 必填-商户秘钥
// 'mch_secret_key' => '',
// // 必填-商户私钥 字符串或路径文件名apiclient_key.pem 的文件
// 'mch_secret_cert' => '',
// // 必填-商户公钥证书路径文件名apiclient_cert.pem的文件
// 'mch_public_cert_path' => '',
// // 必填
// 'notify_url' => '', // 回调地址
// // 选填-小程序 的 app_id
// 'mini_app_id' => '',
// // 选填-微信公钥证书路径, optional强烈建议 php-fpm 模式下配置此参数
// // 这个参数需要去下载证书,具体下载方法在下面贴出来
// 'wechat_public_cert_path' => [],
// // 选填-默认为正常模式。可选为: MODE_NORMAL, MODE_SERVICE
// 'mode' => Pay::MODE_NORMAL,
// ],
'Easywechat' => [
// 必要配置
'app_id' => 'xxxx',
'mch_id' => 'your-mch-id',
'key' => 'key-for-signature', // API v2 密钥 (注意: 是v2密钥 是v2密钥 是v2密钥)
// 如需使用敏感接口(如退款、发送红包等)需要配置 API 证书路径(登录商户平台下载 API 证书)
'cert_path' => 'path/to/your/cert.pem', // XXX: 绝对路径!!!!
'key_path' => 'path/to/your/key', // XXX: 绝对路径!!!!
'notify_url' => '默认的订单回调地址', // 你也可以在下单时单独设置来想覆盖它
'sandbox' => true, // 设置为 false 或注释则关闭沙箱模式
],
];

View File

@ -0,0 +1,11 @@
<?php
return [
'sms' => [
'url' => 'https://dx.ipyy.net/smsJson.aspx',
'userid' => '2021',
'account' => 'xd000698',
'password' => 'Kingdone123456',
'sign' => '北京开元数据',
]
];

View File

@ -0,0 +1,53 @@
<?php
use Application\Service\Extension\Uploader\Image;
use Application\Service\Extension\Uploader\ImageUploader;
return [
'image_uploader' => [
// 本地上传时文件存储的路径。
'savePath' => $_SERVER['DOCUMENT_ROOT'],
/**
* 由于配置文件会被缓存, 导致日期路径不正确。此属性已废弃。
* @see \Application\Service\Extension\Uploader\UploadAdapterAbstract::getSaveDir()
*/
// 文件上传文件夹
'saveDir' => '/upload/' . date('Y-m-d'),
// 自定义上传文件名称。
// 如果是字符串就是class内处理saveName的函数名称
'saveName' => 'handleSaveName',
// 图片最大上传限制, 默认1M
'imgMaxSize' => 1024 * 20,
// 附件最大上传限制, 默认10M
'fileMaxSize' => 1024 * 10,
// 允许上传的图片文件后缀
'allowExtensions' => ['png', 'jpg', 'jpeg', 'webp', 'jfif', 'tif'],
// 允许上传的文件后缀
'allowFileExtensions' => ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf', 'txt', 'zip', 'rar'],
// OSS上传适配器
'driver' => ImageUploader::DRIVER_OSS,
// 本地上传适配器
// 'driver' => ImageUploader::DRIVER_LOCAL,
// OSS的上传配置
'oss' => [
'yikeen' => [
'accessKeyId' => 'LTAI4GG8W5wjNPniP1YrGvc8',
'accessKeySecret' => '7gUnsuT1oc7vLGvp7YjDfKFgQiS0fP',
'endpoint' => 'http://oss-cn-beijing.aliyuncs.com',
'bucket' => 'yikeen',
],
'eyda' => [
'accessKeyId' => 'LTAI4G1xDK8DpQRYxUQ4TYeP',
'accessKeySecret' => 'lYfHDzKfldcjUsih85Uaj2Mw81uHd0',
'endpoint' => 'http://oss-cn-zhangjiakou-internal.aliyuncs.com',
'bucket' => 'eyda',
]
],
]
];

View File

@ -0,0 +1,284 @@
<?php
use Application\Service\DB\Item\ItemPlanviolate;
$formValidatorPath = APP_PATH . '/formData/';
/**
* 验证器配置文件的映射
*/
return [
'formValidator' => [
'DictionaryGenercsetinfotype' => $formValidatorPath . 'DictionaryGenercsetinfotypeData.php',//字典项分类
'DictionaryGenercsetinfo' => $formValidatorPath . 'DictionaryGenercsetinfoData.php',//字典项通用名
'Researchflowcat' => $formValidatorPath . 'ResearchflowcatData.php',//研究流程分类
'ItemRandom' => $formValidatorPath . 'ItemRandomData.php',//随机方案(随机前/无随机)设置
'Randomscheme' => $formValidatorPath . 'RandomschemeData.php',//随机方案(随机分组)设置
'ItemResearchflowcat' => $formValidatorPath . 'ItemResearchflowcatData.php',//字典项通用名
'DictionaryCheckcategory' => $formValidatorPath . 'DictionaryCheckcategoryData.php',//字典项检查项分类
'DictionaryCheckname' => $formValidatorPath . 'DictionaryChecknameData.php',//字典项检查项
'DictionaryCsset' => $formValidatorPath . 'DictionaryCssetData.php',//字典项cs设置
'DictionaryItemjob' => $formValidatorPath . 'DictionaryItemjobData.php',//字典项岗位设置
'DictionaryDocument' => $formValidatorPath . 'DictionaryDocumentData.php',//字典项文档管理
'DictionaryPatientattr' => $formValidatorPath . 'DictionaryPatientattrData.php',//字典项患者属性拓展
'ItemChecktime' => $formValidatorPath . 'ItemChecktimeData.php',//检查点设置
'AdminUser' => $formValidatorPath . 'AdminUserData.php',//系统管理-用户管理
'AdminRole' => $formValidatorPath . 'AdminRoleData.php',//系统管理-角色管理
'AdminMenu' => $formValidatorPath . 'AdminMenuData.php',//系统管理-菜单管理
'SignatoryInfo' => $formValidatorPath . 'SignatoryInfoData.php',//合作方管理
'SignatoryUser' => $formValidatorPath . 'SignatoryUserData.php',//合作方联系人
'SignatoryDepartment' => $formValidatorPath . 'SignatoryDepartmentData.php',//合作方机构
'ItemInfo' => $formValidatorPath . 'ItemInfoData.php',//项目管理
'ItemSignatory' => $formValidatorPath . 'ItemSignatoryData.php',//项目合作方管理
'ItemCenterdata' => $formValidatorPath . 'ItemCenterdataData.php',//中心信息
'ItemRandgroup' => $formValidatorPath . 'ItemRandgroupData.php',//研究分层
'ItemRandnumber' => $formValidatorPath . 'ItemRandnumberData.php',//随机分组
'ItemRandomdetails' => $formValidatorPath . 'ItemRandomdetailsData.php',//随机号码明细
'ItemItemdocumentData' => $formValidatorPath . 'ItemItemdocumentData.php',//随机号码明细
'ItemDocumentcontentData' => $formValidatorPath . 'ItemDocumentcontentData.php',//随机号码明细
'ItemCheckcontentData' => $formValidatorPath . 'ItemCheckcontentData.php',//随机号码明细
'DictionaryForm' => $formValidatorPath . 'DictionaryFormData.php',
'DictionaryFormField' => $formValidatorPath . 'DictionaryFormFieldData.php',
'ItemForm' => $formValidatorPath . 'ItemFormData.php',//表单
'ItemFormField' => $formValidatorPath . 'ItemFormFieldData.php',
'RealRole' => $formValidatorPath . 'RealRoleData.php',//real角色
'Patientattrs' => $formValidatorPath . 'PatientattrsData.php',//受试者拓展属性
'Patient' => $formValidatorPath . 'PatientData.php',//受试者管理
'DictionaryFormGroup' => $formValidatorPath . 'DictionaryFormGroupData.php',// 表单类型管理
'DictionaryChecknameattr' => $formValidatorPath . 'DictionaryChecknameattrData.php',// 检查项属性拓展
'ItemSuperrole' => $formValidatorPath . 'ItemSuperroleData.php',// 创建项目人员管理
'DictionaryUnblinding' => $formValidatorPath . 'DictionaryUnblindingData.php',// 揭盲认证
'Entry' => $formValidatorPath . 'EntryData.php',// 添加条目
'Forminfo' => $formValidatorPath . 'ForminfoData.php',// 添加条目
'ItemRandblock' => $formValidatorPath . 'ItemRandblockData.php',//block设置
'ItemResearchstage' => $formValidatorPath . 'ItemResearchstageData.php',// 研究流程阶段设置
'DictionaryOcr' => $formValidatorPath . 'DictionaryOcrData.php',// ocr识别模板设置
'ItemCheckname' => $formValidatorPath . 'ItemChecknameData.php',// 检查项名称显示设置
'DictionaryUnit' => $formValidatorPath . 'DictionaryUnitData.php',// 单位换算设置表
'ItemImgtxtdiscern' => $formValidatorPath . 'ItemImgtxtdiscernData.php',// 图文识别模板设置表
'Unplanned' => $formValidatorPath . 'UnplannedData.php',// 计划外检查点
'ItemPatientCheckcontent' => $formValidatorPath . 'ItemPatientCheckcontentData.php',// 计划外检查点
'ItemUnblinding' => $formValidatorPath . 'ItemUnblindingData.php',//受试者揭盲设置
'ItemIdentificationresult' => $formValidatorPath . 'ItemIdentificationresultData.php',//按时间展示
'ItemIdentificationresultchange' => $formValidatorPath . 'ItemIdentificationresultchangeData.php',//按时间展示
'ItemIdentificationresultchangeif' => $formValidatorPath . 'ItemIdentificationresultchangeifData.php',//异常值判断
'ItemUrgentunblind' => $formValidatorPath . 'ItemUrgentunblindData.php',//受试者紧急揭盲设置
'ItemQuestion' => $formValidatorPath . 'ItemQuestionData.php',//质疑沟通
'ItemReply' => $formValidatorPath . 'ItemReplyData.php',//质疑沟通-回复处理
'Make' => $formValidatorPath . 'MakeData.php',//受试者预约管理
'Patientbreak' => $formValidatorPath . 'Patientbreak.php',//受试者脱离
'ItemCsae' => $formValidatorPath . 'ItemCsaeData.php',//ae判断
'AdminAppletsrolemenurelation' => $formValidatorPath . 'AdminAppletsrolemenurelationData.php',//小程序平台设置
'RoleSignatoryRelation' => $formValidatorPath . 'RoleSignatoryRelationData.php',//项目合作方角色关系
'ItemMedication' => $formValidatorPath . 'ItemMedicationData.php',//药物分组
'ItemAppletsdata' => $formValidatorPath . 'ItemAppletsdataData.php',//小程序数据设置
'ItemVicecopy' => $formValidatorPath . 'ItemVicecopyData.php',//副项目复制
'DictionaryRule' => $formValidatorPath . 'DictionaryRuleData.php',//验证规则
'DictionaryFormtype' => $formValidatorPath . 'DictionaryFormtypeData.php',//输入类型
'DictionaryFormtyperule' => $formValidatorPath . 'DictionaryFormtyperuleData.php',//类型与验证规则关系
'ItemAgecountset' => $formValidatorPath . 'ItemAgecountsetData.php',//自定义年龄段
'DictionaryWorkset' => $formValidatorPath . 'DictionaryWorksetData.php',//工作流程字典项设置表
'WorklistItemworklist' => $formValidatorPath . 'WorklistItemworklistData.php',//项目工作流程明细表
'WorklistItemcustomname' => $formValidatorPath . 'WorklistItemcustomnameData.php',//项目工作流程自定义检查项药物器械表
'WorklistItemworklistset' => $formValidatorPath . 'WorklistItemworklistsetData.php',//项目工作流程设置表
'WorklistSigworklist' => $formValidatorPath . 'WorklistSigworklistData.php',//项目中心工作流程明细表
'WorklistSigcustomname' => $formValidatorPath . 'WorklistSigcustomnameData.php',//项目工作流程自定义检查项药物器械表
'WorklistSigworklistset' => $formValidatorPath . 'WorklistSigworklistsetData.php',//项目工作流程设置表
'WorklistPatientinfo' => $formValidatorPath . 'WorklistPatientinfoData.php',//项目患者工作流程 - 基本信息表
'WorklistPatientconnect' => $formValidatorPath . 'WorklistPatientconnectData.php',//项目患者工作流程 - 沟通过程表
'WorklistPatientworklist' => $formValidatorPath . 'WorklistPatientworklistData.php',//项目患者工作流程 - 工作进度表
'ItemExport' => $formValidatorPath . 'ItemExportData.php',//导出
'Export' => $formValidatorPath . 'ExportData.php',//导出
'ItemPatientsign' => $formValidatorPath . 'ItemPatientsignData.php',
'ItemCopyocr' => $formValidatorPath . 'ItemCopyocr.php',
'DictionaryListset' => $formValidatorPath . 'DictionaryListsetData.php',//工作清单字典项设置表
'ListsetItemlist' => $formValidatorPath . 'ListsetItemlistData.php',//项目工作清单表
'ListsetSiglist' => $formValidatorPath . 'ListsetSiglistData.php',//项目中心工作清单表
'ListsetOperate' => $formValidatorPath . 'ListsetOperateData.php',//项目中心工作清单操作轨迹表
'ListsetAnnex' => $formValidatorPath . 'ListsetAnnexData.php',//项目中心工作清单附件表
'ListsetAnnexcat' => $formValidatorPath . 'ListsetAnnexcatData.php',//项目中心工作清单附件分类表
'ListsetFlow' => $formValidatorPath . 'ListsetFlowData.php',//项目中心工作清单操作评审记录表
'BusinessCategory' => $formValidatorPath . 'BusinessCategoryData.php',//业务流程分类表
'BusinessRecord' => $formValidatorPath . 'BusinessRecordData.php',//项目中心业务流程表
'BusinessRecordannex' => $formValidatorPath . 'BusinessRecordannexData.php',//项目中心业务流程附件表
'ItemIdentificationresultdestroy' => $formValidatorPath . 'ItemIdentificationresultdestroyData.php',//识别结果单个指标解锁
'ItemIdentificationresultDoctorIdea' => $formValidatorPath . 'ItemIdentificationresultDoctorIdeaData.php',//医嘱
'Questionconfig' => $formValidatorPath . 'QuestionconfigData.php',//质疑配置
'OcrKeyword' => $formValidatorPath . 'OcrKeywordData.php',//检查项设置信息表
'OcrRawdata' => $formValidatorPath . 'OcrRawdataData.php',//识别原始数据
'OcrMatedata' => $formValidatorPath . 'OcrMatedataData.php',//原始数据与关键字匹配
'OcrMedicalword' => $formValidatorPath . 'OcrMedicalwordData.php',//医嘱黑/白名单设置
'OcrMatewhite' => $formValidatorPath . 'OcrMatewhiteData.php',//医嘱黑/白名单匹配
'OcrMateblack' => $formValidatorPath . 'OcrMateblackData.php',//医嘱黑/白名单匹配
'OcrSigpatient' => $formValidatorPath . 'OcrSigpatientData.php',//中心受试者
'OcrMedical' => $formValidatorPath . 'OcrMedicalData.php',//医嘱原始数据
'OcrOcrannex' => $formValidatorPath . 'OcrOcrannexData.php',//附件信息
'OcrRawword' => $formValidatorPath . 'OcrRawwordData.php',//指标黑名单设置
'OcrRawblack' => $formValidatorPath . 'OcrRawblackData.php',//指标匹配数据与黑名单匹配
'OcrRawlock' => $formValidatorPath . 'OcrRawlockData.php',//化验单锁定
'OcrMedicallock' => $formValidatorPath . 'OcrMedicallockData.php',//医嘱锁定
'OcrChangetype' => $formValidatorPath . 'OcrChangetypeData.php',//图片处理字典项
'OcrDeletename' => $formValidatorPath . 'OcrDeletenameData.php',//批量删除无效识别项
'OcrReplace' => $formValidatorPath . 'OcrReplaceData.php',//批量替换识别信息
'OcrAnnextype' => $formValidatorPath . 'OcrAnnextypeData.php',//附件类型信息
'OcrSigkeyword' => $formValidatorPath . 'OcrSigkeywordData.php',//中心检查项设置信息
'OcrCt' => $formValidatorPath . 'OcrCtData.php',//CT原始数据信息表
'BlindMethodLog' => $formValidatorPath . 'BlindMethodLogData.php',//非盲信息确认
'OcrLoseannex' => $formValidatorPath . 'OcrLoseannexData.php',//批量弃用文件名信息
'OcrMatesearch' => $formValidatorPath . 'OcrMatesearchData.php',//匹配信息检索
'ItemOcrCsaePaitentDetail' => $formValidatorPath . 'ItemOcrCsaePaitentDetailData.php',//住院日期及费用信息
'ItemOcrCasePatientSpecialdetail' => $formValidatorPath . 'ItemOcrCasePatientSpecialdetailData.php',//特殊中心住院日期及费用信息
'ItemRemarks' => $formValidatorPath . 'ItemRemarksData.php',//项目备注
'ItemChangeCollectDate' => $formValidatorPath . 'ItemChangeCollectDateData.php',//识别采集时间调整
'OcrCtcase' => $formValidatorPath . 'OcrCtcaseData.php',//识别采集时间调整
'OcrCaseremark' => $formValidatorPath . 'OcrCaseremarkData.php',//首页备注信息
'ItemOcrCsaePaitentDetailNew' => $formValidatorPath . 'ItemOcrCsaePaitentDetailNewData.php',//第二批住院日期及费用信息
'ItemOcrCasePatientSpecialdetailNew' => $formValidatorPath . 'ItemOcrCasePatientSpecialdetailNewData.php',//第二批特殊中心住院日期及费用信息
'OcrDrug' => $formValidatorPath . 'OcrDrugData.php',//药物名称信息
'OcrTake' => $formValidatorPath . 'OcrTakeData.php',//剂型/服用方式/服用次数信息
'OcrCtreplace' => $formValidatorPath . 'OcrCtreplaceData.php',//影像替换信息
'OcrMatedrug' => $formValidatorPath . 'OcrMatedrugData.php',//医嘱原始数据与药物匹配信息
'OcrDrugcategory' => $formValidatorPath . 'OcrDrugcategoryData.php',//药物分类信息
'DictionaryMedicaltake' => $formValidatorPath . 'DictionaryMedicaltakeData.php',//医嘱字典项信息
'DictionaryMedicalword' => $formValidatorPath . 'DictionaryMedicalwordData.php',//医嘱黑白名单信息
'DictionaryDrugcategory' => $formValidatorPath . 'DictionaryDrugcategoryData.php',//医嘱药物分类信息
'DictionaryDrug' => $formValidatorPath . 'DictionaryDrugData.php',//医嘱药物信息
'MedicalMatewhite' => $formValidatorPath . 'MedicalMatewhiteData.php',//医嘱白名单匹配
'MedicalMateblack' => $formValidatorPath . 'MedicalMateblackData.php',//医嘱白名单与黑名单匹配
'MedicalMatedrug' => $formValidatorPath . 'MedicalMatedrugData.php',//医嘱原始数据与药物匹配信息
'MedicalOcrdata' => $formValidatorPath . 'MedicalOcrdataData.php',//医嘱原始数据
'MedicalLock' => $formValidatorPath . 'MedicalLockData.php',//医嘱锁定信息
'PatientFormContentImg' => $formValidatorPath . 'PatientFormContentImgData.php',//患者医嘱用药附件信息
'TmpDeletename' => $formValidatorPath . 'TmpDeletenameData.php',//删除识别名称信息表
'TmpDrug' => $formValidatorPath . 'TmpDrugData.php',//药物字典项信息表
'TmpDrugcategory' => $formValidatorPath . 'TmpDrugcategoryData.php',//药物分类字典项信息表
'TmpKeyword' => $formValidatorPath . 'TmpKeywordData.php',//检查项信息表
'TmpMedical' => $formValidatorPath . 'TmpMedicalData.php',//医嘱原始数据信息表
'TmpMedicalblack' => $formValidatorPath . 'TmpMedicalblackData.php',//医嘱匹配上白名单与黑名单匹配信息表
'TmpMedicaldrug' => $formValidatorPath . 'TmpMedicaldrugData.php',//医嘱原始数据与药物匹配信息表
'TmpMedicallock' => $formValidatorPath . 'TmpMedicallockData.php',//医嘱锁定数据信息表
'TmpMedicaltake' => $formValidatorPath . 'TmpMedicaltakeData.php',//用药字典项信息表
'TmpMedicalwhite' => $formValidatorPath . 'TmpMedicalwhiteData.php',//医嘱与白名单匹配信息表
'TmpMedicalword' => $formValidatorPath . 'TmpMedicalwordData.php',//医嘱黑白名单信息表
'TmpRawblack' => $formValidatorPath . 'TmpRawblackData.php',//化验单匹配上检查项的数据的与黑名单匹配信息表
'TmpRawdata' => $formValidatorPath . 'TmpRawdataData.php',//识别原始数据信息表
'TmpRawlock' => $formValidatorPath . 'TmpRawlockData.php',//化验单锁定数据信息表
'TmpRawmate' => $formValidatorPath . 'TmpRawmateData.php',//化验单原始数据与检查项匹配信息表
'TmpRawword' => $formValidatorPath . 'TmpRawwordData.php',//指标黑名单信息表
'TmpReplace' => $formValidatorPath . 'TmpReplaceData.php',//替换识别项信息表
'TmpSigkeyword' => $formValidatorPath . 'TmpSigkeywordData.php',//中心检查项设置信息表
'TmpHospital' => $formValidatorPath . 'TmpHospitalData.php',//入院记录字典项信息表
'TmpInspect' => $formValidatorPath . 'TmpInspectData.php',//体格检查分类信息表
'TmpPatienthospital' => $formValidatorPath . 'TmpPatienthospitalData.php',//患者入院记录信息表
'TmpReport' => $formValidatorPath . 'TmpReportData.php',//介入报告字典项信息表
'DictionaryDiseasecategory' => $formValidatorPath . 'DictionaryDiseasecategoryData.php',//疾病分类设置
'DictionaryDisease' => $formValidatorPath . 'DictionaryDiseaseData.php',//疾病设置
'TmpAnnex' => $formValidatorPath . 'TmpAnnexData.php',//附件信息表
'TmpPatient' => $formValidatorPath . 'TmpPatientData.php',//临时患者信息表
'TmpPatientct' => $formValidatorPath . 'TmpPatientctData.php',//临时患者影像信息表
'TmpCustom' => $formValidatorPath . 'TmpCustomData.php',//临时患者影像化验单原始数据信息表
'TmpTable' => $formValidatorPath . 'TmpTableData.php',//临时患者医嘱介入报告原始数据信息
'TmpText' => $formValidatorPath . 'TmpTextData.php',//临时患者入院出院原始数据信息
'TmpOutmedical' => $formValidatorPath . 'TmpOutmedicalData.php',//临时患者出院用药信息
'TmpIntervene' => $formValidatorPath . 'TmpInterveneData.php',//临时患者介入报告信息
'TmpIntervene0' => $formValidatorPath . 'TmpIntervene0Data.php',//临时患者介入报告病态部位信息
'TmpIntervene1' => $formValidatorPath . 'TmpIntervene1Data.php',//临时患者介入报告置入支架信息
'TmpIntervene2' => $formValidatorPath . 'TmpIntervene2Data.php',//临时患者介入报告药物球囊信息
'OcrRawlockunique' => $formValidatorPath . 'OcrRawlockuniqueData.php',//天坛患者化验单去重信息
'TmpCtreplace' => $formValidatorPath . 'TmpCtreplaceData.php',//秋水仙碱心电图彩超替换信息
'MessageField' => $formValidatorPath . 'MessageFieldData.php',//消息推送字段设置
'MessageSend' => $formValidatorPath . 'MessageSendData.php',//消息推送信息设置
'CollectCategory' => $formValidatorPath . 'CollectCategoryData.php',//病例收集分类设置
'CollectInspect' => $formValidatorPath . 'CollectInspectData.php',//病例收集体格检查分类信息表
'CollectHospital' => $formValidatorPath . 'CollectHospitalData.php',//病例收集入院字典项信息表
'CollectItemhospital' => $formValidatorPath . 'CollectItemhospitalData.php',//病例收集项目入院记录字典项信息表
'CollectOut' => $formValidatorPath . 'CollectOutData.php',//病例收集出院字典项信息表
'CollectItemout' => $formValidatorPath . 'CollectItemoutData.php',//病例收集项目出院记录字典项信息表
'CollectDrugcategory' => $formValidatorPath . 'CollectDrugcategoryData.php',//病例收集药物分类信息表
'CollectDrug' => $formValidatorPath . 'CollectDrugData.php',//病例收集药物字典项信息表
'CollectMedicalword' => $formValidatorPath . 'CollectMedicalwordData.php',//病例收集医嘱黑/白名单信息表
'CollectMedicaltake' => $formValidatorPath . 'CollectMedicaltakeData.php',//病例收集用药字典项信息表
'CollectItemdrug' => $formValidatorPath . 'CollectItemdrugData.php',//病例收集项目药物字典项信息表
'CollectEcg' => $formValidatorPath . 'CollectEcgData.php',//病例收集心电图字典项信息表
'CollectItemecg' => $formValidatorPath . 'CollectItemecgData.php',//病例收集项目心电图字典项信息表
'CollectCt' => $formValidatorPath . 'CollectCtData.php',//病例收集彩超字典项信息表
'CollectItemct' => $formValidatorPath . 'CollectItemctData.php',//病例收集项目彩超字典项信息表
'CollectReport' => $formValidatorPath . 'CollectReportData.php',//病例收集介入报告字典项信息表
'CollectItemreport' => $formValidatorPath . 'CollectItemreportData.php',//病例收集项目介入报告字典项信息表
'CollectKeywordcat' => $formValidatorPath . 'CollectKeywordcatData.php',//病例收集检查项分类字典项信息表
'CollectKeyword' => $formValidatorPath . 'CollectKeywordData.php',//病例收集检查项字典项信息表
'CollectRawword' => $formValidatorPath . 'CollectRawwordData.php',//病例收集化验单黑名单信息表
'CollectItemkeyword' => $formValidatorPath . 'CollectItemkeywordData.php',//病例收集项目检查项字典项信息表
'CollectCost' => $formValidatorPath . 'CollectCostData.php',//病例收集费用字典项信息表
'CollectItemcost' => $formValidatorPath . 'CollectItemcostData.php',//病例收集项目费用字典项信息表
'MessageSendPatient' => $formValidatorPath . 'MessageSendPatientData.php',//受试者推送信息
'CollectPatienthospital' => $formValidatorPath . 'CollectPatienthospitalData.php',//病例收集患者入院记录信息表
'CollectPatientecg' => $formValidatorPath . 'CollectPatientecgData.php',//病例收集患者心电图记录信息表
'CollectPatientct' => $formValidatorPath . 'CollectPatientctData.php',//病例收集患者彩超记录信息表
'CollectPatientreport' => $formValidatorPath . 'CollectPatientreportData.php',//病例收集患者介入报告记录信息表
'CollectPatientraw' => $formValidatorPath . 'CollectPatientrawData.php',//病例收集患者化验单记录信息表
'CollectPatientrawmate' => $formValidatorPath . 'CollectPatientrawmateData.php',//病例收集患者化验单匹配记录信息表
'CollectPatientrawblack' => $formValidatorPath . 'CollectPatientrawblackData.php',//病例收集患者化验单黑名单匹配记录信息表
'CollectPatientrawlock' => $formValidatorPath . 'CollectPatientrawlockData.php',//病例收集患者化验单锁定记录信息表
'CollectPatientmedical' => $formValidatorPath . 'CollectPatientmedicalData.php',//病例收集患者医嘱原始数据信息表
'CollectPatientmedicalwhite' => $formValidatorPath . 'CollectPatientmedicalwhiteData.php',//病例收集患者医嘱与白名单匹配信息表
'CollectPatientmedicalblack' => $formValidatorPath . 'CollectPatientmedicalblackData.php',//病例收集患者医嘱匹配上白名单与黑名单匹配信息表
'CollectPatientmedicaldrug' => $formValidatorPath . 'CollectPatientmedicaldrugData.php',//病例收集患者医嘱原始数据与药物匹配信息表
'CollectPatientmedicallock' => $formValidatorPath . 'CollectPatientmedicallockData.php',//病例收集患者医嘱锁定数据信息表
'CollectPatientout' => $formValidatorPath . 'CollectPatientoutData.php',//病例收集患者出院记录信息表
'OcrSpecialmedical' => $formValidatorPath . 'OcrSpecialmedicalData.php',//特殊用药整理信息表
'CollectPatient' => $formValidatorPath . 'CollectPatientData.php',//病例收集患者信息表
'CollectAnnex' => $formValidatorPath . 'CollectAnnexData.php',//病例收集患者附件信息表
'ExportSas' => $formValidatorPath . 'ExportSasData.php',//sas导出
'CollectSighospital' => $formValidatorPath . 'CollectSighospitalData.php',//病例收集项目中心入院记录信息表
'CollectSigout' => $formValidatorPath . 'CollectSigoutData.php',//病例收集项目中心出院记录信息表
'CollectSigkeyword' => $formValidatorPath . 'CollectSigkeywordData.php',//病例收集项目中心检查项字典项信息表
'ItemFormrecognition' => $formValidatorPath . 'ItemFormrecognitionData.php',//表单识别配置信息表
'ItemDrugbatch' => $formValidatorPath . 'ItemDrugbatchData.php',//药物批次信息
'ItemPatientformimgcontent' => $formValidatorPath . 'ItemPatientformimgcontentData.php',//常规类(识别)表单识别拆分信息
'DictionaryDetectname' => $formValidatorPath . 'DictionaryDetectnameData.php',//字典项检查项
'ItemSigdrugbatch' => $formValidatorPath . 'ItemSigdrugbatchData.php',//中心选择药物批次信息
'ItemPatientdrugbatch' => $formValidatorPath . 'ItemPatientdrugbatchData.php',//受试者取药信息
'CollectTable' => $formValidatorPath . 'CollectTableData.php',//表格识别信息
'CollectText' => $formValidatorPath . 'CollectTextData.php',//文本识别信息
'CollectCustom' => $formValidatorPath . 'CollectCustomData.php',//自定义识别信息
'ItemResultidentify' => $formValidatorPath . 'ItemResultidentifyData.php',//特殊结果标识字典项
'ItemIdentificationexport' => $formValidatorPath . 'ItemIdentificationexportData.php',//研究者申请导出
'DoctoradviceOriginal' => $formValidatorPath . 'DoctoradviceOriginalData.php',//医嘱信息表
'ItemPatientinfo' => $formValidatorPath . 'ItemPatientinfoData.php',//追加患者信息
'DictionaryLeverform' => $formValidatorPath . 'DictionaryLeverformData.php',//层级字典项表单设置表
'DictionaryLevervalue' => $formValidatorPath . 'DictionaryLevervalueData.php',//层级字典项选项设置表
'ItemSignaturebatch' => $formValidatorPath . 'ItemSignaturebatchData.php',//受试者表单电子签名批次表
'ItemSignaturedetail' => $formValidatorPath . 'ItemSignaturedetailData.php',//受试者表单电子签名明细表
'ItemDetectpatient' => $formValidatorPath . 'ItemDetectpatientData.php',//受试者重点事件监控信息表
'DictionaryOcrreplace' => $formValidatorPath . 'DictionaryOcrreplaceData.php',//识别数据字样替换信息表
'ItemCissclass' => $formValidatorPath . 'ItemCissclassData.php',//项目CISS分型信息表
'ItemCissoption' => $formValidatorPath . 'ItemCissoptionData.php',//项目CISS分型选项信息表
'ItemPatientciss' => $formValidatorPath . 'ItemPatientcissData.php',//项目受试者CISS分型信息表
'Fixednametype' => $formValidatorPath . 'FixednametypeData.php',//固定变量名分类字典项检查项
'Fixedname' => $formValidatorPath . 'FixednameData.php',//固定变量名明细表
'ProjectMsgset' => $formValidatorPath . 'ProjectMsgsetData.php',//消息提醒设置信息
'ProjectMsginfo' => $formValidatorPath . 'ProjectMsginfoData.php',//每日人员待处理工作明细信息表
'ProjectMsgsend' => $formValidatorPath . 'ProjectMsgsendData.php',//待处理信息提醒记录
'ItemPlanviolate' => $formValidatorPath . 'ItemPlanviolateData.php',//方案违背监察字典项表
'AdminWeblink' => $formValidatorPath . 'AdminWeblinkData.php', //网站管理表
'AdminWorkbatch' => $formValidatorPath . 'AdminWorkbatchData.php', //个人工作统计批次表
'AdminWorkinfo' => $formValidatorPath . 'AdminWorkinfoData.php', //个人工作统计明细表
'DictionaryEventset' => $formValidatorPath . 'DictionaryEventsetData.php',//其他事件管理字典项
'DictionaryEventattr' => $formValidatorPath . 'DictionaryEventattrData.php',//其他事件管理字典项属性
'AdminMedicallock' => $formValidatorPath . 'AdminMedicallockData.php', //个人核查用药工作统计明细表
'ItemPatientevent' => $formValidatorPath . 'ItemPatienteventData.php', //其他事件管理信息表
'ItemPatienteventset' => $formValidatorPath . 'ItemPatienteventsetData.php', //其他事件管理设置信息表
'ProjectPatientwork' => $formValidatorPath . 'ProjectPatientworkData.php', //化验单/常规识别工作记录表
'ProjectMedicalquestion' => $formValidatorPath . 'ProjectMedicalquestionData.php', //用药信息复核问题批次表
'ProjectMedicalquestioninfo' => $formValidatorPath . 'ProjectMedicalquestioninfoData.php', //用药信息复核问题明细表
'ProjectMedicalconfirm' => $formValidatorPath . 'ProjectMedicalconfirmData.php', //用药信息复核确认批次记录表
'ProjectMedicalconfirminfo' => $formValidatorPath . 'ProjectMedicalconfirminfoData.php', //用药信息复核确认明细记录表
'ProjectMedicalset' => $formValidatorPath . 'ProjectMedicalsetData.php', //用药信息复核设置表
'ItemCheckdate' => $formValidatorPath . 'ItemCheckdateData.php', //项目化验单采集时间类型记录表
'ProjectCmdrugset' => $formValidatorPath . 'ProjectCmdrugsetData.php', //项目用药原因默认药物信息表
'ItemPatientformunlock' => $formValidatorPath . 'ItemPatientformunlockData.php', //申请解锁信息表
'CollectPatientdrug' => $formValidatorPath . 'CollectPatientdrugData.php', //受试者用药及核查信息表
'DictionaryItemcategory' => $formValidatorPath . 'DictionaryItemcategoryData.php', //项目分类管理字典项
'ItemPackage' => $formValidatorPath . 'ItemPackageData.php', //项目分类管理字典项
]
];

View File

@ -0,0 +1,74 @@
<?php
return [
//微信公众号
'wechat' => [
'app_id' => 'wx674823c8b5a3db64',
'secret' => '213ebb7b47040fa962b6cd5e317b9170',
// 用户扫码地址
'forward_code_url' => 'http://esm.kingdone.com/forward?auk={auk}&state={state}',
// callback 地址
'forward_callback_url' => 'http://esm.kingdone.com/callback',
// 转发获取微信公众号用户信息
'forward_user_url' => 'http://esm.kingdone.com/wechatuser',
'forward_auk' => 'lwl',
'open_forward' => true, // 是否开启微信公众号授权转发地址
// webH5代理
'h5Proxy' => [
'forward_auk' => '',
'open_forward' => false, // 是否开启微信公众号授权转发地址
// 静默授权地址
'forward_code_url' => 'http://esm.kingdone.com/webH5Forward?auk={auk}',
// callback 地址
'forward_callback_url' => 'http://esm.kingdone.com/webH5Callback',
]
],
//受试者H5公众号
'patient_H5' => [
'default' => [
'name' => '开元科技Aigenius',
'app_id' => 'wx6b3fdf24638e6885',
'secret' => '24a6996d9539ac861d30f13ed35d5ac5',
'client_id' => 'wx6b3fdf24638e6885',
'client_secret' => '24a6996d9539ac861d30f13ed35d5ac5',
'open_forward' => true, //是否使用微信公众号转发地址
'forward_code_url' => 'https://www.e-yda.cn/application/wechatadv/forwardcode?auk={auk}', //code转发地址
'forward_openid_url' => 'https://www.e-yda.cn/application/wechatadv/forwardopenid?code={code}', //获取openid,access_token信息转发地址
'forward_userinfo_url' => 'https://www.e-yda.cn/application/wechatadv/forwarduserinfo?access_token={access_token}&openid={openid}', //获取用户基本信息转发地址
'forward_auk' => '',
],
],
//微信小程序
'applets' => [
'scitrials' => [
'app_id' => 'wxf5c075c9ef6fe12a',
'secret' => 'eee78a727275ce716bcb411b41d0cb9c'
],
'eyda' => [
'app_id' => 'wxf5c075c9ef6fe12a',
'secret' => 'eee78a727275ce716bcb411b41d0cb9c'
],
],
// 企业微信
'work' => [
'app' => [
'corp_id' => '',
'secret' => '',
'agent' => []
],
'departmentIdPrefix' => [
'item' => 'sdm-item-',
'itemsig' => 'sdm-itemsig-'
],
'userIdPrefix' => 'sdm-user-',
'sigroleCode' => 'yjys',
'defaultUser' => 'llbjj89',
],
//微信公众号授权转发地址
'wechatRedirectUrlConfig' => [
],
//微信公众号H5授权转发地址
'wechatH5RedirectUrlConfig' => [
]
];

View File

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
use Laminas\ApiTools\Admin\Model\ModulePathSpec;
return [
'view_manager' => [
'display_exceptions' => true,
],
'api-tools-admin' => [
'path_spec' => ModulePathSpec::PSR_4,
],
'api-tools-configuration' => [
'enable_short_array' => true,
'class_name_scalars' => true,
],
];

View File

@ -0,0 +1,70 @@
<?php
return [
'api-tools-content-negotiation' => [
'selectors' => [],
],
'db' => [
'adapters' => [
'dbAdapter' => [
'driver' => 'Pdo',
'username' => 'sdm_dev',
'password' => 'OTY5OGE1ZmRhYzdlODEw',
'dsn' => 'mysql:dbname=sdm_dev;host=rm-8vb4w1p44yiv44yl5.mysql.zhangbei.rds.aliyuncs.com;port=3306;charset=utf8mb4',
],
'shareDbAdapter' => [
'driver' => 'Pdo',
'username' => 'sdm_dev',
'password' => 'OTY5OGE1ZmRhYzdlODEw',
'dsn' => 'mysql:dbname=sdm_dev;host=rm-8vb4w1p44yiv44yl5.mysql.zhangbei.rds.aliyuncs.com;port=3306;charset=utf8mb4',
],
// 'dbAdapter' => [
// 'driver' => 'Pdo',
// 'username' => 'sdm',
// 'password' => 'sdm_3306',
// 'dsn' => 'mysql:dbname=sdm_scitrials;host=localhost;port=3306;charset=utf8mb4',
//// 'dsn' => 'mysql:dbname=sdm_bjtt;host=localhost;port=3306;charset=utf8mb4',
//// 'dsn' => 'mysql:dbname=sdm_mc5;host=localhost;port=3306;charset=utf8mb4',
//// 'dsn' => 'mysql:dbname=sdm_pumch;host=localhost;port=3306;charset=utf8mb4',
// ],
// 'shareDbAdapter' => [
// 'driver' => 'Pdo',
// 'username' => 'sdm',
// 'password' => 'sdm_3306',
// 'dsn' => 'mysql:dbname=sdm_scitrials;host=localhost;port=3306;charset=utf8mb4',
//// 'dsn' => 'mysql:dbname=sdm_bjtt;host=localhost;port=3306;charset=utf8mb4',
//// 'dsn' => 'mysql:dbname=sdm_mc5;host=localhost;port=3306;charset=utf8mb4',
//// 'dsn' => 'mysql:dbname=sdm_pumch;host=localhost;port=3306;charset=utf8mb4',
// ],
'edcDbAdapter' => [
'driver' => 'Pdo',
'username' => 'sdm',
'password' => 'sdm_3306',
'dsn' => 'mysql:dbname=edc_5mc;host=localhost;port=3306;charset=utf8mb4',
],
'queryDbAdapter' => [
'driver' => 'Pdo',
'username' => 'sdm',
'password' => 'sdm_3306',
'dsn' => 'mysql:dbname=query;host=localhost;port=3306;charset=utf8mb4',
],
'logDbAdapter' => []
],
],
'caches' => [
'Redis' => [
'adapter' => [
'name' => Redis::class,
'options' => [
'namespace' => 'Redis',
'database' => 6,
'password' => 'NmJhODdmN2RhYjliYzQ2',
'server' => [
'host' => '127.0.0.1',
'port' => 6379
]
]
]
]
]
];

View File

@ -0,0 +1,6 @@
<?php
return [
'http_domain' => 'http://edc.kingdone.com'
];

View File

@ -0,0 +1,15 @@
<?php
/**
* Local Configuration Override
*
* This configuration override file is for overriding environment-specific and
* security-sensitive configuration information. Copy this file without the
* .dist extension at the end and populate values as needed.
*
* @NOTE: This file is ignored from Git by default with the .gitignore included
* in LaminasSkeletonApplication. This is a good practice, as it prevents sensitive
* credentials from accidentally being committed into version control.
*/
return [];

View File

@ -0,0 +1,22 @@
<?php
/**
* Global Configuration Override
*
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
*
* @NOTE: In practice, this file will typically be INCLUDED in your source
* control, so do not include passwords or other sensitive information in this
* file.
*/
declare(strict_types=1);
return [
'blind_method_menu' => [
'非盲信息' ,
],
];

View File

@ -0,0 +1,22 @@
<?php
/**
*
* @authorllbjj
* @DateTime2024/7/9 13:43
* @Description
*
*/
return [
'defaultOpen' => [
'is_open' => false, //是否开启oa授权
],
'oa' => [
'domain' => 'hjh.kingdone.com',
'isHttps' => false,
'appId' => 'oa-sdm',
'secretKey' => 'SDMOARELATION',
'redisNamespace' => 'oaSys',
'redisTtl' => 1400,
'signName' => 'OA'
]
];

View File

@ -0,0 +1,11 @@
<?php
return [
'response' => [
'header' => [
'X-XSS-Protection' => '1; mode=block',
'X-Content-Type-Options' => 'nosniff',
'Content-Security-Policy' => "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' https://* data: blob:; font-src 'self' data:;",
'Set-Cookie' => true,
]
]
];

View File

@ -0,0 +1,29 @@
<?php
/*
* @Author: 863465124 863465124@qq.com
* @Date: 2022-07-11 13:48:20
* @LastEditors: 863465124 863465124@qq.com
* @LastEditTime: 2022-07-12 17:15:15
* @FilePath: /RemoteWorking/config/autoload/swoole.timer.global.php
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
return [
'swoole.timer' => [
// 每天定时扫描所有未识别的化验单图片,进行自动识别
'ocrImg' => [
'msec' => '86400000', // 时间(毫秒),
'startTime' => date('Y-m-d 01:30:00', strtotime(' +1 day')), // 任务开始时间,不设置代表服务启动后,立即执行
'endTime' => '', // 任务结束时间,不设置则代表一直执行下去
'serviceName' => 'Patientchecktime', // 服务名称
'funName' => 'EditPatientChecktimeStatus' // 服务方法名称,暂时不知道传递参数
],
// 每天定时扫描所有正常受试者(非脱离/完成),更新受试者当前所处检查点
'scanPatientChecktime' => [
'msec' => '86400000', // 时间(毫秒),
'startTime' => date('Y-m-d 00:30:00', strtotime(' +1 day')), // 任务开始时间,不设置代表服务启动后,立即执行
'endTime' => '', // 任务结束时间,不设置则代表一直执行下去
'serviceName' => 'Patientchecktime', // 服务名称
'funName' => 'AllPatient' // 服务方法名称,暂时不知道传递参数
]
]
];

View File

@ -0,0 +1,19 @@
<?php
/**
*
* @authorllbjj
* @DateTime2024/3/20 11:56
* @Description
*
*/
declare(strict_types=1);
return [
'toolSys' => [
'domain' => '',
'appId' => '',
'secretKey' => '',
'redisNamespace' => 'toolSys',
'redisTtl' => 60 * 60 * 24 - 60 * 5,
]
];

View File

@ -0,0 +1,33 @@
<?php
/**
* Global Configuration Override
*
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
*
* @NOTE: In practice, this file will typically be INCLUDED in your source
* control, so do not include passwords or other sensitive information in this
* file.
*/
declare(strict_types=1);
return [
'defaultToken' => [
'is_open' => 1,
'default_token' => 'OGRhMGVkZDk1M2QzNjQ5ZmQ5MDQ0N2M5'
],
'swAsyncTask' => [
'log' => FALSE,
'task' => FALSE,
],
'isOpenWechatWork' => false,
'isShowItemType' => true,
'logPath' => $_SERVER['DOCUMENT_ROOT'].'/../data/log/',
'itemIdentificationResultPath' => $_SERVER['DOCUMENT_ROOT'].'/../data/itemIdentificationResult/',
'formConfigPath' => $_SERVER['DOCUMENT_ROOT'].'/../formData/',
'sendUrl' => 'https://esm.kingdone.com',
'isSubmitItemForm' => [193],
'sendMsgTmpId' => '', // 受试者消息提醒消息模板ID
];

View File

@ -0,0 +1,9 @@
<?php
return [
'baidu' => [
'app_id' => '20421543',
'api_key' => 'PwQwdbRR8F9ygzw1lo1jy87T',
'aecret_key' => 'RCuvuhhMKjAH3oSTsDfnQ8k78XZEW5Bu'
]
];
?>

View File

@ -0,0 +1,12 @@
<?php
return [
//项目设置状态
'ItemSet' => [
'childSet' => [
['id'=>0,'title'=>'在施'],
['id'=>1,'title'=>'暂停'],
['id'=>2,'title'=>'完成'],
],
],
];
?>

View File

@ -0,0 +1,15 @@
<?php
return [
// Development time modules
'modules' => [
'Laminas\DeveloperTools',
'Laminas\ApiTools\Admin',
],
// development time configuration globbing
'module_listener_options' => [
'config_glob_paths' => [realpath(__DIR__) . '/autoload/{,*.}{global,local}-development.php'],
'config_cache_enabled' => false,
'module_map_cache_enabled' => false,
],
];

View File

@ -0,0 +1,15 @@
<?php
return [
// Development time modules
'modules' => [
'Laminas\DeveloperTools',
'Laminas\ApiTools\Admin',
],
// development time configuration globbing
'module_listener_options' => [
'config_glob_paths' => [realpath(__DIR__) . '/autoload/{,*.}{global,local}-development.php'],
'config_cache_enabled' => false,
'module_map_cache_enabled' => false,
],
];

32
config/modules.config.old Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* List of enabled modules for this application.
*/
declare(strict_types=1);
return [
'Laminas\Mvc\I18n',
'Laminas\I18n',
'Laminas\Db',
'Laminas\Filter',
'Laminas\Hydrator',
'Laminas\InputFilter',
'Laminas\Paginator',
'Laminas\Router',
'Laminas\Validator',
'Laminas\ApiTools',
'Laminas\ApiTools\Documentation',
'Laminas\ApiTools\ApiProblem',
'Laminas\ApiTools\Configuration',
'Laminas\ApiTools\OAuth2',
'Laminas\ApiTools\MvcAuth',
'Laminas\ApiTools\Hal',
'Laminas\ApiTools\ContentNegotiation',
'Laminas\ApiTools\ContentValidation',
'Laminas\ApiTools\Rest',
'Laminas\ApiTools\Rpc',
'Laminas\ApiTools\Versioning',
'Application',
];

47
config/modules.config.php Normal file
View File

@ -0,0 +1,47 @@
<?php
/**
* Configuration file generated by Laminas API Tools Admin
*
* The previous config file has been stored in ./config/modules.config.old
*/
return [
'Laminas\Cache',
// 'Laminas\\Mvc\\I18n',
// 'Laminas\\I18n',
'Laminas\\Db',
'Laminas\\Filter',
'Laminas\\Hydrator',
'Laminas\\InputFilter',
'Laminas\\Paginator',
'Laminas\\Router',
'Laminas\\Validator',
'Laminas\\ApiTools',
'Laminas\\ApiTools\\Documentation',
'Laminas\\ApiTools\\ApiProblem',
'Laminas\\ApiTools\\Configuration',
'Laminas\\ApiTools\\OAuth2',
'Laminas\\ApiTools\\MvcAuth',
'Laminas\\ApiTools\\Hal',
'Laminas\\ApiTools\\ContentNegotiation',
'Laminas\\ApiTools\\ContentValidation',
'Laminas\\ApiTools\\Rest',
'Laminas\\ApiTools\\Rpc',
'Laminas\\ApiTools\\Versioning',
'Laminas\ZendFrameworkBridge',
'Application',
// 'Admin',
// 'Dictionary',
// 'Item',
// 'Signatory',
// 'Syslog',
// 'Project',
// 'Real',
// 'Applets',
// 'Listset',
// 'Business',
// 'Ocr',
// 'Medical',
// 'Tmp',
// 'Collect',
];

View File

@ -0,0 +1,369 @@
<?php
//declare(strict_types=1);
namespace Application\Controller;
use Application\Common\Container;
use Application\Form\ExportModel;
use Application\Mvc\Controller\Plugins\RenderApiJson;
use Application\Service\DB\Dictionary\FormGroup;
use Application\Service\Extension\Helper\ExcelHelper;
use Application\Service\Extension\Laminas;
use Application\Service\Extension\Queue\jobs\SyncPatientFormJob;
use Application\Service\Extension\Queue\QueueApplication;
use Application\Service\Extension\Xml\LaboratoryXmlGenerator;
use Laminas\ApiTools\Admin\Module as AdminModule;
use Laminas\Http\Response;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;
use function class_exists;
/**
*
* @package Application\Controller
*
* @method RenderApiJson RenderApiJson()
* @method Container LocalService()
*/
class IndexController extends AbstractActionController
{
const Genercsetinfotype='Genercsetinfotype';//字典项分类-1
const Genercsetinfo='Genercsetinfo';//字典项通用名
/**
* @return Response|ViewModel
*/
public static function yieldFuc($num)
{
$oper_type = [0,1,2];
$log_type = [0,1,3];
$formData = include $_SERVER['DOCUMENT_ROOT'].'/../formData/formMap.php';
for($i = 0; $i < $num; $i++){
$logData = [
'user_id' => 1,
'event_from' => array_rand($formData),
'event_id' => $i,
'create_time' => time(),
'log_ip' => '127.0.0.1',
'oper_type' => array_rand($oper_type),
'log_type' => array_rand($log_type),
'change_data' => '测试'
];
yield $logData;
}
}
public function indexAction()
{
die('123');
set_time_limit(0);
$datas = self::yieldFuc(10000);
foreach($datas as $data){
$this->LocalService()->adminLog->save($data);
}
exit('finish');
echo "<pre>";print_r($this->LocalService()->identity->getIdentityData());exit;
for($i = 19728; $i <= 19830; $i++){
echo $i.' ';
}
exit;
$formFieldData = $this->Introduce(self::Genercsetinfotype);
$formFieldData = empty($formFieldData) ? [] : array_values($formFieldData);
$formValData = 1 ? $this->LocalService()->dictionaryGenercsetinfotype->fetchOne(['where' => 'id = 1']) : [];
return $this->RenderApiJson()->Success($formValData, '', ['formFieldData' => $formFieldData]);
$maxId = $this->LocalService()->adminUser->getOneFieldVal('id', 'status = 1', 'id desc');
$maxOrder = $this->LocalService()->adminUser->getMaxOrder('id', 'status = 1');
echo 'maxId'.$maxId.' </br>';
echo 'maxOrder'.$maxOrder.' </br>';exit;
$this->LocalService()->adminUser->check_field_repeat('mobile', '15001062410', ['field' => 'is_del', 'value' => 1]);
// 操作前数据
$oprt_pre = [
'id' => 1,
'name' => '张三',
'status' => 0,
'mobile' => '12345678901',
'role_id' => 1
];
// 操作后数据
$oprt_last = [
'id' => 1,
'name' => '张山',
'status' => 0,
'mobile' => '01234567890',
'role_id' => '1,2,3,4,5'
];
//日志文件数据
$logData = [
'event' => 'AdminUser',
'ip' => '127.0.0.1',
'user_id' => 1,
'user_name' => '超级管理员',
'time' => time(),
'oprt_pre' => $oprt_pre,
'oprt_last' => $oprt_last
];
// 获取修改的字段
$changeData = array_diff_assoc($logData['oprt_last'], $logData['oprt_pre']);
if(!empty($changeData)){
$formMapData = include $_SERVER['DOCUMENT_ROOT'].'/../data/FormData/formMap.php';
$form_col_desc_data = include $_SERVER['DOCUMENT_ROOT'].'/../data/FormData/'.$logData['event'].'Data.php';
$event_name = $formMapData[$logData['event']];
foreach($changeData as $changeKey => &$changeVal){
if(isset($form_col_desc_data[$changeKey]['val_source']) and is_callable($form_col_desc_data[$changeKey]['val_source'])){
$changeVal = $form_col_desc_data[$changeKey]['val_source']($this->LocalService(), $changeVal);
}
$desc_data[] = $form_col_desc_data[$changeKey]['title'].''.$changeVal;
}
}
echo "<pre>";print_r($changeData);
echo $logData['user_name'].' 修改了:</br></br>'.implode('</br>', $desc_data);
echo "<pre>";print_r($logData);exit;
if (class_exists(AdminModule::class, false)) {
return $this->redirect()->toRoute('api-tools/ui');
}
return new ViewModel();
}
protected int $contentId = 0;
protected string $prop = '';
public function testAction()
{
$model = new ExportModel();
// $model->exportLogicError();
//2267; // pumch - 1101
ExcelHelper::exportExcel($model->exportLogicError(1101), [
[
['项目ID', 'item_id', 'text'],
['中心编号', 'sign_id', 'text'],
['筛选号', 'patient_id', 'text'],
['访视名称', 'checktime_id', 'text'],
['表单名称', 'form_id', 'text'],
['字段名称', 'prop', 'text'],
['原来值', 'origin_value', 'text'],
['更正值', 'value', 'text'],
// ['更正原因', 'note', 'text'],
['质疑内容', 'expression_note', 'text'],
['质疑时间', 'create_time', 'text'],
['质疑发出人员/角色', 'create_user_id', 'text'],
['质疑回复内容', 'reply_content', 'text'],
['质疑回复时间', 'replay_time', 'text'],
['质疑回复人员/角色', 'replay_user_id', 'text'],
['质疑关闭时间', 'is_closed', 'text'],
['质疑关闭人员/角色', 'closed_user_id', 'text'],
]
], time(), 'xlsx', '', ['质疑数据']);
die;
// $a = new App();
// $a->itemId = 1084;
// $a->signId = 1248;
// $a->menuId = App::MODULE_CS;
// $a->push([37]);
// die('123123');
// var_dump(Laminas::$serviceManager->itemForm->getPreviewConfig(518, true));die;
// $model = new SyncPatientFormJob();
// $model = new FormContentXmlGenerator();
// $model->patientId = 4134;
// $model->itemSignId = 272;
// $model->itemId = 101;
// $model->formId = 947; // 3917 //747 717;
// $model->checkTimeId = 566; //747 717;
// $xmlModel = new XmlBuilder();
// $data = $xmlModel->build($model->generate());
// echo $data;die;
//// echo json_encode($data, JSON_UNESCAPED_SLASHES);die;
////// $model->run();
// echo QueueApplication::push($model);die;
// die;
$model = new LaboratoryXmlGenerator();
// $model->setHeader([
// [
// 'key' => 'TEST',
// 'value' => '是',
// 'transactionType' => 'Insert',
// ],
// [
// 'key' => 'DATE',
// 'value' => '2022-1-1',
// 'transactionType' => 'Update',
// ]
// ]);
// $model->setContent(
// [
// [
// ['itemOID' => 'INDICATORS', 'transactionType' => 'Insert', 'value' => '白细胞'], // 指标
// ['itemOID' => 'UNIT', 'transactionType' => 'Insert', 'value' => '10^9/L'], // 单位
// ],
// [
// ['itemOID' => 'INDICATORS', 'transactionType' => 'Insert', 'value' => '中性粒细胞绝对值'], // 指标
// ['itemOID' => 'UNIT', 'transactionType' => 'Insert', 'value' => '10^9/L'], // 单位
//// ['itemOID' => 'RESULT', 'transactionType' => 'Insert', 'value' => '4.05'], // 结果
//// ['itemOID' => 'RANGE', 'transactionType' => 'Insert', 'value' => '1.8-6.3'], // 范围
//// ['itemOID' => 'NORMAL', 'transactionType' => 'Insert', 'value' => 'true'], // 正常
// ]
// ]
// );
// $model->setFormId(3946);
// $model->setPatientId(1992);
// $model->generate();
// $builder = new XmlBuilder();
//
// echo $builder->build($model->generate());die;
$query = Laminas::$serviceManager->patient->fetchAll([
// 'where' => ['item_id' => 1084, 'itemsig_id' => 1344, 'is_del' => 0]
'where' =>
[
// 'id' => [2032, 2069, 2640, 4134, 4557, 5015, 5358, 5488, 5531, 5599, 5659, 5769, 6083]
// 'id' => [4814, 4813, 2032, 2069, 2640, 4134, 4557, 5015, 5358, 5488, 5531, 5599, 5659, 5769, 6083]//[2032, 2069, 2640, 4134, 4557, 5015, 5358, 5488, 5531, 5599, 5659, 5769, 6083],
// 'id' => [2069, 2640, 4134, 4557, 5015, 5358, 5488, 5531, 5599, 5659, 5769, 6083],
'id' => [5651, 5652, 5878, 6127, 6146],
// 'id' => [2367, 2368, 2369, 2370, 2539, 2540, 2541, 4813, 2863, 2864, 2865, 2866, 4814, 4584, 4585, 5651, 5652, 5669, 5670, 5878, 5879, 5941, 6127, 6146]
] // 1043
// 'where' => ['id' => [2367, 2368, 2369, 2370, 2539, 2540, 2541, 2863, 2864, 2865, 2866, 4584, 4585]] // 2368, 2369, 2370, 2539, 2540, 2541, 2863, 2864, 2865, 2866, 4584, 4585
// 'where' => ['id' => 2069] // 1043
]);
//
// $model = new SyncPatientFormJob();
//// $model = new FormContentXmlGenerator();
// $model->patientId = intval($query[0]['id']);
// $model->itemSignId = $query[0]['itemsig_id'];
// $model->itemId = intval($query[0]['item_id']);
// $model->formId = 3921; //747 717;
// $model->checkTimeId = intval(563); //747 717;
//// $xmlModel = new XmlBuilder();
//// $data = $xmlModel->build($model->generate());
//// echo $data;die;
// $model->run();
// die;
////// 新增 一个受试者
// die;
// var_dump($query);die;
// 处理 ae
foreach ($query as $item) {
// $model = new SyncPatientJob();
////// $model = new PatientXmlGenerator();
// $model->patientId = intval($item['id']); // 受试者id
// $model->itemSignId = $item['itemsig_id']; // 中心id
//// $xmlModel = new XmlBuilder();
//// $data = $xmlModel->build($model->generate());
//// echo $data;die;
//// $model->run();
// echo QueueApplication::push($model);
// // 1406, 1407, 1409, 1410, 1411, 1412, 1408, 1413, 1414, 99
//
//// foreach ([560, 561, 562, 575, 563, 564, 565, 566, 570, 567, 571, 569, 572, 573, 99] as $v) {
// foreach ([1409] as $v) {
// $model = new SyncPatientFormJob();
//// $model = new FormContentXmlGenerator();
// $model->patientId = intval($item['id']);
// $model->itemSignId = 1344; //$item['itemsig_id'];
// $model->itemId = 1084; // intval($item['item_id']);
// $model->formId = 4602; //82841, 2841;
// $model->checkTimeId = intval($v); //747 717;
//// $model->isSync = true;
//// $xmlModel = new XmlBuilder();
//// $data = $xmlModel->build($model->generate());
//// echo json_encode($data, JSON_UNESCAPED_SLASHES);die;
// echo QueueApplication::push($model);
//// $model->isSync = false;
//// echo QueueApplication::push($model);
// }
//die;
// $model = new SyncPatientFormJob();
// $model = new FormContentXmlGenerator();
// $model->patientId = intval($item['id']);
// $model->itemSignId = 272; //$item['itemsig_id'];
// $model->itemId = 101; // intval($item['item_id']);
// $model->formId = 3918; //747 717;
// $model->checkTimeId = intval(1412); //747 717;
//// $model->isDeleteItemData = true;
//// echo QueueApplication::push($model);die;
// $xmlModel = new XmlBuilder();
// $data = $xmlModel->build($model->generate());
// echo json_encode($data, JSON_UNESCAPED_SLASHES);die;
$this->syncPatientForm($item);
}
die;
}
private function syncPatientForm(array $query)
{
$allCheckTime = Laminas::$serviceManager->itemPatientchecktime->fetchAll([
'columns' => ['checktime_id'],
'where' => [
'patient_id' => $query['id']
]
]);
$allCheckTime[] = [
'checktime_id' => 99
];
foreach ($allCheckTime as $checkTime) {
if ($checkTime['checktime_id'] == 99) {
$allFormId = Laminas::$serviceManager->itemForm->fetchCol('id', [
'item_id' => $query['item_id'],
'group_id' => [FormGroup::SAE, FormGroup::AE, FormGroup::THROUGH_PROCESS, FormGroup::TEST_SUMMARY],
'is_del' => 0
]);
} else {
$allFormId = Laminas::$serviceManager->patientForm->fetchCol('form_id', ['patient_id' => $query['id'], 'is_del' => 0, 'checktime_id' => $checkTime['checktime_id']]);
}
$allFormId = array_unique(array_values($allFormId));
foreach ($allFormId as $formId) {
// var_dump($formId);
// $formId = intval($formId['form_id']);
$form = Laminas::$serviceManager->itemForm->fetchOne([
'where' => ['id' => $formId]
]);
if ($form['group_id'] != FormGroup::CHECK_OCR) {
continue;
}
if ($checkTime['checktime_id'] != 99) {
if (in_array($form['group_id'], [FormGroup::SAE, FormGroup::AE, FormGroup::THROUGH_PROCESS, FormGroup::TEST_SUMMARY])) {
continue;
}
}
$model = new SyncPatientFormJob();
// $model = new FormContentXmlGenerator();
$model->patientId = intval($query['id']);
$model->itemSignId = $query['itemsig_id'];
$model->itemId = intval($query['item_id']);
$model->formId = $formId; //747 717;
$model->checkTimeId = intval($checkTime['checktime_id']); //747 717;
// 有数据说明写了
// if ($model->isSync() === false || $model->getFormContent('fetchOne', false) === false || $model->getIsProcessSync() === true) {
// continue;
// }
// $model->formContent = [];
// $xmlModel = new XmlBuilder();
// $data = $xmlModel->build($model->generate());
// echo $data;
// $model->run();
echo "受试者: [{$query['id']}]. 检查点: [{$checkTime['checktime_id']}]. 表单 [{$formId}]. " . PHP_EOL;
QueueApplication::push($model);
}
}
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
* @Author: 863465124@qq.com
* @Date: 2022-07-12 22:22:02
* @LastEditors: 863465124 863465124@qq.com
* @LastEditTime: 2022-07-12 22:27:57
* @FilePath: /RemoteWorking/module/Application/config/cli/laminasCli.config.php
*/
use Application\Command\RunCommand;
use Application\Command\TestCommand;
use Application\Command\Swoole\Server\SwItemTipCommand;
use Application\Command\Swoole\Server\SwLogCommand;
use Application\Command\Swoole\Server\SwTimerCommand;
use Application\Command\Swoole\Server\WebSocketCommand;
use Application\Command\Swoole\Server\SwTaskCommand;
use Application\Command\UnitTestCommand;
return [
'commands' => [
'test' => TestCommand::class, // 测试
'oprtlog' => SwLogCommand::class, // 系统操作日志
'switemtip' => SwItemTipCommand::class, // webSocket
'sw:timer' => SwTimerCommand::class, // 定时任务
'swTaskSv' => SwTaskCommand::class, // 异步任务服务
'ws:start' => WebSocketCommand::class,
'unitTest:start' => UnitTestCommand::class,
'run:server' => RunCommand::class,
],
];

View File

@ -0,0 +1,40 @@
<?php
/*
* @files.saveConflictResolution: overwriteFileOnDisk
* @Author: llbjj
* @Date: 2022-07-04 19:59:46
* @LastEditTime: 2022-07-05 14:17:44
* @LastEditors: llbjj
* @Description:
* @FilePath: /RemoteWorking/module/Application/config/command.service.config.php
*/
/**
*
* @authorllbjj
* @DateTime2022/5/9 15:02
* @Description
*
*/
namespace Application;
use Application\Command\RunCommand;
use Application\Command\UnitTestCommand;
use Application\Factory\ServiceFactory;
use Application\Command\Swoole;
return [
'aliases' => [
'swLogClient' => Swoole\Client\SwLogClient::class,
'swTaskClient' => Swoole\Client\SwTaskClient::class,
],
'factories' => [
Command\TestCommand::class => ServiceFactory::class,
Swoole\Server\SwLogCommand::class => ServiceFactory::class,
Swoole\Client\SwLogClient::class => ServiceFactory::class,
Swoole\Server\SwItemTipCommand::class => ServiceFactory::class,
Swoole\Server\SwTimerCommand::class => ServiceFactory::class,
Swoole\Server\SwTaskCommand::class => ServiceFactory::class,
Swoole\Client\SwTaskClient::class => ServiceFactory::class,
Swoole\Server\WebSocketCommand::class => ServiceFactory::class,
UnitTestCommand::class => ServiceFactory::class,
RunCommand::class => ServiceFactory::class,
]
];

View File

@ -0,0 +1,798 @@
<?php
namespace Application;
use Application\Factory\ChainFactory;
use Application\Factory\DbFactory;
use Application\Factory\EdcDbFactory;
use Application\Factory\SdmFactory;
use Application\Factory\ShareDbFactory;
use Application\Service\DB;
use Application\Service\DB\Item\Planviolate;
use Application\Service\Extension\Helper\ArrayHelper;
$dbServerMap = [
'aliases' => [
'itemInfo' => DB\Item\Info::class,
'itemCenterdata' => DB\Item\Centerdata::class,
'itemDrugbatch' => DB\Item\ItemDrugbatch::class,
'itemSigdrugbatch' => DB\Item\ItemSigdrugbatch::class,
'itemSigdrugset' => DB\Item\ItemSigdrugset::class,
'itemPatientdrugbatch' => DB\Item\ItemPatientdrugbatch::class,
'itemPatientdrugset' => DB\Item\ItemPatientdrugset::class,
'itemSignatory' => DB\Item\Signatory::class,
'itemResearchstage' => DB\Item\Researchstage::class,
'itemRandom' => DB\Item\Random::class,
'itemJobstaff' => DB\Item\Jobstaff::class,
'itemResearchflowcat' => DB\Item\Researchflowcat::class,
'itemChecktime' => DB\Item\Checktime::class,
'itemCheckname' => DB\Item\Checknames::class,
'itemItemdocument' => DB\Item\Itemdocument::class,
'itemDocumentcontent' => DB\Item\Documentcontent::class,
'itemResearchremark' => DB\Item\Researchremark::class,
'itemSuperrole' => DB\Item\Superrole::class,
'itemCheckcontent' => DB\Item\Checkcontent::class,
'itemPatientcheckcontent' => DB\Item\Patientcheckcontent::class,
'DictionaryCheckcategory' => DB\Dictionary\Checkcategory::class,
'DictionaryCheckname' => DB\Dictionary\Checkname::class,
'DictionaryCsset' => DB\Dictionary\Csset::class,
'DictionaryDocument' => DB\Dictionary\Document::class,
'Jobstaff' => DB\Item\Jobstaff::class,
'Researchflowcat' => DB\Item\Researchflowcat::class,
'DictionaryGenercsetinfo' => DB\Dictionary\Genercsetinfo::class,
'DictionaryGenercsetinfotype' => DB\Dictionary\Genercsetinfotype::class,
'DictionaryPatientattrselect' => DB\Dictionary\Patientattrselect::class,
'dictionaryCheckcategory' => DB\Dictionary\Checkcategory::class,
'dictionaryCheckname' => DB\Dictionary\Checkname::class,
'dictionaryCsset' => DB\Dictionary\Csset::class,
'dictionaryDocument' => DB\Dictionary\Document::class,
'dictionaryGenercsetinfo' => DB\Dictionary\Genercsetinfo::class,
'dictionaryGenercsetinfotype' => DB\Dictionary\Genercsetinfotype::class,
'dictionaryItemjob' => DB\Dictionary\Itemjob::class,
'dictionaryPatientattr' => DB\Dictionary\Patientattr::class,
'dictionaryPatientattrselect' => DB\Dictionary\Patientattrselect::class,
'dictionaryChecknameattr' => DB\Dictionary\Checknameattr::class,
'dictionaryUnblinding' => DB\Dictionary\Unblinding::class,
'dictionaryOcr' => DB\Dictionary\Ocr::class,
'dictionaryUnit' => DB\Dictionary\Unit::class,
'adminMenu' => DB\Admin\Menu::class,
'adminUser' => DB\Admin\User::class,
'adminRole' => DB\Admin\Role::class,
'adminAppletsrolemenurelation' => DB\Admin\Appletsrolemenurelation::class,
'adminAppletsmenu' => DB\Admin\Appletsmenu::class,
'roleMenuRelation' => DB\Admin\Rolemenurelation::class,
'roleSignatoryRelation' => DB\Admin\Realrolesignatoryrelation::class,
'userRoleRelation' => DB\Admin\Userrolerelation::class,
'realRole' => DB\Admin\Realrole::class,
'adminLog' => DB\Admin\Log::class,
'signatoryInfo' => DB\Signatory\Info::class,
'signatoryUser' => DB\Signatory\User::class,
'signatoryDepartment' => DB\Signatory\Department::class,
'patient' => DB\Item\Patient::class,
'patientForm' => DB\Item\PatientForm::class,
'patientFormContent' => DB\Item\PatientFormContent::class,
'patientFormContentImg' => DB\Item\PatientFormContentImg::class,
'patientattrs' => DB\Item\Patientattrs::class,
'dictionaryForm' => DB\Dictionary\Form::class,
'dictionaryFormVersion' => DB\Dictionary\FormVersion::class,
'patientCard' => DB\Item\PatientCard::class,
'itemRandblock' => DB\Item\Randblock::class,
'itemRandgroup' => DB\Item\Randgroup::class,
'itemRandnumber' => DB\Item\Randnumber::class,
'itemRandomdetails' => DB\Item\Randomdetails::class,
'itemBlockgroup' => DB\Item\Blockgroup::class,
'dictionaryFormField' => DB\Dictionary\FormField::class,
'dictionaryFormFieldText' => DB\Dictionary\ItemFormFieldText::class,
'dictionaryFormFieldRadio' => DB\Dictionary\ItemFormFieldRadio::class,
'itemFormFieldText' => DB\Item\FormFieldText::class,
'itemFormFieldRadio' => DB\Item\FormFieldRadio::class,
'dictionaryFormGroup' => DB\Dictionary\FormGroup::class,
'itemForm' => DB\Dictionary\ItemForm::class,
'itemFormVersion' => DB\Item\ItemFormVersion::class,
'itemFormField' => DB\Dictionary\ItemFormField::class,
'itemFormGroup' => DB\Dictionary\ItemFormGroup::class,
'realRolemodulerelation' => DB\Item\Rolemodulerelation::class,
'itemPatientchecktime' => DB\Item\Patientchecktime::class,
'itemInformedconsent' => DB\Item\Informedconsent::class,
'itemImgtxtdiscern' => DB\Item\Imgtxtdiscern::class,
'itemPatientworkannex' => DB\Project\Patientworkannex::class,
'itemIdentificationresult' => DB\Project\Identificationresult::class,
'itemUnblinding' => DB\Item\Unblindings::class,
'itemIdentificationresultchange' => DB\Project\Identificationresultchange::class,
'itemUrgentunblind' => DB\Item\Urgentunblind::class,
'itemFile' => DB\Item\File::class,
'dictionarySetocrfield' => DB\Project\Setocrfield::class,
'itemQuestion' => DB\Item\Question::class,
'itemReply' => DB\Item\Reply::class,
'dictionaryFormRelation' => DB\Dictionary\FormRelation::class,
'itemFormRelation' => DB\Item\FormRelation::class,
'itemExport' => DB\Item\Export::class,
'itemPatientFormContentFieldLock' => DB\Item\PatientFormContentFieldLock::class,
'itemPatientbooked' => DB\Item\Patientbooked::class,
'itemCsae' => DB\Project\Csae::class,
'itemPatientChecktimeForm' => DB\Item\PatientChecktimeForm::class,
'itemPatientAeContent' => DB\Item\PatientAeContent::class,
'itemCsaeRelation' => DB\Project\CsaeRelation::class,
'itemMedication' => DB\Item\Medication::class,
'itemAppletsdata' => DB\Item\Appletsdata::class,
'itemVicecopy' => DB\Item\Vicecopy::class,
'itemInformedconsentsign' => DB\Item\Informedconsentsign::class,
'workShow' => DB\Work\Show::class,
'workSchedule' => DB\Work\Schedule::class,
'workApproval' => DB\Work\Approval::class,
'itemDownpicture' => DB\Item\Downpicture::class,
'itemCsaeChecked' => DB\Item\ItemCsaeChecked::class,
'itemQuestionanswer' => DB\Item\Answer::class,
'signatoryPatient' => DB\Item\Signatorypatient::class,
'itemAgecountset' => DB\Item\Agecountset::class,
'dictionaryRule' => DB\Dictionary\Rule::class,
'dictionaryFormtype' => DB\Dictionary\Formtype::class,
'dictionaryFormtyperule' => DB\Dictionary\Formtyperule::class,
'dictionaryWorkset' => DB\Dictionary\Workset::class,
'worklistItemworklist' => DB\Worklist\Itemworklist::class,
'worklistItemcustomname' => DB\Worklist\Itemcustomname::class,
'worklistItemworklistset' => DB\Worklist\Itemworklistset::class,
'worklistSigworklist' => DB\Worklist\Sigworklist::class,
'worklistSigcustomname' => DB\Worklist\Sigcustomname::class,
'worklistSigworklistset' => DB\Worklist\Sigworklistset::class,
'worklistPatientinfo' => DB\Worklist\Patientinfo::class,
'worklistPatientconnect' => DB\Worklist\Patientconnect::class,
'worklistPatientworklist' => DB\Worklist\Patientworklist::class,
'itemFormpatientsign' => DB\Item\Formpatientsign::class,
'dictionaryListset' => DB\Dictionary\Listset::class,
'listsetItemlist' => DB\Listset\Itemlist::class,
'listsetSiglist' => DB\Listset\Siglist::class,
'listsetOperate' => DB\Listset\Operate::class,
'listsetAnnex' => DB\Listset\Annex::class,
'listsetAnnexcat' => DB\Listset\Annexcat::class,
'listsetFlow' => DB\Listset\Flow::class,
'businessCategory' => DB\Business\Category::class,
'businessRecord' => DB\Business\Record::class,
'businessRecordannex' => DB\Business\Recordannex::class,
'arkQuery' => DB\Ark\ArkQuery::class,
'itemBackupschange' => DB\Project\Backupschange::class,
'dictionaryQuestionanswer' => DB\Dictionary\Questionanswer::class,
'odmSyncRecord' => DB\Odm\OdmSyncRecord::class,
'itemInfosign' => DB\Item\ItemInfosign::class,
'itemLogtype' => DB\Item\Logtype::class,
'itemExportpdf' => DB\Item\Exportpdf::class,
'itemIdentificationresultdestroy' => DB\Project\Identificationresultdestroy::class,
'patientFormUnlock' => DB\Item\PatientFormUnlock::class, // 受试者表单申请解锁表
'patientWorkCount' => DB\Item\PatientWorkCount::class,
'itemChangesendlog' => DB\Project\Changesendlog::class,
'itemLock' => DB\Item\Lock::class,
'adminWebsitefiling' => DB\Admin\Websitefiling::class,
'itemDoctoridea' => DB\Project\Doctoridea::class,
'itemQuestionconfig' => DB\Dictionary\Questionconfig::class,
'Configtable' => DB\Admin\Configtable::class,
'patientChecktimeList' => DB\Item\PatientChecktimeList::class,
'Send' => DB\Admin\Send::class,
'ocrKeyword' => DB\Ocr\Keyword::class,
'ocrRawdata' => DB\Ocr\Rawdata::class,
'ocrMatedata' => DB\Ocr\Matedata::class,
'ocrMedicalword' => DB\Ocr\Medicalword::class,
'ocrMatewhite' => DB\Ocr\Matewhite::class,
'ocrMateblack' => DB\Ocr\Mateblack::class,
'ocrSigpatient' => DB\Ocr\Medicalmate::class,
'ocrSigpatient' => DB\Ocr\Sigpatient::class,
'ocrMedical' => DB\Ocr\Medical::class,
'ocrOcrannex' => DB\Ocr\Ocrannex::class,
'ocrRawword' => DB\Ocr\Rawword::class,
'ocrRawblack' => DB\Ocr\Rawblack::class,
'itemFormmodel' => DB\Item\Formmodel::class,
'ocrRawlock' => DB\Ocr\Rawlock::class,
'ocrMedicallock' => DB\Ocr\Medicallock::class,
'ocrChangetype' => DB\Ocr\Changetype::class,
'ocrDeletename' => DB\Ocr\Deletename::class,
'ocrReplace' => DB\Ocr\Replace::class,
'ocrAnnextype' => DB\Ocr\Annextype::class,
'ocrSigkeyword' => DB\Ocr\Sigkeyword::class,
'ocrCt' => DB\Ocr\Ct::class,
'blindMethodLog' => DB\Item\Blindmethodlog::class,
'ocrLoseannex' => DB\Ocr\Loseannex::class,
'dictionaryChecknameweight' => DB\Dictionary\Checknameweight::class,
'ocrMatesearch' => DB\Ocr\Matesearch::class,
'itemChecknameweight' => DB\Item\Checknameweight::class,
'itemSign' => DB\Item\Sign::class,
'itemOcrCsae' => DB\Project\OcrCsae::class,
'itemOcrTitleKeys' => DB\Project\OcrTitleKeys::class,
'itemOcrCsaePaitent' => DB\Project\OcrCsaePaitent::class,
'itemOcrCsaePaitentDetail' => DB\Project\OcrCsaePatientDetail::class,
'itemOcrCasePatientSpecialdetail' => DB\Project\OcrCasePatientSpecialdetail::class,
'itemRemarks' => DB\Item\ItemRemarks::class,
'ocrCtcase' => DB\Ocr\Ctcase::class,
'ocrCaseremark' => DB\Ocr\Caseremark::class,
'itemOcrCsaeNew' => DB\Project\OcrCsaeNew::class,
'itemOcrCsaePaitentDetailNew' => DB\Project\OcrCsaePatientDetailNew::class,
'itemOcrCasePatientSpecialdetailNew' => DB\Project\OcrCasePatientSpecialdetailNew::class,
'ocrOcrannexnew' => DB\Ocr\Ocrannexnew::class,
'ocrDrug' => DB\Ocr\Drug::class,
'ocrTake' => DB\Ocr\Take::class,
'ocrCtreplace' => DB\Ocr\Ctreplace::class,
'ocrMatedrug' => DB\Ocr\Matedrug::class,
'ocrDrugcategory' => DB\Ocr\Drugcategory::class,
'dictionaryMedicaltake' => DB\Dictionary\Medicaltake::class,
'dictionaryMedicalword' => DB\Dictionary\Medicalword::class,
'dictionaryDrugcategory' => DB\Dictionary\Drugcategory::class,
'dictionaryDrug' => DB\Dictionary\Drug::class,
'itemConfirm' => DB\Item\Confirm::class,
'itemLock' => DB\Item\Lock::class,
'medicalMatewhite' => DB\Medical\Matewhite::class,
'medicalMateblack' => DB\Medical\Mateblack::class,
'medicalMatedrug' => DB\Medical\Matedrug::class,
'medicalOcrdata' => DB\Medical\Ocrdata::class,
'medicalLock' => DB\Medical\Lock::class,
'Allowpatientwrite' => DB\Item\Allowpatientwrite::class,
'changeUpdateLog' => DB\Project\Changeupdatelog::class,
'Recharge' => DB\Pay\Recharge::class,
'Transfer' => DB\Pay\Transfer::class,
'tmpDeletename' => DB\Tmp\Deletename::class,
'tmpDrug' => DB\Tmp\Drug::class,
'tmpDrugcategory' => DB\Tmp\Drugcategory::class,
'tmpKeyword' => DB\Tmp\Keyword::class,
'tmpMedical' => DB\Tmp\Medical::class,
'tmpMedicalblack' => DB\Tmp\Medicalblack::class,
'tmpMedicaldrug' => DB\Tmp\Medicaldrug::class,
'tmpMedicallock' => DB\Tmp\Medicallock::class,
'tmpMedicaltake' => DB\Tmp\Medicaltake::class,
'tmpMedicalwhite' => DB\Tmp\Medicalwhite::class,
'tmpMedicalword' => DB\Tmp\Medicalword::class,
'tmpRawblack' => DB\Tmp\Rawblack::class,
'tmpRawdata' => DB\Tmp\Rawdata::class,
'tmpRawlock' => DB\Tmp\Rawlock::class,
'tmpRawmate' => DB\Tmp\Rawmate::class,
'tmpRawword' => DB\Tmp\Rawword::class,
'tmpReplace' => DB\Tmp\Replace::class,
'tmpSigkeyword' => DB\Tmp\Sigkeyword::class,
'tmpHospital' => DB\Tmp\Hospital::class,
'tmpInspect' => DB\Tmp\Inspect::class,
'tmpPatienthospital' => DB\Tmp\Patienthospital::class,
'tmpReport' => DB\Tmp\Report::class,
'dictionaryDiseasecategory' => DB\Dictionary\Diseasecategory::class,
'dictionaryDisease' => DB\Dictionary\Disease::class,
'tmpAnnex' => DB\Tmp\Annex::class,
'tmpPatient' => DB\Tmp\Patient::class,
'tmpPatientct' => DB\Tmp\Patientct::class,
'tmpCustom' => DB\Tmp\Custom::class,
'tmpTable' => DB\Tmp\Table::class,
'tmpText' => DB\Tmp\Text::class,
'tmpOutmedical' => DB\Tmp\Outmedical::class,
'tmpIntervene' => DB\Tmp\Intervene::class,
'tmpIntervene0' => DB\Tmp\Intervene0::class,
'tmpIntervene1' => DB\Tmp\Intervene1::class,
'tmpIntervene2' => DB\Tmp\Intervene2::class,
'ocrRawlockunique' => DB\Ocr\Rawlockunique::class,
'tmpCtreplace' => DB\Tmp\Ctreplace::class,
'TmpDoctoradviceoriginal' => DB\Tmp\Doctoradviceoriginal::class,
'tmpDoctoradvicelock' => DB\Tmp\Doctoradvicelock::class,
'tmpDoctoradviceannex' => DB\Tmp\Doctoradviceannex::class,
'tmpDoctoradvicereplace' => DB\Tmp\Doctoradvicereplace::class,
'tmpDoctoradvicematewhite' => DB\Tmp\Doctoradvicematewhite::class,
'tmpDoctoradvicemateblack' => DB\Tmp\Doctoradvicemateblack::class,
'tmpDoctoradvicematedrug' => DB\Tmp\Doctoradvicematedrug::class,
'tmpDoctoradvicetable' => DB\Tmp\Doctoradvicetable::class,
'tmpDoctoradvicepatient' => DB\Tmp\Doctoradvicepatient::class,
'tmpDoctoradviceformal' => DB\Tmp\Doctoradviceformal::class,
'itemMessageField' => DB\Item\MessageField::class,
'itemMessageSend' => DB\Item\MessageSend::class,
'itemMessageSendPatient' => DB\Item\MessageSendPatient::class,
'itemMessageSendLog' => DB\Item\MessageSendLog::class,
'collectCategory' => DB\Collect\Category::class,
'collectInspect' => DB\Collect\Inspect::class,
'collectHospital' => DB\Collect\Hospital::class,
'collectItemhospital' => DB\Collect\Itemhospital::class,
'collectOut' => DB\Collect\Out::class,
'collectItemout' => DB\Collect\Itemout::class,
'collectDrugcategory' => DB\Collect\Drugcategory::class,
'collectDrug' => DB\Collect\Drug::class,
'collectMedicaltake' => DB\Collect\Medicaltake::class,
'collectMedicalword' => DB\Collect\Medicalword::class,
'collectItemdrug' => DB\Collect\Itemdrug::class,
'collectEcg' => DB\Collect\Ecg::class,
'collectItemecg' => DB\Collect\Itemecg::class,
'collectCt' => DB\Collect\Ct::class,
'collectItemct' => DB\Collect\Itemct::class,
'collectReport' => DB\Collect\Report::class,
'collectItemreport' => DB\Collect\Itemreport::class,
'collectKeywordcat' => DB\Collect\Keywordcat::class,
'collectKeyword' => DB\Collect\Keyword::class,
'collectRawword' => DB\Collect\Rawword::class,
'collectItemkeyword' => DB\Collect\Itemkeyword::class,
'collectCost' => DB\Collect\Cost::class,
'collectItemcost' => DB\Collect\Itemcost::class,
'itemMessagePatientChase' => DB\Item\MessageSendPatientChase::class,
'collectPatienthospital' => DB\Collect\Patienthospital::class,
'itemChangeReference' => DB\Project\ChangeReference::class,
'collectPatientecg' => DB\Collect\Patientecg::class,
'collectPatientct' => DB\Collect\Patientct::class,
'collectPatientreport' => DB\Collect\Patientreport::class,
'collectPatientraw' => DB\Collect\Patientraw::class,
'collectPatientrawmate' => DB\Collect\Patientrawmate::class,
'collectPatientrawblack' => DB\Collect\Patientrawblack::class,
'collectPatientrawlock' => DB\Collect\Patientrawlock::class,
'collectPatientmedical' => DB\Collect\Patientmedical::class,
'collectPatientmedicalwhite' => DB\Collect\Patientmedicalwhite::class,
'collectPatientmedicalblack' => DB\Collect\Patientmedicalblack::class,
'collectPatientmedicaldrug' => DB\Collect\Patientmedicaldrug::class,
'collectPatientmedicallock' => DB\Collect\Patientmedicallock::class,
'collectPatientout' => DB\Collect\Patientout::class,
'ocrSpecialmedical' => DB\Ocr\Specialmedical::class,
'collectPatient' => DB\Collect\Patient::class,
'collectAnnex' => DB\Collect\Annex::class,
'exportSas' => DB\Export\Sas::class,
'collectSighospital' => DB\Collect\Sighospital::class,
'collectSigout' => DB\Collect\Sigout::class,
'collectSigkeyword' => DB\Collect\Sigkeyword::class,
'itemFormrecognition' => DB\Project\Itemformrecognition::class,
'itemPatientFormContentRecognition' => DB\Project\PatientFormContentRecognition::class,
'itemPatientformimgcontent' => DB\Item\Patientformimgcontent::class,
'dictionaryDetectname' => DB\Dictionary\Detectname::class,
'dictionaryDetectkeyword' => DB\Dictionary\Detectkeyword::class,
'collectTable' => DB\Collect\Table::class,
'collectText' => DB\Collect\Text::class,
'collectCustom' => DB\Collect\Custom::class,
'dictionaryDetectblackword' => DB\Dictionary\Detectblackword::class,
'itemIdentificationexport' => DB\Project\Identificationexport::class,
'itemResultidentify' => DB\Item\ItemResultidentify::class,
'itemEventwatchdog' => DB\Item\itemEventwatchdog::class,
'templeAnnex' => DB\Temple\Annex::class,
'templeChecklist' => DB\Temple\checklist::class,
'itemMedicaltake' => DB\Item\ItemMedicaltake::class,
'doctoradviceOriginal' => DB\Doctoradvice\DoctoradviceOriginal::class,
'itemPatientinfo' => DB\Item\Patientinfo::class,
'dictionaryLeverform' => DB\Dictionary\Leverform::class,
'dictionaryLevervalue' => DB\Dictionary\Levervalue::class,
'itemSignaturebatch' => DB\Item\Signaturebatch::class,
'itemSignaturedetail' => DB\Item\Signaturedetail::class,
'itemSignatoryCollecttypeocr' => DB\Item\SignatoryCollecttypeocr::class,
'itemDetectpatient' => DB\Item\Detectpatient::class,
'dictionaryOcrreplace' => DB\Dictionary\Ocrreplace::class,
'itemCissclass' => DB\Item\Cissclass::class,
'itemCissoption' => DB\Item\Cissoption::class,
'itemPatientciss' => DB\Item\Patientciss::class,
'fixednametype' => DB\Dictionary\Fixednametype::class,
'fixedname' => DB\Dictionary\Fixedname::class,
'projectMsgset' => DB\Project\Msgset::class,
'projectMsginfo' => DB\Project\Msginfo::class,
'projectMsgsend' => DB\Project\Msgsend::class,
'itemPlanviolate' => DB\Item\Planviolate::class,
'adminWeblink' => DB\Admin\Weblink::class,
'adminWorkbatch' => DB\Admin\Workbatch::class,
'adminWorkinfo' => DB\Admin\Workinfo::class,
'dictionaryEventset' => DB\Dictionary\Eventset::class,
'dictionaryEventattr' => DB\Dictionary\Eventattr::class,
'adminMedicallock' => DB\Admin\Medicallock::class,
'itemPatientevent' => DB\Item\Patientevent::class,
'itemPatienteventannex' => DB\Item\Patienteventannex::class,
'itemPatienteventset' => DB\Item\Patienteventset::class,
'projectPatientwork' => DB\Project\Patientwork::class,
'itemRandomsecondary' => DB\Item\Randomsecondary::class,
'projectMedicalquestion' => DB\Project\Medicalquestion::class,
'projectMedicalquestioninfo' => DB\Project\Medicalquestioninfo::class,
'projectMedicalconfirm' => DB\Project\Medicalconfirm::class,
'projectMedicalconfirminfo' => DB\Project\Medicalconfirminfo::class,
'projectMedicalset' => DB\Project\Medicalset::class,
'itemCheckdate' => DB\Item\Checkdate::class,
'dictionaryRegion' => DB\Dictionary\Region::class,
'projectExceedswindow' => DB\Project\Exceedswindow::class,
'projectCmdrugset' => DB\Project\Cmdrugset::class,
'collectPatientdrug' => DB\Collect\Patientdrug::class,
'dictionaryItemcategory' => DB\Dictionary\Itemcategory::class,
'itemPackage' => DB\Item\Package::class,
],
'factories' => [
DB\Item\Info::class => DbFactory::class,
DB\Item\Centerdata::class => DbFactory::class,
DB\Item\ItemDrugbatch::class => DbFactory::class,
DB\Item\ItemSigdrugbatch::class => DbFactory::class,
DB\Item\ItemSigdrugset::class => DbFactory::class,
DB\Item\ItemPatientdrugbatch::class => DbFactory::class,
DB\Item\ItemPatientdrugset::class => DbFactory::class,
DB\Item\Signatory::class => DbFactory::class,
DB\Item\Jobstaff::class => DbFactory::class,
DB\Item\Researchflowcat::class => DbFactory::class,
DB\Item\Researchstage::class => DbFactory::class,
DB\Item\Random::class => DbFactory::class,
DB\Item\Checktime::class => DbFactory::class,
DB\Item\Checknames::class => DbFactory::class,
DB\Item\Itemdocument::class => DbFactory::class,
DB\Item\Documentcontent::class => DbFactory::class,
DB\Item\Researchremark::class => DbFactory::class,
DB\Item\PatientChecktimeForm::class => DbFactory::class,
DB\Item\Superrole::class => DbFactory::class,
DB\Item\Checkcontent::class => DbFactory::class,
DB\Item\Patientcheckcontent::class => DbFactory::class,
DB\Dictionary\Checkcategory::class => ShareDbFactory::class,
DB\Dictionary\Checkname::class => ShareDbFactory::class,
DB\Dictionary\Csset::class => ShareDbFactory::class,
DB\Dictionary\Document::class => ShareDbFactory::class,
DB\Dictionary\Genercsetinfo::class => ShareDbFactory::class,
DB\Dictionary\Genercsetinfotype::class => ShareDbFactory::class,
DB\Dictionary\Itemjob::class => ShareDbFactory::class,
DB\Dictionary\Patientattr::class => ShareDbFactory::class,
DB\Dictionary\Patientattrselect::class => ShareDbFactory::class,
DB\Dictionary\Checknameattr::class => ShareDbFactory::class,
DB\Dictionary\Unblinding::class => ShareDbFactory::class,
DB\Dictionary\Ocr::class => ShareDbFactory::class,
DB\Dictionary\Unit::class => ShareDbFactory::class,
DB\Admin\Menu::class => DbFactory::class,
DB\Admin\User::class => DbFactory::class,
DB\Admin\Role::class => DbFactory::class,
DB\Admin\Rolemenurelation::class => DbFactory::class,
DB\Admin\Userrolerelation::class => DbFactory::class,
DB\Admin\Realrole::class => DbFactory::class,
DB\Admin\Realrolesignatoryrelation::class => DbFactory::class,
DB\Admin\Log::class => DbFactory::class,
DB\Admin\Appletsrolemenurelation::class => DbFactory::class,
DB\Admin\Appletsmenu::class => DbFactory::class,
DB\Signatory\Info::class => DbFactory::class,
DB\Signatory\User::class => DbFactory::class,
DB\Signatory\Department::class => DbFactory::class,
DB\Item\Patient::class => DbFactory::class,
DB\Item\Patientattrs::class => DbFactory::class,
DB\Dictionary\Form::class => DbFactory::class,
DB\Item\PatientCard::class => DbFactory::class,
DB\Item\Randblock::class => DbFactory::class,
DB\Item\Randgroup::class => DbFactory::class,
DB\Item\Randnumber::class => DbFactory::class,
DB\Item\Randomdetails::class => DbFactory::class,
DB\Item\Blockgroup::class => DbFactory::class,
DB\Dictionary\FormField::class => DbFactory::class,
DB\Dictionary\FormVersion::class => DbFactory::class,
DB\Dictionary\FormGroup::class => DbFactory::class,
DB\Dictionary\ItemForm::class => DbFactory::class,
DB\Dictionary\ItemFormField::class => DbFactory::class,
DB\Item\ItemFormVersion::class => DbFactory::class,
DB\Dictionary\ItemFormGroup::class => DbFactory::class,
DB\Item\Rolemodulerelation::class => DbFactory::class,
DB\Dictionary\ItemFormFieldText::class => DbFactory::class,
DB\Dictionary\ItemFormFieldRadio::class => DbFactory::class,
DB\Item\FormFieldText::class => DbFactory::class,
DB\Item\FormFieldRadio::class => DbFactory::class,
DB\Item\Patientchecktime::class => DbFactory::class,
DB\Item\PatientForm::class => DbFactory::class,
DB\Item\Informedconsent::class => DbFactory::class,
DB\Item\Imgtxtdiscern::class => DbFactory::class,
DB\Project\Patientworkannex::class => DbFactory::class,
DB\Project\Identificationresult::class => DbFactory::class,
DB\Item\Unblindings::class => DbFactory::class,
DB\Item\PatientFormContent::class => DbFactory::class,
DB\Item\PatientFormContentImg::class => DbFactory::class,
DB\Project\Identificationresultchange::class => DbFactory::class,
DB\Item\Urgentunblind::class => DbFactory::class,
DB\Item\File::class => DbFactory::class,
DB\Project\Setocrfield::class => DbFactory::class,
DB\Item\Question::class => DbFactory::class,
DB\Item\Reply::class => DbFactory::class,
DB\Dictionary\FormRelation::class => DbFactory::class,
DB\Item\FormRelation::class => DbFactory::class,
DB\Item\Export::class => DbFactory::class,
DB\Item\PatientFormContentFieldLock::class => DbFactory::class,
DB\Item\Patientbooked::class => DbFactory::class,
DB\Project\Csae::class => DbFactory::class,
DB\Item\PatientAeContent::class => DbFactory::class,
DB\Project\CsaeRelation::class => DbFactory::class,
DB\Item\Medication::class => DbFactory::class,
DB\Item\Appletsdata::class => DbFactory::class,
DB\Item\Vicecopy::class => DbFactory::class,
DB\Item\Informedconsentsign::class => DbFactory::class,
DB\Work\Show::class => DbFactory::class,
DB\Work\Schedule::class => DbFactory::class,
DB\Work\Approval::class => DbFactory::class,
DB\Item\Downpicture::class => DbFactory::class,
DB\Item\ItemCsaeChecked::class => DbFactory::class,
DB\Item\Answer::class => DbFactory::class,
DB\Item\Signatorypatient::class => DbFactory::class,
DB\Item\Agecountset::class => DbFactory::class,
DB\Dictionary\Rule::class => ShareDbFactory::class,
DB\Dictionary\Formtype::class => ShareDbFactory::class,
DB\Dictionary\Formtyperule::class => ShareDbFactory::class,
DB\Dictionary\Workset::class => ShareDbFactory::class,
DB\Worklist\Itemworklist::class => ShareDbFactory::class,
DB\Worklist\Itemcustomname::class => ShareDbFactory::class,
DB\Worklist\Itemworklistset::class => ShareDbFactory::class,
DB\Worklist\Sigworklist::class => ShareDbFactory::class,
DB\Worklist\Sigcustomname::class => ShareDbFactory::class,
DB\Worklist\Sigworklistset::class => ShareDbFactory::class,
DB\Worklist\Patientinfo::class => ShareDbFactory::class,
DB\Worklist\Patientconnect::class => ShareDbFactory::class,
DB\Worklist\Patientworklist::class => ShareDbFactory::class,
DB\Item\Formpatientsign::class => ShareDbFactory::class,
DB\Dictionary\Listset::class => ShareDbFactory::class,
DB\Listset\Itemlist::class => ShareDbFactory::class,
DB\Listset\Siglist::class => ShareDbFactory::class,
DB\Listset\Operate::class => ShareDbFactory::class,
DB\Listset\Annex::class => ShareDbFactory::class,
DB\Listset\Annexcat::class => ShareDbFactory::class,
DB\Listset\Flow::class => ShareDbFactory::class,
DB\Business\Category::class => ShareDbFactory::class,
DB\Business\Record::class => ShareDbFactory::class,
DB\Business\Recordannex::class => ShareDbFactory::class,
DB\Ark\ArkQuery::class => ArkDbFactory::class,
DB\Project\Backupschange::class => ShareDbFactory::class,
DB\Dictionary\Questionanswer::class => ShareDbFactory::class,
DB\Project\Changesendlog::class => ShareDbFactory::class,
DB\Odm\OdmSyncRecord::class => DbFactory::class,
DB\Item\ItemInfosign::class => DbFactory::class,
DB\Item\Logtype::class => DbFactory::class,
DB\Item\Exportpdf::class => DbFactory::class,
DB\Project\Identificationresultdestroy::class => DbFactory::class,
DB\Item\PatientFormUnlock::class => DbFactory::class,
DB\Item\PatientWorkCount::class => DbFactory::class,
DB\Admin\Websitefiling::class => DbFactory::class,
DB\Project\Doctoridea::class => DbFactory::class,
DB\Item\PatientFormLogic::class => DbFactory::class,
DB\Item\PatientFormLogicError::class => DbFactory::class,
DB\Dictionary\Questionconfig::class => EdcDbFactory::class,
DB\Admin\Configtable::class => DbFactory::class,
DB\Admin\Send::class => DbFactory::class,
DB\Item\PatientChecktimeList::class => DbFactory::class,
DB\Item\Formmodel::class => DbFactory::class,
DB\Ocr\Keyword::class => ShareDbFactory::class,
DB\Ocr\Rawdata::class => ShareDbFactory::class,
DB\Ocr\Matedata::class => ShareDbFactory::class,
DB\Ocr\Medicalword::class => ShareDbFactory::class,
DB\Ocr\Matewhite::class => ShareDbFactory::class,
DB\Ocr\Mateblack::class => ShareDbFactory::class,
DB\Ocr\Sigpatient::class => ShareDbFactory::class,
DB\Ocr\Medical::class => ShareDbFactory::class,
DB\Ocr\Ocrannex::class => ShareDbFactory::class,
DB\Ocr\Rawword::class => ShareDbFactory::class,
DB\Ocr\Rawblack::class => ShareDbFactory::class,
DB\Ocr\Rawlock::class => ShareDbFactory::class,
DB\Ocr\Medicallock::class => ShareDbFactory::class,
DB\Ocr\Changetype::class => ShareDbFactory::class,
DB\Ocr\Deletename::class => ShareDbFactory::class,
DB\Ocr\Replace::class => ShareDbFactory::class,
DB\Ocr\Annextype::class => ShareDbFactory::class,
DB\Ocr\Sigkeyword::class => ShareDbFactory::class,
DB\Ocr\Ct::class => ShareDbFactory::class,
DB\Item\Blindmethodlog::class => DbFactory::class,
DB\Ocr\Loseannex::class => DbFactory::class,
DB\Dictionary\Checknameweight::class => ShareDbFactory::class,
DB\Ocr\Matesearch::class => DbFactory::class,
DB\Item\Checknameweight::class => DbFactory::class,
DB\Item\Sign::class => DbFactory::class,
DB\Item\Checknameweight::class => ShareDbFactory::class,
DB\Project\OcrCsae::class => DbFactory::class,
DB\Project\OcrTitleKeys::class => DbFactory::class,
DB\Project\OcrCsaePaitent::class => DbFactory::class,
DB\Project\OcrCsaePatientDetail::class => DbFactory::class,
DB\Project\OcrCasePatientSpecialdetail::class => DbFactory::class,
DB\Item\ItemRemarks::class => DbFactory::class,
DB\Ocr\Ctcase::class => ShareDbFactory::class,
DB\Ocr\Caseremark::class => ShareDbFactory::class,
DB\Project\OcrCsaeNew::class => DbFactory::class,
DB\Project\OcrCsaePatientDetailNew::class => DbFactory::class,
DB\Project\OcrCasePatientSpecialdetailNew::class => DbFactory::class,
DB\Ocr\Ocrannexnew::class => ShareDbFactory::class,
DB\Ocr\Drug::class => ShareDbFactory::class,
DB\Ocr\Take::class => ShareDbFactory::class,
DB\Ocr\Ctreplace::class => ShareDbFactory::class,
DB\Ocr\Matedrug::class => ShareDbFactory::class,
DB\Ocr\Drugcategory::class => ShareDbFactory::class,
DB\Dictionary\Medicaltake::class => ShareDbFactory::class,
DB\Dictionary\Medicalword::class => ShareDbFactory::class,
DB\Dictionary\Drugcategory::class => ShareDbFactory::class,
DB\Dictionary\Drug::class => ShareDbFactory::class,
DB\Medical\Matewhite::class => ShareDbFactory::class,
DB\Medical\Mateblack::class => ShareDbFactory::class,
DB\Medical\Matedrug::class => ShareDbFactory::class,
DB\Medical\Ocrdata::class => ShareDbFactory::class,
DB\Medical\Lock::class => ShareDbFactory::class,
DB\Item\Allowpatientwrite::class => DbFactory::class,
DB\Project\Changeupdatelog::class => DbFactory::class,
DB\Pay\Recharge::class => DbFactory::class,
DB\Pay\Transfer::class => DbFactory::class,
DB\Tmp\Deletename::class => ShareDbFactory::class,
DB\Tmp\Drug::class => ShareDbFactory::class,
DB\Tmp\Drugcategory::class => ShareDbFactory::class,
DB\Tmp\Keyword::class => ShareDbFactory::class,
DB\Tmp\Medical::class => ShareDbFactory::class,
DB\Tmp\Medicalblack::class => ShareDbFactory::class,
DB\Tmp\Medicaldrug::class => ShareDbFactory::class,
DB\Tmp\Medicallock::class => ShareDbFactory::class,
DB\Tmp\Medicaltake::class => ShareDbFactory::class,
DB\Tmp\Medicalwhite::class => ShareDbFactory::class,
DB\Tmp\Medicalword::class => ShareDbFactory::class,
DB\Tmp\Rawblack::class => ShareDbFactory::class,
DB\Tmp\Rawdata::class => ShareDbFactory::class,
DB\Tmp\Rawlock::class => ShareDbFactory::class,
DB\Tmp\Rawmate::class => ShareDbFactory::class,
DB\Tmp\Rawword::class => ShareDbFactory::class,
DB\Tmp\Replace::class => ShareDbFactory::class,
DB\Tmp\Sigkeyword::class => ShareDbFactory::class,
DB\Tmp\Hospital::class => ShareDbFactory::class,
DB\Tmp\Inspect::class => ShareDbFactory::class,
DB\Tmp\Patienthospital::class => ShareDbFactory::class,
DB\Tmp\Report::class => ShareDbFactory::class,
DB\Dictionary\Disease::class => ShareDbFactory::class,
DB\Dictionary\Diseasecategory::class => ShareDbFactory::class,
DB\Tmp\Annex::class => ShareDbFactory::class,
DB\Tmp\Patient::class => ShareDbFactory::class,
DB\Tmp\Patientct::class => ShareDbFactory::class,
DB\Tmp\Custom::class => ShareDbFactory::class,
DB\Tmp\Table::class => ShareDbFactory::class,
DB\Tmp\Text::class => ShareDbFactory::class,
DB\Tmp\Outmedical::class => ShareDbFactory::class,
DB\Tmp\Intervene::class => ShareDbFactory::class,
DB\Tmp\Intervene0::class => ShareDbFactory::class,
DB\Tmp\Intervene1::class => ShareDbFactory::class,
DB\Tmp\Intervene2::class => ShareDbFactory::class,
DB\Ocr\Rawlockunique::class => ShareDbFactory::class,
DB\Tmp\Ctreplace::class => ShareDbFactory::class,
DB\Tmp\Doctoradviceoriginal::class => ShareDbFactory::class,
DB\Tmp\Doctoradvicelock::class => ShareDbFactory::class,
DB\Tmp\Doctoradvicematewhite::class => ShareDbFactory::class,
DB\Tmp\Doctoradvicemateblack::class => ShareDbFactory::class,
DB\Tmp\Doctoradvicematedrug::class => ShareDbFactory::class,
DB\Tmp\Doctoradvicetable::class => ShareDbFactory::class,
DB\Tmp\Doctoradviceannex::class => ShareDbFactory::class,
DB\Tmp\Doctoradvicepatient::class => ShareDbFactory::class,
DB\Tmp\Doctoradviceformal::class => ShareDbFactory::class,
DB\Item\MessageField::class => DbFactory::class,
DB\Item\MessageSend::class => DbFactory::class,
DB\Item\MessageSendPatient::class => DbFactory::class,
DB\Item\MessageSendLog::class => DbFactory::class,
DB\Collect\Category::class => ShareDbFactory::class,
DB\Collect\Inspect::class => ShareDbFactory::class,
DB\Collect\Hospital::class => ShareDbFactory::class,
DB\Collect\Itemhospital::class => ShareDbFactory::class,
DB\Collect\Out::class => ShareDbFactory::class,
DB\Collect\Itemout::class => ShareDbFactory::class,
DB\Collect\Drugcategory::class => ShareDbFactory::class,
DB\Collect\Drug::class => ShareDbFactory::class,
DB\Collect\Medicaltake::class => ShareDbFactory::class,
DB\Collect\Medicalword::class => ShareDbFactory::class,
DB\Collect\Itemdrug::class => ShareDbFactory::class,
DB\Collect\Ecg::class => ShareDbFactory::class,
DB\Collect\Itemecg::class => ShareDbFactory::class,
DB\Collect\Ct::class => ShareDbFactory::class,
DB\Collect\Itemct::class => ShareDbFactory::class,
DB\Collect\Report::class => ShareDbFactory::class,
DB\Collect\Itemreport::class => ShareDbFactory::class,
DB\Collect\Keywordcat::class => ShareDbFactory::class,
DB\Collect\Keyword::class => ShareDbFactory::class,
DB\Collect\Rawword::class => ShareDbFactory::class,
DB\Collect\Itemkeyword::class => ShareDbFactory::class,
DB\Collect\Cost::class => ShareDbFactory::class,
DB\Collect\Itemcost::class => ShareDbFactory::class,
DB\Item\MessageSendPatientChase::class => DbFactory::class,
DB\Collect\Patienthospital::class => ShareDbFactory::class,
DB\Project\ChangeReference::class => DbFactory::class,
DB\Collect\Patientecg::class => ShareDbFactory::class,
DB\Collect\Patientct::class => ShareDbFactory::class,
DB\Collect\Patientreport::class => ShareDbFactory::class,
DB\Collect\Patientraw::class => ShareDbFactory::class,
DB\Collect\Patientrawmate::class => ShareDbFactory::class,
DB\Collect\Patientrawblack::class => ShareDbFactory::class,
DB\Collect\Patientrawlock::class => ShareDbFactory::class,
DB\Collect\Patientmedical::class => ShareDbFactory::class,
DB\Collect\Patientmedicalwhite::class => ShareDbFactory::class,
DB\Collect\Patientmedicalblack::class => ShareDbFactory::class,
DB\Collect\Patientmedicaldrug::class => ShareDbFactory::class,
DB\Collect\Patientmedicallock::class => ShareDbFactory::class,
DB\Collect\Patientout::class => ShareDbFactory::class,
DB\Ocr\Specialmedical::class => ShareDbFactory::class,
DB\Collect\Patient::class => ShareDbFactory::class,
DB\Collect\Annex::class => ShareDbFactory::class,
DB\Export\Sas::class => DbFactory::class,
DB\Collect\Sighospital::class => ShareDbFactory::class,
DB\Collect\Sigout::class => ShareDbFactory::class,
DB\Collect\Sigkeyword::class => ShareDbFactory::class,
DB\Project\Itemformrecognition::class => DbFactory::class,
DB\Project\PatientFormContentRecognition::class => DbFactory::class,
DB\Item\Patientformimgcontent::class => DbFactory::class,
DB\Dictionary\Detectname::class => ShareDbFactory::class,
DB\Dictionary\Detectkeyword::class => ShareDbFactory::class,
DB\Dictionary\Detectblackword::class => ShareDbFactory::class,
DB\Collect\Table::class => ShareDbFactory::class,
DB\Collect\Text::class => ShareDbFactory::class,
DB\Collect\Custom::class => ShareDbFactory::class,
DB\Project\Identificationexport::class => DbFactory::class,
DB\Item\ItemResultidentify::class => DbFactory::class,
DB\Item\itemEventwatchdog::class => DbFactory::class,
DB\Temple\Annex::class => DbFactory::class,
DB\Temple\checklist::class => DbFactory::class,
DB\Item\ItemMedicaltake::class => DbFactory::class,
DB\Doctoradvice\DoctoradviceOriginal::class => DbFactory::class,
DB\Item\Patientinfo::class => DbFactory::class,
DB\Dictionary\Leverform::class => ShareDbFactory::class,
DB\Dictionary\Levervalue::class => ShareDbFactory::class,
DB\Item\SignatoryCollecttypeocr::class => DbFactory::class,
DB\Item\Detectpatient::class => ShareDbFactory::class,
DB\Dictionary\Ocrreplace::class => ShareDbFactory::class,
DB\Item\Cissclass::class => ShareDbFactory::class,
DB\Item\Cissoption::class => ShareDbFactory::class,
DB\Item\Patientciss::class => ShareDbFactory::class,
DB\Dictionary\Fixednametype::class => ShareDbFactory::class,
DB\Dictionary\Fixedname::class => ShareDbFactory::class,
DB\Project\Msgset::class => ShareDbFactory::class,
DB\Project\Msginfo::class => ShareDbFactory::class,
DB\Project\Msgsend::class => ShareDbFactory::class,
DB\Item\Planviolate::class => ShareDbFactory::class,
DB\Admin\Weblink::class => DbFactory::class,
DB\Admin\Workbatch::class => ShareDbFactory::class,
DB\Admin\Workinfo::class => ShareDbFactory::class,
DB\Dictionary\Eventset::class => ShareDbFactory::class,
DB\Dictionary\Eventattr::class => ShareDbFactory::class,
DB\Admin\Medicallock::class => ShareDbFactory::class,
DB\Item\Patientevent::class => ShareDbFactory::class,
DB\Item\Patienteventannex::class => ShareDbFactory::class,
DB\Item\Patienteventset::class => ShareDbFactory::class,
DB\Project\Patientwork::class => ShareDbFactory::class,
DB\Item\Randomsecondary::class => ShareDbFactory::class,
DB\Project\Medicalquestion::class => ShareDbFactory::class,
DB\Project\Medicalquestioninfo::class => ShareDbFactory::class,
DB\Project\Medicalconfirm::class => ShareDbFactory::class,
DB\Project\Medicalconfirminfo::class => ShareDbFactory::class,
DB\Project\Medicalset::class => ShareDbFactory::class,
DB\Item\Checkdate::class => ShareDbFactory::class,
DB\Dictionary\Region::class => ShareDbFactory::class,
DB\Project\Exceedswindow::class => ShareDbFactory::class,
DB\Project\Cmdrugset::class => ShareDbFactory::class,
DB\Collect\Patientdrug::class => ShareDbFactory::class,
DB\Dictionary\Itemcategory::class => ShareDbFactory::class,
DB\Item\Package::class => ShareDbFactory::class,
]
];
$appendMap = [
'itemPatientFormLogicErrorQuery' => [DB\Item\PatientFormLogicErrorQuery::class, EdcDbFactory::class],
'itemPatientFormLogicErrorPointer' => [DB\Item\PatientFormLogicErrorPointer::class, EdcDbFactory::class], // 逻辑核查错误表
'itemPatientFormLogic' => [DB\Item\PatientFormLogic::class, EdcDbFactory::class], // 逻辑核查公式表
'itemPatientFormLogicError' => [DB\Item\PatientFormLogicError::class, EdcDbFactory::class], // 逻辑核查错误表
'itemPatientFormLogicErrorLog' => [DB\Item\PatientFormLogicErrorLog::class, EdcDbFactory::class],
'patientChecktimeListEdc' => [DB\Item\PatientChecktimeListEdc::class, EdcDbFactory::class],
'patientWorkCountEdc' => [DB\Item\PatientWorkCountEdc::class, EdcDbFactory::class],
'realRolemodulerelationEdc' => [DB\Item\RolemodulerelationEdc::class, EdcDbFactory::class],
'adminMenuEdc' => [DB\Admin\MenuEdc::class, EdcDbFactory::class],
'itemLock' => [DB\Item\Lock::class, EdcDbFactory::class],
'itemConfirm' => [DB\Item\Confirm::class, EdcDbFactory::class],
'patientFormLock' => DB\Item\PatientFormLock::class,
'itemFormEdc' => [DB\Item\ItemFormEdc::class, EdcDbFactory::class],
'itemCheckcontentEdc' => [DB\Item\ItemCheckcontentEdc::class, EdcDbFactory::class],
'patientFormContentUpdated' => DB\Item\PatientFormContentUpdated::class,
'patientFormContentUpdatedLog' => [DB\Item\PatientFormContentUpdatedLog::class, ChainFactory::class],
'patientFormContentCm' => DB\Item\PatientFormContentCm::class,
'itemSignaturebatch' => [DB\Item\Signaturebatch::class, EdcDbFactory::class],
'itemSignaturedetail' => [DB\Item\Signaturedetail::class, EdcDbFactory::class],
'itemLogicErrorReportBlack' => [DB\Item\ItemLogicErrorReportBlack::class, EdcDbFactory::class],
'patientFormResultchangeUpdated' => DB\Item\PatientFormResultchangeUpdated::class,
'itemPatientFormContentDelete' => DB\Item\PatientFormContentDelete::class,
'projectPatientworkbatch' => [DB\Project\Patientworkbatch::class, EdcDbFactory::class],
'projectPatientworkinfo' => [DB\Project\Patientworkinfo::class, EdcDbFactory::class],
'logLogin' => [DB\Log\LogLogin::class, DbFactory::class],
];
//function generate123 ($appendMap): array {
// $r = [];
// foreach ($appendMap as $name => $db) {
// if (is_array($db)) {
// list($class, $factory) = $db;
// $r['aliases'][$name] = $class;
// $r['factories'][$class] = $factory;
// } else {
// $r['aliases'][$name] = $db;
// $r['factories'][$db] = DbFactory::class;
// }
// }
//
// return $r;
//}
return ArrayHelper::merge($dbServerMap, call_user_func(function () use ($appendMap) {
$r = [];
foreach ($appendMap as $name => $db) {
if (is_array($db)) {
list($class, $factory) = $db;
$r['aliases'][$name] = $class;
$r['factories'][$class] = $factory;
} else {
$r['aliases'][$name] = $db;
$r['factories'][$db] = DbFactory::class;
}
}
return $r;
}));

View File

@ -0,0 +1,107 @@
<?php
declare(strict_types=1);
namespace Application;
use Application\Controller\CmController;
use Application\Controller\DashboardController;
use Application\Controller\ExposeController;
use Application\Controller\FieldController;
use Application\Controller\FormController;
use Application\Controller\FormgroupController;
use Application\Controller\LogController;
use Application\Controller\LogicController;
use Application\Controller\PatientH5Controller;
use Application\Controller\project\ae\AeController;
use Application\Controller\project\ItemPhotoController;
use Application\Controller\project\SaeController;
use Application\Controller\SasController;
use Application\Controller\Temple\ChecklistController;
use Application\Controller\ThirdController;
use Application\Controller\v2\ItemFieldController;
use Application\Controller\WechatController;
use Application\Factory\ServiceFactory;
use Application\Mvc\Controller\Plugins\LocalService;
use Application\Mvc\Controller\Plugins\RenderApiJson;
use Application\Service\Extension\Helper\ArrayHelper;
use Laminas\ServiceManager\Factory\InvokableFactory;
use Project\Controller\AeresultController;
$routes = include 'routes/v1.php';
$routesV2 = include 'routes/v2.php';
$dashboardRoutes = include 'routes/dashboard.php';
// 这里的路由会自动注册controller
$mainRoutes = include 'routes/main.php';
$allRoutes = [];
foreach ([$routes, $routesV2, $dashboardRoutes, $mainRoutes->getRoutes()] as $route) {
$allRoutes = ArrayHelper::merge($allRoutes, $route);
}
return [
'router' => [
'routes' => $allRoutes
],
'controllers' => [
'factories' => ArrayHelper::merge([
Controller\IndexController::class => InvokableFactory::class,
Controller\LoginController::class => InvokableFactory::class,
Controller\CommonController::class => InvokableFactory::class,
FormController::class => InvokableFactory::class,
FieldController::class => InvokableFactory::class,
\Application\Controller\item\FormController::class => InvokableFactory::class,
\Application\Controller\item\FieldController::class => InvokableFactory::class,
FormgroupController::class => InvokableFactory::class,
\Application\Controller\item\patient\FormController::class => InvokableFactory::class,
ItemPhotoController::class => InvokableFactory::class,
\Project\Controller\ItemphotoController::class => InvokableFactory::class,
AeController::class => InvokableFactory::class,
AeresultController::class => InvokableFactory::class,
\Application\Controller\item\QuestionController::class => InvokableFactory::class,
\Application\Controller\CrontabController::class => InvokableFactory::class,
SaeController::class => InvokableFactory::class,
WechatController::class => InvokableFactory::class,
LogicController::class => InvokableFactory::class,
ExposeController::class => InvokableFactory::class,
SasController::class => InvokableFactory::class,
DashboardController::class => InvokableFactory::class,
CmController::class => InvokableFactory::class,
ChecklistController::class => InvokableFactory::class,
PatientH5Controller::class => InvokableFactory::class,
LogController::class => InvokableFactory::class,
ItemFieldController::class => InvokableFactory::class,
ThirdController::class => InvokableFactory::class,
], $mainRoutes->getControllers()),
],
'controller_plugins' => [
'aliases' => [
'LocalService' => LocalService::class,
'RenderApiJson' => RenderApiJson::class,
],
'factories' => [
LocalService::class => ServiceFactory::class,
RenderApiJson::class => InvokableFactory::class,
],
],
'service_manager' => include __DIR__."/service.config.php",
'laminas-cli' => include __DIR__.'/cli/laminasCli.config.php',
'view_manager' => [
'display_not_found_reason' => true,
'display_exceptions' => true,
'doctype' => 'HTML5',
'not_found_template' => 'error/404',
'exception_template' => 'error/index',
'template_map' => [
'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
'layout/dashboardLayout' => __DIR__ . '/../view/layout/dashboardLayout.phtml',
'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
'error/404' => __DIR__ . '/../view/error/404.phtml',
'error/index' => __DIR__ . '/../view/error/index.phtml',
],
'template_path_stack' => [
__DIR__ . '/../view',
],
],
];

View File

@ -0,0 +1,20 @@
<?php
return \Application\Service\Extension\Helper\RouterHelper::generateRouteMap([
\Application\Controller\DashboardController::class => [
['/dashboard' => 'index'],
['/dashboard/file-timestamp' => 'fileTimestamp'],
['/dashboard/exception' => 'exception'],
['/api/dashboard/file-timestamp' => 'apiFileTimestamp'],
['/api/dashboard/exception' => 'apiException'],
['/api/dashboard/exception/detail' => 'apiExceptionDetail'],
['/dashboard/unit-test' => 'unitTest'],
['/api/dashboard/unitTest' => 'apiUnitTest'],
['/dashboard/redis' => 'redis'],
['/api/dashboard/redis' => 'apiRedis'],
['/dashboard/form-log' => 'formLog'],
['/api/dashboard/form-log' => 'apiFormLog'],
['/dashboard/analysis' => 'analysis'],
['/dashboard/analysis-response-time' => 'analysisResponseTime'],
['/api/dashboard/analysisResponseTime' => 'apiAnalysisResponseTime'],
]
]);

View File

@ -0,0 +1,71 @@
<?php
use Application\Service\Extension\Helper\RouterHelper;
use Laminas\ServiceManager\Factory\InvokableFactory;
/**
* 下面是定义路由地址的规则
*
* 如果路由定义重复了, 这里会覆盖掉之前定义的路由地址
*
* 路由地址 => [控制器类, 方法名]
* '/item/field/view' => ['ItemFieldControllerV2', 'view'],
*
* ItemFieldControllerV2 相当于是 \Application\Controller\v2\ItemFieldController::class
* 因为在下面的 CONTROLLER_ALIAS 定义了别名
*
* 你也可以这么写
* '/item/field/view' => [\Application\Controller\v2\ItemFieldController::class, 'view'],
*/
$mainRoutes = [
// '/item/field/view' => ['ItemFieldControllerV2', 'view'],
'/patient/form/inactive' => ['PatientFormControllerV2', 'inactive'], // 受试者表单失活
'/patient/form/compare' => [\Application\Controller\item\patient\FormController::class, 'compare'], // 受试者表单失活
];
return new class ($mainRoutes) {
private array $_routes = [];
private array $_controllers = [];
const CONTROLLER_ALIAS = [
'ItemFieldControllerV2' => \Application\Controller\v2\ItemFieldController::class,
'PatientFormControllerV2' => \Application\Controller\v2\PatientFormController::class,
];
public function __construct($routes)
{
$this->_routes = $routes;
}
private function _getControllerClass(string $controllerClass)
{
$class = self::CONTROLLER_ALIAS[$controllerClass] ?? $controllerClass;
if (!isset($this->_controllers[$class])) {
$this->_controllers[$class] = InvokableFactory::class;
}
return $class;
}
public function getRoutes(): array
{
$res = [];
foreach ($this->_routes as $url => $params) {
$res[$url] = RouterHelper::literalRoute($url, $this->_getControllerClass($params[0]), $params[1]);
}
return $res;
}
public function getControllers(): array
{
return $this->_controllers;
}
};

View File

@ -0,0 +1,306 @@
<?php
/**
* 所有所属v1的控制器路由
*/
use Application\Controller\CommonController;
use Application\Controller\CrontabController;
use Application\Controller\FieldController;
use Application\Controller\FormController;
use Application\Controller\FormgroupController;
use Application\Controller\LoginController;
use Application\Controller\project\SaeController;
use Application\Service\Extension\Helper\RouterHelper;
return RouterHelper::generateRouteMap([
LoginController::class => [
['/login-code' => 'loginCode'],
['/v2/login-code' => 'loginCodeV2'],
['/is-scan' => 'isScan'],
['/forward' => 'forward'],
['/upload' => 'upload'],
['/callback' => 'callback'],
['/send-sms' => 'sendSms'],
['/h5/send-sms' => 'h5SendSms'],
['/bind' => 'bind'],
['/h5/bind' => 'h5Bind'],
['/logout' => 'logout'],
['/mini-login' => 'miniLogin'],
['/' => 'index'],
['/wechatuser' => 'wechatuser'],
['/oauth' => 'oauth'],
['/getwebsitefiling' => 'getwebsitefiling'],
['/patientH5/oauth' => 'patientH5Oauth'],
['/patientH5' => 'patientH5'],
['/webH5' => 'webH5'],
['/webH5/oauth' => 'webH5Oauth'],
['/webH5Forward' => 'webH5Forward'],
['/webH5Callback' => 'webH5Callback'],
['/login/accountPwd' => 'accountPwd'],
['/login/send-sms' => 'sendLoginSms'],
],
\Application\Controller\WechatController::class => [
['/wechat/entry' => 'entry'],
['/wechat/bind' => 'bind'],
['/wechat/bind-captcha' => 'bindCaptcha'],
['/wechat/bind-submit' => 'bindSubmit'],
],
FormController::class => [
['/dictionary/form' => 'index'],
['/dictionary/form/del' => 'del'],
['/dictionary/form/view' => 'view'],
['/dictionary/form/getField' => 'getField'],
['/dictionary/form/create' => 'create'],
['/dictionary/form/preview' => 'preview'],
['/dictionary/form/copyTo' => 'copyTo'],
['/dictionary/form/copy' => 'copy'],
],
FieldController::class => [
['/dictionary/field' => 'index'],
['/dictionary/field/view' => 'view'],
['/dictionary/field/version' => 'version'],
['/dictionary/field/create' => 'create'],
['/dictionary/field/del' => 'del'],
['/dictionary/field/addVersion' => 'addVersion'],
['/dictionary/field/getRelationInformation' => 'getRelationInformation'],
],
\Application\Controller\item\FieldController::class => [
['/item/field' => 'index'],
['/item/field/view' => 'view'],
['/item/field/version' => 'version'],
['/item/field/create' => 'create'],
['/item/field/del' => 'del'],
['/item/field/addVersion' => 'addVersion'],
['/item/field/getRelationInformation' => 'getRelationInformation'],
['/item/field/selectcheck' => 'selectcheck'],
['/item/field/selectform' => 'selectform'],
['/item/field/selectchecktime' => 'selectchecktime'],
['/item/field/selectformchecktime' => 'selectformchecktime'],
['/item/field/setolddata' => 'setolddata'],
['/item/field/formFieldSelect' => 'formFieldSelect'],
['/item/field/formChecktimeSelect' => 'formChecktimeSelect'],
['/item/field/checktimeFormRealtion' => 'checktimeFormRealtion']
],
\Application\Controller\item\FormController::class => [
['/item/form' => 'index'],
['/item/form/del' => 'del'],
['/item/form/view' => 'view'],
['/v1/item/form/lock' => 'lock'], // 锁定表单
['/item/form/create' => 'create'],
/** @see \Application\Controller\item\FormController::previewAction() */
['/item/form/getdrugcm' => 'getdrugcm'], //获取合并用药表单-药物-默认用药原因
['/item/form/preview' => 'preview'], // 表单结构预览
['/v1/item/form/unlock' => 'unlock'], // 解锁表单
['/v1/item/form/detail' => 'detail'], // 查看表单详情
['/v1/item/form/getannexdata' => 'getannexdata'], // 获取化验单锁定数据
['/v1/item/form/getanneximg' => 'getanneximg'], // 获取一对多化验单图片
['/item/form/getField' => 'getField'],
['/v1/item/form/outPreview' => 'outPreview'], // 预览脱落表单
['/v2/item/form/outPreview' => 'outPreviewV2'], // 预览脱落表单V2
['/v1/item/form/createOutForm' => 'createOutForm'], // 创建/编辑 脱落表单
['/v1/item/form/viewOutForm' => 'viewOutForm'], // 查看脱离表单详情,
['/item/form/processed' => 'processed'], //一对多表单删除后对应的质疑历史数据的处理
/** @see \Application\Controller\item\FormController::scoreFormPreviewAction() */
['/v1/item/form/scoreFormPreview' => 'scoreFormPreview'], // 预览评分功能表单
/** @see \Application\Controller\item\FormController::scoreFormListAction() */
['/v1/item/form/scoreFormList' => 'scoreFormList'], // 获取所有评分功能表单列表
/** @see \Application\Controller\item\FormController::scoreFormViewAction() */
['/v1/item/form/scoreFormView' => 'scoreFormView'], // 获取所有评分功能表单列表
['/item/form/itemFormSource' => 'itemFormSource'], // 获取项目表单数据源数据
],
FormgroupController::class => [
['/dictionary/formgroup/treelist' => 'treelist'],
['/dictionary/formgroup/list' => 'list'],
['/dictionary/formgroup/edit' => 'edit'],
['/dictionary/formgroup/save' => 'save'],
['/dictionary/formgroup/delete' => 'delete'],
],
\Application\Controller\item\patient\FormController::class => [
['/patient/form' => 'index'],
['/patient/form/del' => 'del'],
/** @see \Application\Controller\item\patient\FormController::viewAction() */
['/patient/form/view' => 'view'],
['/patient/form/flush' => 'flush'], // 清空表单数据
['/patient/form/recovery' => 'recovery'], // 恢复删除的表单
['/patient/form/unlock' => 'unlock'], // 申请表单解锁
['/patient/form/create' => 'create'],
['/patient/form/cover-by-question-reply' => 'coverByQuestionReply'],
['/patient/form/applyunlock' => 'applyunlock'],
['/patient/form/saveApplyunlock' => 'saveApplyunlock'],
['/patient/form/confirmApplyunlock' => 'confirmApplyunlock'],
/** @see \Application\Controller\item\patient\FormController::scoreFormCreateAction() */
['/v1/item/form/scoreFormCreate' => 'scoreFormCreate'], // 获取所有评分功能表单列表
/** @see \Application\Controller\item\patient\FormController::importAction() */
['/patient/form/import' => 'import'], // 导入受试者表单数据
['/patient/form/importCheckForm' => 'importCheckForm'], // 导入受试者表单数据
['/patient/form/getImportErrorData' => 'getImportErrorData'], // 获取错误数据
['/patient/form/getImportErrorInfo' => 'getImportErrorInfo'], // 获取错误数据
['/patient/form/importDataSave' => 'importDataSave'], // 数据录入
['/patient/form/importDataExecute' => 'importDataExecute'], // 数据验证
['/patient/form/delErrorInfo' => 'delErrorInfo'], // 删除某一条数据
['/patient/form/delCache' => 'delCache'], // 删除缓存
/** @see \Application\Controller\item\patient\FormController::tempStorageAction() */
['/patient/form/tempStorage' => 'tempStorage'], // 暂存表单数据
/** @see \Application\Controller\item\patient\FormController::lockShareForm() */
['/patient/form/lockShareForm' => 'lockShareForm'], // 锁定常规识别类表单
['/patient/form/unlockShareForm' => 'unlockShareForm'], // 解锁常规识别类表单
['/patient/form/uploadMultiShareFormImage' => 'uploadMultiShareFormImage'],
['/patient/form/deleteShareFormMulti' => 'deleteShareFormMulti']
],
CommonController::class => [
['/common/upload' => 'upload'],
['/common/uploadImg' => 'uploadImg'],
['/common/renderFormComponent' => 'renderFormComponent'],
['/common/formatExpression' => 'formatExpression'],
['/common/calculate' => 'calculateExpression'],
['/common/v2/calculate' => 'calculateExpressionV2'], // 表单公式计算v2
['/common/showPic' => 'showPic'],
['/common/errormsg' => 'errormsg'],
['/common/miniVersion' => 'miniVersion'], // 获取最新小程序版本
['/common/patient-mobile' => 'patientMobile'], // 受试者手机号码是否存在
//['/com/editSend'=>'editSend'],
//['/com/savePatientSend' => 'savePatientSend'],
['/common/download' => 'download'], // 在线下载文件
['/common/signFileUrl' => 'signFileUrl'], // 在线下载文件签名
['/common/qrcode' => 'qrcode'], // 企业微信图片
],
SaeController::class => [
['/v1/item/sae' => 'index'],
['/v1/item/sae/patient' => 'patient'],
['/v1/item/sae/saecount' => 'saecount'],
['/v1/item/sae/form' => 'form'],
['/v1/item/sae/create' => 'create'],
['/v1/item/sae/view' => 'view'],
],
\Application\Controller\item\QuestionController::class => [
['/v1/item/question/preview' => 'preview'],
['/v1/item/question/updateQuestion' => 'updateQuestion'],
['/v1/item/question/replyQuestion' => 'replyQuestion'],
['/v1/item/question/historyReply' => 'historyReply'],
['/question/view' => 'questionView'],
],
CrontabController::class => [
['/crontab/manyReidentification' => 'manyReidentification'],
],
\Application\Controller\IndexController::class => [
['/test' => 'test'],
],
\Application\Controller\EdcController::class => [
['/v1/edc/importQuery' => 'importQuery']
],
\Application\Controller\QAController::class => [
['/qa' => 'form'],
['/qa/submit' => 'submit'],
],
\Application\Controller\LogicController::class => [
/** @see LogicController::indexAction */
['/logic' => 'index'],
['/logic/view' => 'view'],
['/logic/delete' => 'delete'],
['/logic/create' => 'create'],
['/logic/config' => 'config'],
['/logic/formList' => 'formList'],
['/logic/varList' => 'varList'],
['/logic/varListV2' => 'varListV2'],
['/logic/errorList' => 'errorList'],
['/logic/execute' => 'execute'],
['/logic/formList' => 'formList'],
/** @see LogicController::formViewAction() */
['/logic/form/view' => 'formView'],
/** @see LogicController::formDetailAction() */
['/logic/form/detail' => 'formDetail'],
/** @see LogicController::errorClosedAction() */
['/logic/error/closed' => 'errorClosed'], // 关闭质疑
/** @see LogicController::queriedErrorListAction() */
['/logic/error/queried' => 'queriedErrorList'], // sdm质疑列表
/** @see LogicController::errorQueriedCreateAction() */
['/logic/error/queried/create' => 'errorQueriedCreate'], // 发送质疑
/** @see LogicController::errorReplyAction() */
['/logic/error/reply' => 'errorReply'],
/** @see LogicController::setQueriedAction() */
['/logic/error/setQueried' => 'setQueried'],
/** @see LogicController::geterrorpatientListAction() */
['/logic/error/geterrorpatientList' => 'geterrorpatientList'], // 逻辑核查-受试者列表
/** @see LogicController::geterrorpatientListAction() */
['/logic/error/geterrorchecktimeList' => 'geterrorchecktimeList'], // 逻辑核查-受试者检查点列表
/** @see LogicController::geterrorpatientListAction() */
['/logic/error/getlasterror' => 'getlasterror'], // 逻辑核查-受试者检查点列表
],
\Application\Controller\ExposeController::class => [
/** @see \Application\Controller\ExposeController::reportAction() */
['/expose/report' => 'report'], // edc 化验单质疑推送
['/expose/fileTimestamp' => 'fileTimestamp']
],
\Application\Controller\Drug\DrugController::class => [
['/app/drug/patientDrug' => 'patientDrug'],
['/app/drug/drugLock' => 'drugLock'],
['/app/drug/drugDaySave' => 'drugDaySave'],
['/app/drug/drugDay' => 'drugDay'],
['/app/drug/arrangeDrugSave' => 'arrangeDrugSave'],
],
\Application\Controller\SasController::class => [
['/sas/export' => 'export'],
['/sas/edit' => 'edit'],
['/sas/list' => 'list'],
['/sas/delete' => 'delete'],
],
\Application\Controller\CmController::class => [
['/cm' => 'index'],
['/cm/preview' => 'preview'],
['/cm/view' => 'view'],
['/cm/create' => 'create'],
['/cm/ae/index' => 'aeList'],
['/cm/ae/view' => 'aeListView'],
['/cm/ae/viewRow' => 'aeViewRow'],
['/cm/ae/edit' => 'aeEdit'],
['/cm/ae/delete' => 'aeDelete'],
],
\Application\Controller\Temple\ChecklistController::class => [
['/temple/checklist/siglist' => 'siglist'],
['/temple/checklist/patientlist' => 'patientlist'],
['/temple/checklist/list' => 'list'],
['/temple/checklist/edit' => 'edit'],
['/temple/checklist/save' => 'save'],
['/temple/checklist/delete' => 'delete'],
['/temple/checklist/lock' => 'lock'],
['/temple/checklist/annexlist' => 'annexlist'],
],
\Application\Controller\PatientH5Controller::class => [
['/com/editSend'=>'editSend'],
['/com/savePatientSend' => 'savePatientSend'],
],
\Application\Controller\ThirdController::class => [
['/third/source' => 'source']
]
]);

View File

@ -0,0 +1,10 @@
<?php
use Application\Service\Extension\Helper\RouterHelper;
return RouterHelper::generateRouteMap([
\Project\Controller\AeresultController::class => [
['/v2/project/aeresult/save' => 'v2Save'],
['/v2/project/aeresult/del' => 'v2Del'],
]
]);

View File

@ -0,0 +1,79 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/4 19:28
* @Description
*
*/
namespace Application;
use Application\Factory\RedisExtendFactory;
use Application\Factory\ServiceFactory;
use Application\Service\Baidu\Ocr;
use Application\Service\Extension\Helper\SDMHelper;
use Application\Service\Extension\Wechat\WechatWork;
use Application\Service\Extension\Formatter\Formatter;
use Application\Service\Extension\HttpException;
use Application\Service\Extension\Identity\Identity;
use Application\Service\Extension\Sms\SmsApplication;
use Application\Service\Extension\Uploader\ImageUploader;
use Application\Service\Extension\CommonServiceFactory;
use Application\Service\Extension\Wechat\Wechat;
use Application\Service\HttpSv;
use Application\Service\Logic\form\CheckFormLogic;
use Application\Service\Login\LoginClient;
use Application\Service\Logs;
use Application\Service\OA\OaClient;
use Application\Service\ToolSys\SyncOcrAnnex;
use Application\Service\ToolSys\ToolSys;
use Zend\Stdlib\ArrayUtils;
use Application\SdmWork\WorkUser;
$dbServerConfig = include __DIR__ . "/db.server.config.php";
$CommandServiceConfig = include __DIR__ . "/command.service.config.php";
$serverConfig = [
'aliases' => [
'redisExtend' => Service\Redis\RedisExtend::class,
'imageUploader' => ImageUploader::class,
'wechat' => Wechat::class,
'sms' => SmsApplication::class,
'identity' => Identity::class,
'formatter' => Formatter::class,
'log' => Logs::class,
'httpSv' => HttpSv::class,
'wechatWork' => WechatWork::class,
'workUser' => WorkUser::class,
'ocr' => Ocr::class,
'toolSys' => ToolSys::class,
'syncOcrAnnex' => SyncOcrAnnex::class,
'SDMHelper' => SDMHelper::class,
'OAClient' => OaClient::class,
'CheckFormLogic' => CheckFormLogic::class,
'loginClient' => LoginClient::class,
],
'factories' => [
// 全局的异常处理
'HttpExceptionStrategy'=> HttpException::class,
Wechat::class => CommonServiceFactory::class,
SmsApplication::class => CommonServiceFactory::class,
Service\Redis\RedisExtend::class => RedisExtendFactory::class,
ImageUploader::class => CommonServiceFactory::class,
Identity::class => CommonServiceFactory::class,
Logs::class => ServiceFactory::class,
Formatter::class => CommonServiceFactory::class,
HttpSv::class => ServiceFactory::class,
WechatWork::class => ServiceFactory::class,
WorkUser::class => ServiceFactory::class,
Ocr::class => ServiceFactory::class,
ToolSys::class =>ServiceFactory::class,
SyncOcrAnnex::class => ServiceFactory::class,
SDMHelper::class => ServiceFactory::class,
OaClient::class => ServiceFactory::class,
CheckFormLogic::class => ServiceFactory::class,
LoginClient::class => ServiceFactory::class,
]
];
$serverConfig = ArrayUtils::merge($serverConfig, $dbServerConfig);
return ArrayUtils::merge($serverConfig, $CommandServiceConfig);

View File

@ -0,0 +1,139 @@
<?php
namespace Application\Command;
use Application\Service\DB\Dictionary\FormGroup;
use Application\Service\Extension\Laminas;
use Application\Service\Extension\Queue\jobs\SyncPatientFormJob;
use Application\Service\Extension\Queue\QueueApplication;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Ark 同步脚本
* http://42.192.180.144/arkedc/login.jsp
* username:TEST01 pwd:12345
*
*/
class ArkCommand extends BasicCommand
{
private ?int $itemId = null;
private ?int $itemSignId = null;
private ?int $patientId = null;
private ?int $formId = null;
/**
* 共同页表单类型
*/
const SHARE_PAGE_FORM = [FormGroup::SAE, FormGroup::AE, FormGroup::THROUGH_PROCESS, FormGroup::TEST_SUMMARY];
public function execute(InputInterface $input, OutputInterface $output)
{
// 要同步的项目
$syncItem = [
// 项目id
101 => [ // 中心id
272
]
];
foreach ($syncItem as $itemId => $signArray) {
$this->itemId = $itemId;
foreach ($signArray as $signId) {
$this->itemSignId = $signId;
$patients = $this->getPatients();
foreach ($patients as $patient) {
$this->patientId = $patient;
// 当前受试者所有检查点
$checkTimes = Laminas::$serviceManager->itemPatientchecktime->fetchAll([
'columns' => ['checktime_id'],
'where' => [
'patient_id' => $this->patientId
]
]);
// 共同页
$allCheckTime[] = [
'checktime_id' => 99
];
foreach ($checkTimes as $checkTime) {
if ($checkTime['checktime_id'] == 99) { // 是共同页
$allFormId = Laminas::$serviceManager->itemForm->fetchCol('id', [
'item_id' => $this->itemId,
'group_id' => self::SHARE_PAGE_FORM,
'is_del' => 0
]);
} else {
$allFormId = Laminas::$serviceManager->patientForm->fetchCol('form_id', ['patient_id' => $this->patientId, 'is_del' => 0, 'checktime_id' => $checkTime['checktime_id']]);
}
$allFormId = array_unique(array_values($allFormId));
foreach ($allFormId as $formId) {
$this->formId = $formId;
$form = Laminas::$serviceManager->itemForm->fetchOne([
'where' => ['id' => $this->formId]
]);
if ($checkTime['checktime_id'] != 99) {
if (in_array($form['group_id'], self::SHARE_PAGE_FORM)) {
continue;
}
}
// $model = new SyncPatientFormJob();
// $model->patientId = intval($this->patientId);
// $model->itemSignId = $query['itemsig_id'];
// $model->itemId = intval($query['item_id']);
// $model->formId = $formId; //747 717;
// $model->checkTimeId = intval($checkTime['checktime_id']); //747 717;
// echo "受试者: [{$query['id']}]. 检查点: [{$checkTime['checktime_id']}]. 表单 [{$formId}]. " . PHP_EOL;
$this->push([
'itemId' => $itemId,
'itemSignId' => $signId,
'patientId' => $this->patientId,
'checkTimeId' => $checkTime['checktime_id'],
'formId' => $this->formId,
]);
}
}
}
}
}
parent::execute($input, $output); // TODO: Change the autogenerated stub
}
/**
* 获取所有受试者id
* @return array
*/
private function getPatients(): array
{
$query = Laminas::$serviceManager->patient->fetchCol('id', [
'item_id' => $this->itemId,
'itemsig_id' => $this->itemSignId,
'is_del' => 0
]);
return array_values($query) ?: [];
}
/**
* 投递任务
*/
private function push($params = [])
{
$this->LocalService()->swTaskClient->send([
'svName' => 'itemExport',
'methodName' => 'execute',
'params' => $params
]);
}
}

View File

@ -0,0 +1,32 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/9 14:31
* @Description
*
*/
namespace Application\Command;
use Interop\Container\Containerinterface;
use Application\Common\Container;
use Application\Service\Extension\Laminas;
class BasicCommand extends \Symfony\Component\Console\Command\Command
{
protected $container;
public function __construct(Containerinterface $container)
{
parent::__construct(null);
$this->container = $container;
if(empty(Laminas::$serviceManager)) {
Laminas::initialize($this->container->get('Application'));
}
date_default_timezone_set('Asia/Chongqing');
}
public function LocalService(){
return new Container($this->container);
}
}

View File

@ -0,0 +1,31 @@
<?php
/**
*
* @authorllbjj
* @DateTime2024/3/29 15:12
* @Description
*
*/
namespace Application\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class RunCommand extends BasicCommand
{
protected static string $commandName = 'Run:Server';
protected function configure()
{
$this->setName(self::$commandName);
$this->addOption('sv', null, InputOption::VALUE_REQUIRED, 'Server Name');
$this->addOption('method', null, InputOption::VALUE_REQUIRED, 'Server Method');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->LocalService()->{$input->getOption('sv')}->{$input->getOption('method')}();
return 0;
}
}

View File

@ -0,0 +1,66 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/19 8:28
* @Description
*
*/
namespace Application\Command\Swoole\Client;
use Application\Service\BaseService;
use Interop\Container\ContainerInterface;
class SwLogClient extends BaseService
{
protected $swClient;
public function __construct(ContainerInterface $container)
{
parent::__construct($container);
$this->swClient = new \Swoole\Client(SWOOLE_SOCK_TCP | SWOOLE_KEEP);
self::connect();
}
/**
* @files.saveConflictResolution: overwriteFileOnDisk
* @Description: 连接swoole服务器
* @Author: llbjj
* @Date: 2022-07-04 20:23:15
* @return {*}
*/
private function connect() {
$svConfigData = [
'ip' => '127.0.0.1',
'port' => 9509,
'timeout' => -1
];
$isConnect = $this->swClient->connect($svConfigData['ip'], $svConfigData['port'], $svConfigData['timeout']);
if(!$isConnect) {
throw new \Exception("connect failed. Error: {".$this->swClient->errCode."}\n");
}
}
/**
* @files.saveConflictResolution: overwriteFileOnDisk
* @Description: 关闭swoole客户端
* @Author: llbjj
* @Date: 2022-07-04 20:25:50
* @return {*}
*/
private function close() {
$this->swClient->close();
}
/**
* Notes: 投递日志异步任务
* User: llbjj
* DateTime: 2022/5/19 8:54
*
*/
public function send($data){
if(is_array($data)) $data = json_encode($data);
$data .= '|PHENOL|';
$this->swClient->send($data);
self::close();
}
}

View File

@ -0,0 +1,74 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/19 8:28
* @Description
*
*/
namespace Application\Command\Swoole\Client;
use Application\Service\BaseService;
use Interop\Container\ContainerInterface;
class SwTaskClient extends BaseService
{
protected $swClient;
public function __construct(ContainerInterface $container)
{
parent::__construct($container);
}
/**
* @files.saveConflictResolution: overwriteFileOnDisk
* @Description: 连接swoole服务器
* @Author: llbjj
* @Date: 2022-07-04 20:23:15
* @return {*}
*/
private function connect() {
$this->swClient = new \Swoole\Client(SWOOLE_SOCK_TCP | SWOOLE_KEEP);
$svConfigData = [
'ip' => '127.0.0.1',
'port' => 9511,
'timeout' => -1
];
$isConnect = $this->swClient->connect($svConfigData['ip'], $svConfigData['port'], $svConfigData['timeout']);
if(!$isConnect) {
throw new \Exception("connect failed. Error: {".$this->swClient->errCode."}\n");
}
}
/**
* @files.saveConflictResolution: overwriteFileOnDisk
* @Description: 关闭swoole客户端
* @Author: llbjj
* @Date: 2022-07-04 20:25:50
* @return {*}
*/
private function close() {
$this->swClient->close();
}
/**
* Notes: 投递日志异步任务
* User: llbjj
* DateTime: 2022/5/19 8:54
*
*/
public function send(array $data){
// 是否开启了异步任务
if($this->LocalService()->config['swAsyncTask']['task']) {
$data['token'] = $this->LocalService()->identity->getToken();
$data['domainName'] = $_SERVER['HTTP_HOST'];
$this->connect();
$data = json_encode($data, true);
$data .= '|PHENOL|';
$this->swClient->send($data);
self::close();
}else{
$this->LocalService()->{$data['svName']}->{$data['methodName']}($data['params']);
}
}
}

View File

@ -0,0 +1,55 @@
<?php
/*
* @files.saveConflictResolution: overwriteFileOnDisk
* @Author: llbjj
* @Date: 2022-07-05 08:26:57
* @LastEditTime: 2022-07-05 14:16:46
* @LastEditors: llbjj
* @Description:
* @FilePath: /RemoteWorking/module/Application/src/Command/Swoole/Server/SwItemTipCommand.php
*/
namespace Application\Command\Swoole\Server;
use Application\Command\BasicCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SwItemTipCommand extends BasicCommand {
protected function execute(InputInterface $input, OutputInterface $output)
{
// 开启websock服务
$wsSv = new \Swoole\WebSocket\Server('0.0.0.0', 9590);
// 监听WebSocket连接打开事件
$wsSv->on('open', function(\Swoole\WebSocket\Server $server, $request) use($output) {
// $output->writeln("server: handshake success with fd{$request->fd}".PHP_EOL);
});
// 监听客户端消息事件
$wsSv->on('message', function(\Swoole\WebSocket\Server $server, $frame) use($output) {
$output->writeln("receive from {$frame->fd}:{$frame->data},opcode:{$frame->opcode},fin:{$frame->finish}".PHP_EOL);
});
// 利用swoole的定时器定时请求数据实时推送到客户端timer的简单用法
$addProcess = new \Swoole\Process( function($process) use($wsSv, $output) {
\Swoole\Timer::tick(5000, function (int $timer_id, $wsSv) {
foreach ($wsSv->connections as $fd){
// 根据实际情况获取数据,发送给客户端(目前只是测试数据)
$wsSv->push($fd, $fd.":项目总数量:".$this->LocalService()->itemInfo->getCount().' 个 '.time());
}
}, $wsSv);
});
$wsSv->addProcess($addProcess);
// 监听客户端断开链接
$wsSv->on('close', function($server, $fd) use($output) {
$output->writeln("client {$fd} closed".PHP_EOL);
});
// 启动websock服务
$wsSv->start();
return 0;
}
}

View File

@ -0,0 +1,65 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/12 7:13
* @Description
*
*/
namespace Application\Command\Swoole\Server;
use Swoole\Coroutine;
use Swoole\Process;
use Swoole\Server;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Swoole\Coroutine\Server\Connection;
class SwLogCommand extends \Application\Command\BasicCommand
{
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('APP_PATH'.APP_PATH);
//开启LogTcp服务
$tcpSv = new Server('127.0.0.1', 9509);
$tcpSv->set([
'worker_num' => 2, // 工作进程数量
'task_worker_num' => 4, // 异步任务进程数
'open_eof_check' => true, //打开EOF检测
'package_eof' => '|PHENOL|', //设置EOF
'package_max_length' => 1024 * 1024 * 5
]);
//接收数据
$tcpSv->on('receive', function ($sv, $fd, $reactorId, $data) use($output) {
$sendDataArr = array_filter(explode('|PHENOL|', $data));
if(!empty($sendDataArr)) {
foreach($sendDataArr as $sendData) {
$sv->task($sendData);
}
}
$output->writeln('oprt Logs writing ...'.PHP_EOL);
});
// 定义异步任务
$tcpSv->on('task', function($sv, $task_id, $src_work_id, $data) use ($output){
$output->writeln('start write Log'.PHP_EOL);
$logObj = $this->LocalService()->log;
if(!$logObj->saveLogToDb($data)){
//日志落库失败,将日志数据存缓存文件中
$logObj->saveLogToFile($data);
}
$sv->finish("{$data} -> OK");
});
//处理异步任务的结果(此回调函数在worker进程中执行)
$tcpSv->on('Finish', function ($serv, $task_id, $data) {
echo "AsyncTask[{$task_id}] Finish: {$data}".PHP_EOL;
});
$tcpSv->start();
//parent::execute($input, $output); // TODO: Change the autogenerated stub
return 0;
}
}

View File

@ -0,0 +1,84 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/9/1 15:00
* @Description
*
*/
namespace Application\Command\Swoole\Server;
use Application\Command\BasicCommand;
use Application\Service\Extension\ErrorHandler;
use Application\Service\Extension\Laminas;
use Swoole\Server;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SwTaskCommand extends BasicCommand{
function execute(InputInterface $input, OutputInterface $output)
{
error_reporting(0);
$tcpSv = new Server('127.0.0.1', 9511);
$tcpSv->set([
'worker_num' => 4, // 工作进程数量
'task_worker_num' => 8, // 异步任务进程数
'open_eof_check' => true, //打开EOF检测
'package_eof' => '|PHENOL|', //设置EOF
'package_max_length' => 1024 * 1024 * 5,
'dispatch_mode' => 3,
'task_ipc_mode' => 2,
// 'daemonize' => 1, //以守护进程 1或0
// 'open_eof_split' => true, //swoole底层实现自动分包。比较消耗cpu资源
// 'package_eof' => "|PHENOL|", //设置后缀,一般为"
]);
//接收数据
$tcpSv->on('receive', function ($sv, $fd, $reactorId, $data) use($output) {
$sendDataArr = array_filter(explode('|PHENOL|', $data));
if(!empty($sendDataArr)) {
foreach($sendDataArr as $sendData) {
$sv->task($sendData);
}
}
});
// 定义异步任务
$tcpSv->on('task', function($sv, $task_id, $src_work_id, $data) use ($output){
$taskData = json_decode($data, true);
try {
// 设置Token
Laminas::$token = $taskData['token'] ?? '';
// 调用方法,
$result = $this->LocalService()->{$taskData['svName']}->{$taskData['methodName']}($taskData['params']);
$sv->finish("{$data}");
}catch (\Throwable $throwable) {
$this->saveErrLog($throwable, $taskData);
}
});
//处理异步任务的结果(此回调函数在worker进程中执行)
$tcpSv->on('Finish', function ($serv, $task_id, $data) {
$taskData = json_decode($data, true);
// 发送完成通知
$msgData = [
'title' => "{$taskData['domainName']}】异步任务 {$taskData['svName']}->{$taskData['methodName']}() 执行完成!",
'description' => "AsyncTask[{$task_id}] Finish: {$data}",
'url' => '#'
];
$this->LocalService()->wechatWork->sendMesToUser($msgData);
echo "AsyncTask[{$task_id}] Finish: {$data} -> OK".PHP_EOL;
});
$tcpSv->start();
return 0;
}
public function saveErrLog(&$throwable, &$taskData) {
ErrorHandler::log2txt($throwable, '', $taskData);
}
}

View File

@ -0,0 +1,80 @@
<?php
/*
* @Author: llbjj
* @Date: 2022-07-06 16:18:19
* @LastEditTime: 2022-07-12 18:04:12
* @LastEditors: 863465124 863465124@qq.com
* @Description:
*/
namespace Application\Command\Swoole\Server;
use Application\Command\BasicCommand;
use Application\Common\Com;
use Swoole\Process;
use Swoole\Server;
use Swoole\Timer;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class SwTimerCommand extends BasicCommand {
protected static string $commandName = 'sw:timer';
protected InputInterface $input;
protected OutputInterface $output;
protected function configure()
{
$this->setName(self::$commandName);
$this->addOption('sv', '', InputOption::VALUE_REQUIRED, 'Server Name');
$this->addOption('method', '', InputOption::VALUE_REQUIRED, 'Server Method');
$this->addOption('second', '', InputOption::VALUE_REQUIRED, '任务间隔时间');
$this->addOption('startSecond', '', InputOption::VALUE_REQUIRED, '任务启动时间');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->input = $input;
$this->output = $output;
if($this->input->getOption('startSecond')) {
$this->afterTimer();
}else {
$this->swTimer();
}
return 0;
}
protected function afterTimer() {
swoole_timer_after($this->input->getOption('startSecond'), function() {
$this->swTimer();
});
}
public function swTimer() {
swoole_timer_tick($this->input->getOption('second'), function() {
echo date('Y-m-d H:i:s') . ' -> ' . $this->input->getOption('sv') . ' : ' . $this->input->getOption('method') . PHP_EOL;
$this->LocalService()->{$this->input->getOption('sv')}->{$this->input->getOption('method')}();
});
}
/**
* @Description: 开启一个定时任务信息
* @Author: llbjj
* @Date: 2022-07-11 14:47:30
* @param {*} $timer
* @param {*} $timerName
*/
protected function setTimerFun(array &$timer, string $timerName) {
\Swoole\Timer::tick($timer['msec'], function(int $timer_id) use($timer, $timerName){
$timerContent = date('Y-m-d h:i:s')." 开始定时任务【{$timerName}".PHP_EOL;
Com::writeFile("{$timerName}.log", APP_PATH."/data/log/swooleTimer/{$timerName}/", $timerContent);
$this->LocalService()->{$timer['serviceName']}->{$timer['funName']}();
$nowTime = time();
if(!empty($timer['endTime']) and $nowTime > strtotime($timer['endTime'])){
\Swoole\Timer::clear($timer_id);
}
});
}
}

View File

@ -0,0 +1,294 @@
<?php
namespace Application\Command\Swoole\Server;
use Application\Command\BasicCommand;
use Application\Service\Extension\ErrorHandler;
use Application\Service\Extension\Helper\StringHelper;
use Application\Service\Extension\Laminas;
use Swoole\Coroutine;
use Swoole\Http\Request;
use Swoole\Http\Response;
use Swoole\Process;
use Swoole\WebSocket\CloseFrame;
use Swoole\Coroutine\Http\Server;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use function Swoole\Coroutine\run;
/**
* https://wiki.swoole.com/#/coroutine/ws_server
*/
class WebSocketCommand extends BasicCommand
{
/** @var int 监听的端口 */
const LISTEN_PORT = 9502;
/**
* 监听host
* @var string
*/
public string $host = '0.0.0.0';
public array $serverConfig = [
'daemonize' => true,
'heartbeat_idle_time' => 60 * 20, //允许最大空闲时间
'heartbeat_check_interval' => 60 * 20, //心跳检测间隔
'ssl_cert_file' => APP_PATH . '/config/autoload/ssl.crt',
'ssl_key_file' => APP_PATH . '/config/autoload/ssl.key',
];
/**
* 用来存储 消息模板。用来做缓存
* @var array
*/
protected static array $messageTemplateContext = [];
protected static array $onlineList = [
'user' => [], // 用户对应的socket连接
];
public function execute(InputInterface $input, OutputInterface $output)
{
set_time_limit(0);// 设置超时时间为无限,防止超时
// Process::daemon();
run(function () {
try {
$server = new Server($this->host, self::LISTEN_PORT, true);
$server->set($this->serverConfig);
$server->handle('/', $this->onHandle());
echo "ws服务已开启 {$this->host}:" . self::LISTEN_PORT . PHP_EOL;
$server->start();
} catch (\Throwable $e) {
echo "ws开启失败. {$e->getMessage()}" . PHP_EOL;
}
});
return 0;
}
/**
* 处理首次请求。验证token.
* @param Request $request
* @param Response $ws
*/
public function handleRequest(Request $request, Response $ws)
{
$header = $request->header;
$token = $header['token'] ?? '';
// 设置token
Laminas::setToken($token);
// if ($token) {
// // 用户id => socket连接
// self::$onlineList['user'][$this->getIdentityId()][] = $ws;
// \Co\defer(function() {
// unset(self::$onlineList['user'][$this->getIdentityId()]);
// });
// }
}
/**
* 处理事件
* @return \Closure
*/
public function onHandle(): \Closure
{
return function (Request $request, Response $ws) {
try {
// 首次连接
$this->handleRequest($request, $ws);
// post请求
if (isset($request->post)) {
$this->handleConnect($request, $ws, null);
$ws->close();
} else {
// websocket
$ws->upgrade();
while (true) {
$frame = $ws->recv();
if ($frame === '') {
$ws->close();
break;
} else if ($frame === false && !isset($request->post)) {
// echo 'errorCode: ' . swoole_last_error() . "\n";
$ws->close();
break;
} else {
$this->handleConnect($request, $ws, $frame);
}
}
}
} catch (\Throwable $exception) {
ErrorHandler::log2txt(print_r([
'type' => get_class($exception),
'file' => method_exists($exception, 'getFile') ? $exception->getFile() : '',
'errorMessage' => $exception->getMessage(),
'executeSql' => method_exists($exception, 'getExecuteSql') ? $exception->getExecuteSql() : null,
'line' => $exception->getLine(),
'stack-trace' => explode("\n", $exception->getTraceAsString()),
]), true);
}
};
}
private function handleConnect($request, $ws, $frame)
{
$d = $frame->data ?? $request->post['data'];
// 心跳
if ($d === 'ping') {
$ws->push('pong');
}
if (($data = StringHelper::jsonDecode($d, false)) !== false) {
if ($response = $this->handleMessage($data, $request, $ws)) {
$ws->push(json_encode($response));
}
}
if ($d == 'close' || $request->post || (is_object($frame) && get_class($frame) === CloseFrame::class)) {
$ws->close();
}
}
/**
* ```
* 小程序端拉取所有消息提示 {"action":"pull", "item_id":"项目id"}
* 推送消息 {"action":"publish", "to":"用户id", "item_id":"123"}
* ```
* @param $data
* @param Request $request
* @return array|void
*/
private function handleMessage($data, Request $request, $ws)
{
$action = $data['action'] ?? '';
if ($action === 'pull') { // 小程序主动拉取
self::$onlineList['user'][$this->getIdentityId()][$data['item_id']][] = $ws;
\Co\defer(function() {
unset(self::$onlineList['user'][$this->getIdentityId()]);
});
$allMessage = $this->getAllMessage($data, $request->fd);
return [
'code' => 0,
'data' => $allMessage
];
} elseif ($action === 'publish') { // 广播
if (stripos($data['to'], ',') !== false) {
$list = explode(',', $data['to']);
} else {
$list = (array)$data['to'];
}
foreach ($list as $userId) {
if (isset(self::$onlineList['user'][$userId][$data['item_id']])) {
foreach (self::$onlineList['user'][$userId][$data['item_id']] as $wsConnect) {
if ($tmp = $this->getUserMessageTemplate($userId, $data['item_id'])) {
$wsConnect->push(json_encode([
'code' => 0,
'data' => $tmp
]));
}
}
}
}
return null;
}
}
/**
* 获取所有消息提醒
* @param $request
* @param $fd
* @return array|mixed|\phpDocumentor\Reflection\Types\Mixed
*/
private function getAllMessage($request, $fd)
{
$tmp = $this->getMessageTemplate($request, $fd);
foreach ($tmp as &$item) {
$item['is_message'] = $this->getIsMessage($item['id'], $this->getIdentityId(), $request['item_id']);
}
return $tmp;
}
private function getUserMessageTemplate($userId, $itemId)
{
$template = self::$messageTemplateContext[$userId] ?? null;
if (!$template) {
return null;
}
foreach ($template as &$item) {
$item['is_message'] = $this->getIsMessage($item['id'], $userId, $itemId);
}
return $template;
}
/**
* 获取用户都有哪些模块
* @param $request
* @return array|mixed|\phpDocumentor\Reflection\Types\Mixed
*/
private function getMessageTemplate($request)
{
if (!isset(self::$messageTemplateContext[$this->getIdentityId()])) {
//获取参数
$user_id = Laminas::$serviceManager->identity->getId();
//var_dump('userId', $user_id);
$item_id = $request['item_id'] ?? 0;
//var_dump('$item_id', $item_id);
$user_id = $this->LocalService()->signatoryUser->findsignatoryUser($user_id);
//查询项目
$itemInfoID = $this->LocalService()->itemInfo->getOneFieldVal('fid', "is_del = 0 and id = " . $item_id) ?: 0;
//查询角色下的角色管理用户信息
$roleSignatoryRelationDatas = $this->LocalService()->roleSignatoryRelation->changeUser($itemInfoID, $user_id);
//var_dump('//查询角色下的角色管理用户信息', $roleSignatoryRelationDatas);
if (!empty($roleSignatoryRelationDatas)) {
$role_id_arr = array_unique(array_column($roleSignatoryRelationDatas, 'role_id'));
//获取当前模块在当前用户的角色中是有操作的权限
$whereroleMenuRelation['where'] = "status = 0 and item_id =" . $itemInfoID . " and role_id in (" . implode(',', $role_id_arr) . ")";
$whereroleMenuRelation['columns'] = ['id', 'module_id'];
$roleMenuRelationDatas = $this->LocalService()->realRolemodulerelation->fetchAll($whereroleMenuRelation);
//var_dump('//获取当前模块在当前用户的角色中是有操作的权限', $roleSignatoryRelationDatas);
if (!empty($roleMenuRelationDatas)) {
$module_id_arr = array_unique(array_column($roleMenuRelationDatas, 'module_id'));
//获取模块菜单
if (!empty($type)) {
$whereadminMenu['where'] = "is_del = 0 and menu_name != '' and status = 0 and menu_type = 1 and id in (" . implode(',', $module_id_arr) . ")";
$whereadminMenu['columns'] = ['id', 'applets_menu' => 'menu_name', 'icon', 'url'];
} else {
$whereadminMenu['where'] = "is_del = 0 and applets_menu != '' and status = 0 and menu_type = 1 and id in (" . implode(',', $module_id_arr) . ")";
$whereadminMenu['columns'] = ['id'];
}
$whereadminMenu['order'] = ['menu_order'];
//var_dump($this->LocalService()->adminMenu->fetchAll($whereadminMenu));
self::$messageTemplateContext[$this->getIdentityId()] = $this->LocalService()->adminMenu->fetchAll($whereadminMenu);
\Co\defer(function () {
unset(self::$messageTemplateContext[$this->getIdentityId()]);
});
}
}
}
return self::$messageTemplateContext[$this->getIdentityId()] ?? [];
}
private function getIdentityId(): ?int
{
return Laminas::$serviceManager->identity->getId();
}
private function getIsMessage($menuId, $userId, $itemId): int
{
return Laminas::$serviceManager->redisExtend->setDatabase(6)->getRedisInstance()->getBit("menu:{$itemId}:{$menuId}", $userId) ?: 0;
}
}

View File

@ -0,0 +1,771 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/9 12:25
* @Description
*
*/
namespace Application\Command;
use Application\Common\Container;
use Application\Common\EventEnum;
use Application\Form\ExportModel;
use Application\Form\FieldForm;
use Application\Form\item\ItemFieldForm;
use Application\Form\item\patient\NormalOCRFormModel;
use Application\Form\item\patient\PatientFormModel;
use Application\Service\DB\Db;
use Application\Service\DB\Dictionary\Form;
use Application\Service\DB\Dictionary\FormField;
use Application\Service\DB\Dictionary\FormGroup;
use Application\Service\DB\Item\PatientFormContentImg;
use Application\Service\Extension\Helper\ArrayHelper;
use Application\Service\Extension\Helper\DataHelper;
use Application\Service\Extension\Helper\SDMHelper;
use Application\Service\Extension\Helper\StringHelper;
use Application\Service\Extension\Laminas;
use Application\Service\Extension\Middleware\components\FlushFormContentLog;
use Application\Service\Extension\Middleware\Middleware;
use Application\Service\Extension\Validator\ValidatorApplication;
use ApplicationTest\PatientFormTest;
use GuzzleHttp\Client;
use Laminas\Db\Sql\Predicate\Between;
use Laminas\Db\Sql\Predicate\Like;
use Laminas\Db\Sql\Predicate\Operator;
use Swoole\Process;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class TestCommand extends BasicCommand
{
public $migrateData;
private $formId;
private $mainId = 0;
private $branchMap = [];
/**
* 字段类型映射
*/
public const CONTENT_MAP = [
'1' => FormField::FORM_FIELD_TYPE_TEXT,
'4' => FormField::FORM_FIELD_TYPE_DATE_UK,
'2' => FormField::FORM_FIELD_TYPE_DATE,
'3' => FormField::FORM_FIELD_TYPE_DATE_SECOND,
'13' => FormField::FORM_FIELD_TYPE_DATE_SECOND,
'5' => FormField::FORM_FIELD_TYPE_INTEGER,
'6' => FormField::FORM_FIELD_TYPE_FLOAT_1,
'7' => FormField::FORM_FIELD_TYPE_FLOAT_2,
'8' => FormField::FORM_FIELD_TYPE_RADIO,
'9' => FormField::FORM_FIELD_TYPE_RADIO,
'10' => FormField::FORM_FIELD_TYPE_CHECKBOX,
'11' => FormField::FORM_FIELD_TYPE_CHECKBOX,
'12' => FormField::FORM_FIELD_TYPE_DROPDOWN,
];
public function contab(){
// $iteminfoData = $this->patientattrUpdate($item=107);
$limit = $_POST['limit'] ?: '5000';
$page = $_POST['page'] ?: '1';
$smallItemId = ['105','103','72','74','77'];
$iteminfoData = $this->newLockItemPatientWorkannex(105,$page,$limit);
echo '成功';die;
return true;
}
public function newLockItemPatientWorkannex($smallItemId,$page,$limit,$type=1){
ini_set('memory_limit', -1);
try {
$i = 0;
$j = '';
if (empty($type)){
$this->is_print_sql = true;
$offset = intval(($page - 1) * $limit);
$whereItemIdentificationresultchange['where'] = 'is_del=0 and lock_state=1 and collect_date !=0 and item_id='.$smallItemId;//and patientworkannex_id !=" "
$whereItemIdentificationresultchange['columns'] =['id','collect_date','lock_state','patientworkannex_id','patient_id','checktime_id','form_id','patient_form_id'];
// $whereItemIdentificationresultchange['group'] = ['patient_id','checktime_id','patient_form_id'];
$whereItemIdentificationresultchange['group'] = ['checktime_id','patient_form_id'];
$whereItemIdentificationresultchange['order'] = ['id desc'];
$whereItemIdentificationresultchange['limit'] = $limit;
$whereItemIdentificationresultchange['offset'] = $offset;
// $itemIdentificationresultchangeCount = $this->LocalService()->itemIdentificationresultchange->getCount($whereItemIdentificationresultchange['where']);
$itemIdentificationresultchangeData = $this->LocalService()->itemIdentificationresultchange->fetchAll($whereItemIdentificationresultchange);
foreach ($itemIdentificationresultchangeData as $k => $itemIdentificationresultchangeDatum) {
echo "正在处理第{$k}" . PHP_EOL;
$newWork['collect_date'] = $itemIdentificationresultchangeDatum['collect_date'] != '' ? strtotime($itemIdentificationresultchangeDatum['collect_date']) : '';
$newWork['change_type'] = 1;
$newWork['lock_state'] = 1;
if (empty($itemIdentificationresultchangeDatum['patient_form_id'])) {
echo '<pre>';print_r($itemIdentificationresultchangeDatum);die;
}
// $where = "id in (".$itemIdentificationresultchangeDatum['patientworkannex_id'].")";
$where = 'is_del=0 and patient_id='.$itemIdentificationresultchangeDatum['patient_id'].' and checktime_id='.$itemIdentificationresultchangeDatum['patient_id'].' and patient_form_id='.$itemIdentificationresultchangeDatum['patient_form_id'];
$resultWork = $this->LocalService()->itemPatientworkannex->update($newWork,$where);
if ($resultWork) {
echo '更新成功' . PHP_EOL;
}
// echo '<pre>';print_r($itemIdentificationresultchangeDatum);die;
$j .= '<pre>'.$page.'--'.$resultWork;
$i++;
}
// var_dump($this->LocalService()->itemPatientworkannex::getDbProfile());
echo $i.$j;die;
}else{
$offset = intval(($page - 1) * $limit);
//时间条件
$time = ' and FROM_UNIXTIME(up_annex_date ,"%Y-%m-%d")="2022-09-17"';
// $time = '';
$whereItemPatientworkannex['where'] = 'is_del=0 and item_id =' . $smallItemId.' and annex_type !=2 and lock_state=0'.$time;//annex_type !=3//只查手动写和图片上传的
$whereItemPatientworkannex['group'] = ['checktime_id','patient_form_id','form_id'];
$whereItemPatientworkannex['columns'] =['id','checktime_id','patient_form_id','form_id','patient_id','item_id'];
$whereItemPatientworkannex['order'] = ['id desc'];
$whereItemPatientworkannex['limit'] = $limit;
$whereItemPatientworkannex['offset'] = $offset;
$itemPatientworkannexData = $this->LocalService()->itemPatientworkannex->fetchAll($whereItemPatientworkannex);
if (!empty($itemPatientworkannexData)){
foreach($itemPatientworkannexData as $itemPatientworkannexDataKey => $itemPatientworkannexDataValue){
echo "正在处理第{$itemPatientworkannexDataKey}" . PHP_EOL;
// $where = 'is_del=0 and lock_state=1 and patientworkannex_id !="" and checktime_id ='.$itemPatientworkannexDataValue['checktime_id'].' and patient_form_id='.$itemPatientworkannexDataValue['patient_form_id'].' and item_id='.$smallItemId.' and patient_id='.$itemPatientworkannexDataValue['checktime_id'];
// and patientworkannex_id !=""
$where = 'is_del=0 and lock_state=1 and checktime_id ='.$itemPatientworkannexDataValue['checktime_id'].' and patient_form_id='.$itemPatientworkannexDataValue['patient_form_id'].' and item_id='.$smallItemId.' and patient_id='.$itemPatientworkannexDataValue['patient_id'];
$wheres['where'] = $where;
$wheres['columns'] = ['id','collect_date','checktime_id','patient_form_id','form_id','patient_id','item_id'];
$changeInfo = $this->LocalService()->itemIdentificationresultchange->fetchOne($wheres);
if (!empty($changeInfo)){
$newWork['collect_date'] = $changeInfo['collect_date'] != '' ? strtotime($changeInfo['collect_date']) :'';
// $newWork['change_type'] = 1;
$newWork['lock_state'] = 1;
$upWhere = 'is_del=0 and patient_id='.$changeInfo['patient_id'].' and item_id='.$changeInfo['item_id'].' and patient_form_id='.$changeInfo['patient_form_id'].' and checktime_id='.$changeInfo['checktime_id'];
$resultWork = $this->LocalService()->itemPatientworkannex->update($newWork,$upWhere);
if ($resultWork) {
echo '更新成功' . PHP_EOL;
}
$j .= '<pre>'.$page.'--'.$resultWork;
}
$i++;
}
}
// var_dump($this->LocalService()->itemPatientworkannex::getDbProfile());
// echo $i.$j;die;
}
}catch (\Throwable $exception) {
var_dump($exception->getMessage());die;
}
}
protected function execute(InputInterface $input, OutputInterface $output)
{
//
$a = new ExportModel();
$a->exportLogicError(['item_id' => 220]);
var_dump($a);die;
;
// 290950,291490,291491,291492,291493
// 远大
Laminas::$serviceManager->itemFormField->update(['is_del' => 1], ['id' => [290950,291490,291491,291492,291493]]);
$v = $this->LocalService()->itemForm->buildFieldVersion(87277);
$this->LocalService()->itemFormVersion->update(['field' => $v], ['form_id' => 87277]);
die;
die;
$postValues = array (
'INDYN' => '1',
'DYN' => '',
'PICT' =>
array (
),
'MCO' => '',
// 'DMSTDAT' => '2024-02-21',
'INQU' => '30',
'INDAT' => '2024-08-21',
);
$expression = SDMHelper::app()->expression->setValues($postValues)->setExpression("((210-INQU)/DATEDIF(INDAT,DMSTDAT,'D'))*1")->execute()->getExecuteCompile();
var_dump($expression);die;
$maxFieldId = 350000;
$endTime = '2024-06-20';
$handleCount = 200;
for ($i = 1; $i <= $maxFieldId; $i = $i + $handleCount) {
$query = Laminas::$serviceManager->patientFormContentImg->fetchAll([
'columns' => ['content_id', 'img_src', 'field_id', 'form_id'],
'where' => [
// new Operator('create_time', Operator::OP_LTE, strtotime($endTime . ' 23:59:59')),
'is_del' => 0,
// 'form_id' => 90712,
// 'patient_id' => 2864,
// 'checktime_id' => 1410,
new Between('form_id', $i + 1, $i + $handleCount),
]
]);
if ($query) {
$allImgData = ArrayHelper::index($query, null, [function($el) {
return $el['content_id'];
}, 'field_id']);
foreach ($allImgData as $contentId => $imgDataItem) {
if (!$contentId) {
continue;
}
$contentData = Laminas::$serviceManager->patientFormContent->fetchOne([
'where' => ['id' => $contentId, 'is_del' => 0]
]) ?: false;
if (SDMHelper::app()->form->getGroupId($contentData['form_id']) == FormGroup::NORMAL_OCR) {
continue;
}
if ($contentData === false) {
echo '数据被删除了, 图片没被删????' . PHP_EOL;
}
$fix = false;
foreach ($imgDataItem as $fieldId => $fieldIdItem) {
if (!$fieldId) {
continue;
}
// echo "正在处理 {$contentId} 的 {$fieldId}" . PHP_EOL;
$contentDataRow = StringHelper::jsonDecode($contentData['data']);
$has = false;
$isDelete = false;
foreach ($contentDataRow as $key => $row) {
if (DataHelper::getFieldId($key) == $fieldId) {
$has = true;
$rowImg = StringHelper::jsonDecode($row);
if (count($rowImg) !== count($fieldIdItem)) {
$con = [
'item_id' => $contentDataRow['item_id'],
'itemsig_id' => $contentDataRow['itemsig_id'],
'patient_id' => $contentDataRow['patient_id'],
'form_id' => $contentDataRow['form_id'],
'checktime_id' => $contentDataRow['checktime_id'], // 贯穿全程
'content_id' => $contentData['id'],
// 'field_id' => $fieldId
];
if (SDMHelper::app()->form->getIsProcess($contentDataRow['form_id'])) {
unset($con['content_id']);
unset($con['checktime_id']);
}
if ($isDelete === false) {
// 把所有旧数据都清理掉
Laminas::$serviceManager->patientFormContentImg->update(['is_del' => 1], $con);
$isDelete = true;
}
foreach ($rowImg as $image) {
$src = DataHelper::handleImageSrc($image['url']);
$condition = array_filter([
'item_id' => $contentDataRow['item_id'],
'itemsig_id' => $contentDataRow['itemsig_id'],
'patient_id' => $contentDataRow['patient_id'],
'form_id' => $contentDataRow['form_id'],
'checktime_id' => $contentDataRow['checktime_id'],
'img_src' => $src,
'img_name' => $image['name'],
// 'img_type' => PatientFormContentImg::IMG_TYPE_NORMAL,
'content_id' => $contentData['id'],
// 'field_id' => $fieldId
]);
$hasImg = Laminas::$serviceManager->patientFormContentImg->fetchOne([
'where' => $condition
]);
$getType = function ($versionField) use ($contentDataRow) {
if ($versionField['type'] != FormField::FORM_FIELD_TYPE_UPLOAD_IMAGE) {
return 0;
}
if ($versionField['var_name'] == 'CHECKIMG') {
if (SDMHelper::app()->form->getGroupId($contentDataRow['form_id']) == FormGroup::CHECK_DO) {
return PatientFormModel::ANNEX_TYPE_DO;
}
return 1;
} elseif (in_array($versionField['var_name'], ['OUTPLANCHECK', 'OPCH'])) {
return 2;
}
return 0;
};
// 没有就insert, 有就把is_del 改成0
if (!$hasImg) {
$versionData = SDMHelper::app()->form->getVersionData($contentDataRow['form_id']);
$type = $getType($versionData[$fieldId]);
Laminas::$serviceManager->patientFormContentImg->save(ArrayHelper::merge($condition, [
'img_type' => $type == 0 ? PatientFormContentImg::IMG_TYPE_NORMAL : $type,
'field_id' => $fieldId,
'create_time' => time()
]));
} else {
Laminas::$serviceManager->patientFormContentImg->update([
'is_del' => 0,
'field_id' => $fieldId,
], ['id' => $hasImg['id']]);
}
}
// var_dump($fieldId);
echo "正在处理 {$contentId}{$fieldId}" . PHP_EOL;
var_dump($rowImg);
var_dump($imgDataItem);
$fix = true;
echo '图片数量不符' . PHP_EOL;
}
}
}
if ($has === false) {
Laminas::$serviceManager->patientFormContentImg->update(['is_del' => 1], [
'content_id' => $contentId
]);
}
}
// if ($fix === true) {
// echo '图片数量不符' . PHP_EOL;
// }
}
}
//
// var_dump($query);die;
}
die;
echo "已处理 $id , 共计 $maxCount" . PHP_EOL;
foreach ($query as $item) {
$newData = $item['new_data'] ? unserialize($item['new_data']) : '';
$oldData = $item['old_data'] ? unserialize($item['old_data']) : '';
$note = $item['change_data'];
// if (!$oldData && stripos(explode(':', $note)[0], '新增') !== false) {
//// echo '新增';
// } elseif ($newData && $oldData && stripos(explode(':', $note)[0], '修改') !== false) {
//// echo '编辑';
// }
$helper = SDMHelper::app()->setAttributes(['content_id' => $item['event_id']])->formContent;
if (Laminas::$serviceManager->patientFormContentUpdatedLog->fetchOne([
'where' => ['create_time' => $item['create_time'], 'content_id' => $item['event_id']]
])) {
echo "跳过 content_id {$item['event_id']}" . PHP_EOL;
continue;
}
$contentLog = [
'item_id' => $helper->getItemId(),
'patient_id' => $helper->getPatientId(),
'form_id' => $helper->getFormId(),
'checktime_id' => $helper->getCheckTimeId(),
'content_id' => $helper->getContentId(),
'data' => json_encode($newData),
'source' => 'HISTORY',
'create_time' => $item['create_time'],
'create_user_id' => $item['user_id']
];
// var_dump($contentLog);
Laminas::$serviceManager->patientFormContentUpdatedLog->isSetInfo(false)->save($contentLog);
}
die('处理完了');
$forms = ArrayHelper::getColumn(Laminas::$serviceManager->itemForm->fetchAll([
'where' => [
'type' => Form::FORM_TYPE_SINGLE,
'is_del' => 0
]
]), 'id');
$arr = [];
$query = Laminas::$serviceManager->patientFormContent->fetchAll([
'where' => ['form_id' => $forms]
]);
foreach ($query as $item) {
$arr[$item['patient_id']][$item['form_id']][] = $item;
}
foreach ($arr as $patientId => $arrItem) {
foreach ($arrItem as $formId => $v) {
if (count($v) > 1) {
$lock = $unlock = [];
$lockOperate = Laminas::$serviceManager->patientFormContentUpdatedLog->fetchOne([
'where' => ['event' => 'LOCK_SHARE_FORM_CONTENT', 'form_id' => $formId, 'checktime_id' => 2, 'patient_id' => $patientId]
]);
foreach ($v as $row) {
if (abs($lockOperate['create_time'] - $row['create_time']) < 1000) {
$lock[] = $row['id'];
} else {
$unlock[] = $row['id'];
}
}
var_dump('lockEvent', $lockOperate['create_time']);
var_dump('锁定', $lock);
var_dump('未锁定', $unlock);
Laminas::$serviceManager->patientFormContent->update([
'is_del' => 1
], ['id' => $unlock]);
Laminas::$serviceManager->patientFormContent->update([
'is_del' => 0,
'is_lock' => 1
], ['id' => $lock]);
}
}
}
die;
// $this->LocalService()->itemFormFieldRadio->update([
// 'relation_information' => '301136'
// ], ['field_id' => 277216]);
// relation_classification: 2
//relation_type: 1
//relation_information: 277219
// $this->LocalService()->itemFormFieldRadio->update([
// 'relation_information' => '277219',
// 'relation_type' => '1',
// 'relation_classification' => '2',
// ], ['field_id' => 277217,]);
$forms = $this->LocalService()->itemForm->fetchAll([
'where' => [
'id' => 4,
'is_del' => 0
]
]);
foreach ($forms as $formId) {
$this->LocalService()->itemFormFieldRadio->update([
'is_check' => 0,
], ['form_id' => $formId['id']]);
$v = $this->LocalService()->itemForm->buildFieldVersion($formId['id']);
$this->LocalService()->itemFormVersion->update(['field' => $v], ['form_id' => $formId['id']]);
}
die;
die;
$query = Laminas::$serviceManager->patientFormContent->fetchAll([
'where' => [
// new Between('id', $id, $id + 200)
// 'id' => 239432
// 'itemsig_id' => 377
]
]);
foreach ($query as $item) {
$generateFields = Laminas::$serviceManager->itemForm->getPreviewConfig($item['form_id'], true)['generateFields'];
$score = false;
$scoreStr = [];
$data = StringHelper::jsonDecode($item['data']);
$versionData = Laminas::$serviceManager->itemFormVersion->getField(['form_id' => $item['form_id']], true);
foreach ($data as $k => &$datum) {
$field = stripos($k, '-') !== false ? explode('-', $k)[0] : $k;
// 有分的先不处理
// if (isset($data['score'])) {
// continue;
// }
if (isset($versionData[$field]) && $versionData[$field]['type'] == 10) {
$child = ArrayHelper::index($versionData[$field]['children'] ?? [], 'value');
if ($child && is_array($child) && isset($child[$datum]) && $child[$datum]['is_score'] == 1 && in_array($k, $generateFields)) {
if ($score === false) {
$score = 0;
}
$score += $child[$datum]['score'];
$scoreStr[] = ['prop' => strval($k), 'score' => intval($child[$datum]['score']), 'is_score' => true];
}
}
}
if ($score !== false) {
$data['score'] = strval($score);
$data['scoreStr'] = $scoreStr;
echo "contentId {$item['id']} 分值为 {$score} 分 patient: {$data['patient_id']} checktime_id: {$data['checktime_id']} formId: {$data['form_id']}" . PHP_EOL;
Laminas::$serviceManager->patientFormContent->isSetInfo(false)->update(['data' => json_encode($data), 'update_time' => $item['update_time']], ['id' => $item['id']]);
}
}
// die;
// var_dump(memory_get_usage());
// }
die;
Laminas::$serviceManager->redisExtend->setDatabase(13)->getRedisInstance()->set('1234', 1234);
Laminas::$serviceManager->redisExtend->setDatabase(13)->getRedisInstance()->set('@@@@', 1234);
Laminas::$serviceManager->redisExtend->getRedisInstance()->set('AAA', 1234);
Laminas::$serviceManager->redisExtend->getRedisInstance()->set('BBBB', 1234);
die;
$a = new PatientFormModel();
$a->setPostValues([
'form_id' => 90694,
'patient_id' => 9010,
]);
$val = $a->view();
var_dump($val);die;
// 305557,305556, 305555, 305563, 305558, 305559, 305560, 305561, 305562, 305541, 305542, 305543
Laminas::$serviceManager->itemFormField->update(['is_del' => 1], ['id' => [305557,305556, 305555]]);
$v = $this->LocalService()->itemForm->buildFieldVersion(90699);
$this->LocalService()->itemFormVersion->update(['field' => $v], ['form_id' => 90699]);
die;
// $ocrData = '{"85209": [{"263962": {"id": "263962", "name": "CASS位置", "value": "-7", "ocr_name": "CASS位置", "var_name": "CASS"}, "263970": {"id": "263970", "name": "描述", "value": "B1型病变", "ocr_name": "描述", "var_name": "OTH"}, "263972": {"id": "263972", "name": "狭窄程度", "value": "75%", "ocr_name": "狭窄程度", "var_name": "XZ"}, "263973": {"id": "263973", "name": "病变形态", "value": "节段、偏心、累及分支", "ocr_name": "病变形态", "var_name": "PAMO"}, "263975": {"id": "263975", "name": "病变部位", "value": "1前降支中段", "ocr_name": "介入部位名称", "var_name": "NAME"}}], "85210": [{"263977": {"id": "263977", "name": "支架名称", "value": "药物洗脱冠脉支架系统RSINT", "ocr_name": "支架装置名称", "var_name": "ZNAM"}, "263978": {"id": "263978", "name": "直径", "value": "3.0", "ocr_name": "直径", "var_name": "DIAM"}, "263979": {"id": "263979", "name": "长度", "value": "30", "ocr_name": "长度", "var_name": "LEN"}, "263980": {"id": "263980", "name": "置入部位", "value": "LAD病变处", "ocr_name": "置入/扩张部位", "var_name": "POS"}}], "85211": [{"263982": {"id": "263982", "name": "球囊名称", "value": "一次性使用血管内球囊扩张导管WOTE", "ocr_name": "球囊装置名称", "var_name": "QNAM"}, "263983": {"id": "263983", "name": "直径", "value": "2.0", "ocr_name": "直径", "var_name": "QDIA"}, "263984": {"id": "263984", "name": "长度", "value": "20", "ocr_name": "长度", "var_name": "QLEN"}, "263985": {"id": "263985", "name": "扩张部位", "value": "LAD病变处", "ocr_name": "置入/扩张部位", "var_name": "EXS"}}, {"263982": {"id": "263982", "name": "球囊名称", "value": "冠脉球囊导管Quantum", "ocr_name": "球囊装置名称", "var_name": "QNAM"}, "263983": {"id": "263983", "name": "直径", "value": "3.25", "ocr_name": "直径", "var_name": "QDIA"}, "263984": {"id": "263984", "name": "长度", "value": "15", "ocr_name": "长度", "var_name": "QLEN"}, "263985": {"id": "263985", "name": "扩张部位", "value": "LAD支架内", "ocr_name": "置入/扩张部位", "var_name": "EXS"}}, {"263982": {"id": "263982", "name": "球囊名称", "value": "冠脉球囊导管Quantum", "ocr_name": "球囊装置名称", "var_name": "QNAM"}, "263983": {"id": "263983", "name": "直径", "value": "3.75", "ocr_name": "直径", "var_name": "QDIA"}, "263984": {"id": "263984", "name": "长度", "value": "12", "ocr_name": "长度", "var_name": "QLEN"}, "263985": {"id": "263985", "name": "扩张部位", "value": "LAD支架内", "ocr_name": "置入/扩张部位", "var_name": "EXS"}}]}';
// $params = [
// 'patient_id' => 9316,
// 'form_id' => 90689,
// 'checktime_id' => 202402,
// ];
$model = new \Application\Form\item\patient\NormalOCRFormModel();
$model->importMultiRow(82016);
die;
$handleCount = 200;
$maxCount = Laminas::$serviceManager->patientFormContentUpdatedLog->fetchOne([
'order' => 'id DESC',
])['id'];
for ($id = 0; $id < $maxCount; $id = $id + $handleCount) {
$query = Laminas::$serviceManager->patientFormContentUpdatedLog->fetchAll([
'where' => [
new Between('id', $id + 1, $id + $handleCount),
]
]);
echo "已处理 $id , 共计 $maxCount" . PHP_EOL;
$container = [];
foreach ($query as $item) {
if (!isset($container[$item['patient_id']])) {
$container[$item['patient_id']] = Laminas::$serviceManager->patient->fetchOne([
'where' => [
'id' => $item['patient_id'],
'is_del' => 0
]
])['itemsig_id'] ?? false;
if ($container[$item['patient_id']] === false) {
echo '受试者' . $item['patient_id'] . '有问题??' . PHP_EOL;
continue;
}
}
Laminas::$serviceManager->patientFormContentUpdatedLog->isSetInfo(false)->update([
'sign_id' => $container[$item['patient_id']]
], ['id' => $item['id']]);
}
}
die('处理完了');
return 0;
die;
Laminas::$serviceManager->itemFormField->update(['type' => FormField::FORM_FIELD_TYPE_DATE_UK], ['id' => 301227]);
$v = $this->LocalService()->itemForm->buildFieldVersion(90373);
$this->LocalService()->itemFormVersion->update(['field' => $v], ['form_id' => 90373]);
die;
$query = Laminas::$serviceManager->itemPatientAeContent->fetchAll([
'where' => [
'ae_type' => 6,
'is_del' => 0
]
]);
foreach ($query as $v) {
$has = Laminas::$serviceManager->itemCsaeRelation->fetchAll([
'where' => [
'csae_id' => $v['csae_id'],
'new_ae_list_id' => 0,
'content_id' => $v['id'],
'patient_id' => $v['patient_id'],
'branch' => $v['branch']
]
]);
if (!$has) {
var_dump($v);
}
}
var_dump('ok');die;
$handleCount = 200;
$maxCount = Laminas::$serviceManager->adminLog->fetchOne([
'order' => 'id DESC',
])['id'];
for ($id = 0; $id < $maxCount; $id = $id + $handleCount) {
$query = Laminas::$serviceManager->adminLog->fetchAll([
'where' => [
new Between('id', $id + 1, $id + $handleCount),
'log_url' => '/patient/form/create',
// 'id' => 81566
]
]);
echo "已处理 $id , 共计 $maxCount" . PHP_EOL;
foreach ($query as $item) {
$newData = $item['new_data'] ? unserialize($item['new_data']) : '';
$oldData = $item['old_data'] ? unserialize($item['old_data']) : '';
$note = $item['change_data'];
// if (!$oldData && stripos(explode(':', $note)[0], '新增') !== false) {
//// echo '新增';
// } elseif ($newData && $oldData && stripos(explode(':', $note)[0], '修改') !== false) {
//// echo '编辑';
// }
$helper = SDMHelper::app()->setAttributes(['content_id' => $item['event_id']])->formContent;
if (Laminas::$serviceManager->patientFormContentUpdatedLog->fetchOne([
'where' => ['create_time' => $item['create_time'], 'content_id' => $item['event_id']]
])) {
echo "跳过 content_id {$item['event_id']}" . PHP_EOL;
continue;
}
$contentLog = [
'item_id' => $helper->getItemId(),
'patient_id' => $helper->getPatientId(),
'form_id' => $helper->getFormId(),
'checktime_id' => $helper->getCheckTimeId(),
'content_id' => $helper->getContentId(),
'data' => json_encode($newData),
'source' => 'HISTORY',
'create_time' => $item['create_time'],
'create_user_id' => $item['user_id']
];
// var_dump($contentLog);
Laminas::$serviceManager->patientFormContentUpdatedLog->isSetInfo(false)->save($contentLog);
}
}
die('处理完了');
return 0;
}
private function handleChild($child, $fieldId = null)
{
echo 'FIELD_ID -> ' . $fieldId . PHP_EOL;
// if (isset($child['children'])) {
// $this->handleChild($child['children']);
// }
$itemData = [];
$formType = 'TEXT';
foreach ($child['relation'] ?? $child['children'] as $k => $item) {
if ($item['info_from'] == 0) {
$k = $item['info_id'];
if (!$this->migrateData['batchContents']['content'][$k]) {
if ($item['p']) {
$k = "{$item['info_id']}-{$item['p']}";
if (!$this->migrateData['batchContents']['content'][$k]) {
throw new \Exception("not found info id!!!!{$item['info_id']}-{$item['p']}");
}
}
}
$itemData['parent'] = $item['parent_id'];
$itemData = $this->migrateData['batchContents']['content'][$k];
} elseif ($item['info_from'] == 1) {
$formType = 'RADIO';
if (!$this->migrateData['batchContents']['options'][$item['info_id']]) {
throw new \Exception("not found info id{$item['info_id']}");
}
$itemData = $this->migrateData['batchContents']['options'][$item['info_id']];
$itemData['parent'] = $item['parent_id'];
} elseif ($item['info_from'] == 2) {
if (!$this->migrateData['batchContents']['content']['info_id']) {
throw new \Exception("not found info id###");
}
$itemData = $this->migrateData['content']['info_id'];
}
$itemData['form_id'] = $this->formId;
$itemData['name'] = $itemData['tips'];
unset($itemData['tips']);
if (!$itemData['name']) {
if ($item['info_from'] != 3) {
$itemData['name'] = $itemData['form_option'] ?? '??????????';
} else {
$itemData['name'] = '5555555';
}
}
$itemData['type'] = self::CONTENT_MAP[$itemData['content_type']] ?? 0;
$itemData['parent'] = $this->branchMap[$itemData['parent']] ?? 0;
$itemData['form_type'] = $formType;
$itemData['value'] = $k;
$itemData['relation_classification'] = 2;
$itemData['relation_type'] = 1;
$itemData['relation_information'] = $itemData['parent'];
$itemData['is_list'] = 0;
$itemData['is_anchor'] = $itemData['content_type'] == 13 ? 1 : 0;
$itemData['is_booked_time'] = 0;
$itemData['item_id'] = 2;
$itemData['origin_form_id'] = $itemData['form_id'];
$v = new ValidatorApplication($itemData);
$v->attach(
[['form_id', 'item_id'], 'required'],
[['form_type'], 'default', 'value' => FieldForm::FORM_CONFIG_TEXT],
[['is_list', 'is_booked_time'], 'default', 'value' => 0]
);
$model = new ItemFieldForm($v);
$fieldId = $model->createField();
if ($itemData['type'] != 0) {
if (isset($itemData['parent_id']) && isset($this->branchMap[$itemData['parent_id']])) {
$this->mainId = $this->branchMap[$itemData['parent_id']];
} else {
$this->mainId = $fieldId;
}
$this->branchMap[$item['info_id']] = $fieldId;
}
if (isset($item['children'])) {
if ($item['info_from'] == 3) {
$item['p'] = $item['info_id'];
}
$this->handleChild($item, $fieldId);
}
}
}
}

View File

@ -0,0 +1,59 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/9 12:25
* @Description
*
*/
namespace Application\Command;
use Application\Service\Extension\Helper\ArrayHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use function Co\run;
class UnitTestCommand extends BasicCommand
{
/**
* 脚本描述.
* @var string
*/
protected static $defaultDescription = '运行单元测试实例。';
protected function configure()
{
$this
->addArgument(
'files',
InputArgument::IS_ARRAY
)
;
}
public function execute(InputInterface $input, OutputInterface $output)
{
$updateFiles = $input->getArguments();
run(function() use ($updateFiles) {
// $ret = \Swoole\Coroutine\System::exec("/usr/bin/php vendor/bin/phpunit module/Application/test/model --coverage-html report");
$unitTestFiles = [
'phpunit.xml.dist',
'module/Application/test/model/BaseTestUnit.php',
'module/Application/test/model/DictionaryFormTest.php',
'module/Application/test/model/HelperTest.php',
'module/Application/test/model/PatientFormTest.php',
'module/Application/test/model/PatientModelTest.php',
];
$file = implode(' ', ArrayHelper::merge($unitTestFiles, $updateFiles['files']));
$ret = \Swoole\Coroutine\System::exec("git fetch && git checkout origin/develop {$file} && /usr/bin/php vendor/bin/phpunit");
echo $ret['output'];
});
return 0;
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace Application\Common;
class BehaviorsEnum
{
/** @var string 通过进度管理删除表单数据 */
const BEHAVIOR_PATIENT_FORM_DELETE_FROM_PROGRESS_MANAGE = 'BEHAVIOR_PATIENT_FORM_DELETE_FROM_PROGRESS_MANAGE';
const BEHAVIOR_MESSAGE = [
'PROJECT_AE_RESULT_DISCARD' => '断开关联关系'
];
}

View File

@ -0,0 +1,893 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/5 20:27
* @Description
*
*/
namespace Application\Common;
use Application\Exception\UserException;
use Application\Service\DB\Dictionary\FormField;
use Laminas\Db\Sql\Predicate\Like;
use Laminas\Stdlib\ArrayUtils;
class Com
{
/**
* Notes:获取两个日期差多少天
* User: lltyy
* DateTime: 2023/8/22 11:14
*
* @param $str //数值
* @param $digit //小数位数
* @return false|float|string
*/
public static function diffDateDay($date1='',$date2='')
{
$diff_days = 0;
if(!empty($date1) && !empty($date2)){
$date1_str = substr($date1,0,4).'-'.substr($date1,4,2).'-'.substr($date1,6,2);
$date2_str = substr($date2,0,4).'-'.substr($date2,4,2).'-'.substr($date2,6,2);
$time1 = strtotime($date1_str);
$time2 = strtotime($date2_str);
$diff_seconds = abs($time1 - $time2);
$diff_days = floor($diff_seconds / (24 * 60 * 60));
}
return $diff_days;
}
/**
* Notes: 去除无用字符串
* User: lltyy
* DateTime: 2023/6/8 15:07
*
* @param string $str
* @param int $type 类型【0 结果 1 时间 2 识别项 3 识别项 4 识别项拆分末尾数字】
* @return string|string[]|null
*/
public function replaceData($str='',$type=0){
if($str != ''){
if($type == 3){
$str = preg_replace("/\\d+/",'', $str);
}
if($type == 0){
$str = str_replace(',','.',$str);
$str = str_replace(' 。','.',$str);
$str = str_replace("'",'',$str);
$str = str_replace('-','',$str);
$str = str_replace('*','',$str);
$str = str_replace(':','',$str);
$str = str_replace('?','',$str);
}
$delete_result_arr = ["","","","","",":","·","/","","","","","","","","","——","","~","!","@","#","$","%","^","&","*","(",")","-","_","+","{","}",";","|",",","","","","[","]","","……"];
$have_result_arr = ["","","","","",":","·","/","","","","","","","","","——","","~","!","@","#","$","%","^","&","*","(",")","-","_","+","=","{","}",";","|",",","<",">","","","","","","[","]","","……"];
if(!in_array($type,[0,4])){
$delete_result_arr[] = '=';
$delete_result_arr[] = '.';
$delete_result_arr[] = "<";
$delete_result_arr[] = ">";
$delete_result_arr[] = "";
$delete_result_arr[] = "";
$delete_result_arr[] = "";
$delete_result_arr[] = "";
$have_result_arr[] = '.';
$have_result_arr[] = '↑';
$have_result_arr[] = '↓';
}
$chinese_regular = '/([\x80-\xff]*)/i';//汉字正则
$big_letter_regular = '/[A-Z]/';//大写字母正则
$small_letter_regular = '/[a-z]/';//小写字母正则
if($type == 4){
$judge_str = '';
if(strpos($str,'↑')){
$judge_str = '↑';
}
if(strpos($str,'↓')){
$judge_str = '↓';
}
$new_rawname_str = str_replace(['↑','↓'],'',$str);//替换字符串中的特殊字符
$split_name_arr = mb_str_split($new_rawname_str);
$end_chinese = '';//最后一个汉字
$all_number = '';//最后一个汉字之后的数字
$last_number = '';
$chinese_regular = '/[\x7f-\xff]+/';//汉字正则
$end_str_type = 0;
if(!empty($split_name_arr)){
foreach($split_name_arr as $split_name){
//判断字符串类型
$str_type = 0;
if(is_numeric($split_name)){//是数字
$str_type = 1;
}else{
if($split_name == '.'){//是数字
$str_type = 1;
}else{
$new_split_name = str_replace($have_result_arr,'',$split_name);//替换字符串中的特殊字符
if($new_split_name == ''){
$str_type = 3;
}else{
$new_split_name = preg_replace($chinese_regular,'',$split_name);//去除字符串中的汉字
$new_split_name = preg_replace($big_letter_regular,'',$new_split_name);//去除字符串中的大写字母
$new_split_name = preg_replace($small_letter_regular,'',$new_split_name);//去除字符串中的小写字母
if($new_split_name == ''){
$str_type = 2;
}
}
}
}
if($end_chinese != ''){
if($str_type == 1){
$all_number .= $split_name;
}elseif($str_type == 2){
$end_chinese = $split_name;
$all_number = '';
}elseif($str_type == 3){
if($end_str_type != 3 || $last_number == ''){
$last_number = $all_number;
}
$end_chinese = $split_name;
$all_number = '';
}
}else{
if($str_type == 2){
$end_chinese = $split_name;
$all_number = '';
}elseif($str_type == 3){
if($end_str_type != 3 || $last_number == ''){
$last_number = $all_number;
}
$end_chinese = $split_name;
$all_number = '';
}
}
$end_str_type = $str_type;
}
}
if($end_str_type == 3){
$all_number = $last_number;
}
if($all_number != ''){
$all_number .= $judge_str;
}
$str = $all_number;
}else{
if(!in_array($str,$have_result_arr)){
$str = str_replace($delete_result_arr,'',$str);//替换字符串中的特殊字符
if($type != 3){
$str = preg_replace($chinese_regular,'',$str);//去除字符串中的汉字
}
$str = preg_replace($big_letter_regular,'',$str);//去除字符串中的大写字母
$str = preg_replace($small_letter_regular,'',$str);//去除字符串中的小写字母
}else{
$str = '';
}
}
}
$str = $str != '' ? $str : '';
if($str != '' && $type == 1){
if(in_array(substr($str,0,2),['21','22','23'])){
$str = '20'.$str;
}
if(in_array(substr($str,0,3),['020','021','022','023'])){
$str = '2'.$str;
}
if(in_array(substr($str,0,5),['22020','22021','22022','22023'])){
$str = substr_replace($str,'2',0,2);
}
if(in_array(substr($str,0,6),['222020','222021','222022','222023'])){
$str = substr_replace($str,'2',0,3);
}
if(in_array(substr($str,0,7),['2222020','2222021','2222022','2222023'])){
$str = substr_replace($str,'2',0,4);
}
}
unset($delete_result_arr);
unset($have_result_arr);
unset($chinese_regular);
unset($big_letter_regular);
unset($small_letter_regular);
return $str;
}
/**
* Notes: 验证日期
* User: lltyy
* DateTime: 2023/6/25 9:31
*
* @param string $annex_date
* @return array
*/
public static function validAnnexDate($annex_date=''){
$code = 200;
$msg = '';
//截取日期前8位数字
$annex_date = self::replaceData($annex_date,2);
$annex_date = !empty($annex_date) ? substr($annex_date,0,8) : '';
//判断报告时间是否符合要求
if(empty($annex_date)){
$code = 60010;
$msg = '采集时间不能为空!';
}else{
$annex_date_year = substr($annex_date,0,4);
$annex_date_month = substr($annex_date,4,2);
$annex_date_day = substr($annex_date,6,2);
$annex_date_str = $annex_date_year.'-'.$annex_date_month.'-'.$annex_date_day;
$date_reg = "/^([0-9]{4})-([0-9]{2})-([0-9]{2})$/";
//匹配日期格式
if (preg_match ($date_reg, $annex_date_str, $parts)) {
//检测是否为日期,checkdate为月日年
if (checkdate($parts[2], $parts[3], $parts[1])) {
$code = 200;
}else{
$code = 60011;
$msg = '采集时间格式不正确【正确格式如20210607】';
}
}else{
$code = 60011;
$msg = '采集时间格式不正确【正确格式如20210607】';
}
if($code == 200){
$nowYear = date('Y');
if(intval($annex_date_year) > $nowYear){
$code = 60011;
$msg = '采集时间所属年份【'.$annex_date_year.'】不能超过当前年份【'.$nowYear.'】!';
}else{
if(intval($annex_date_year) < 2020){
$code = 60012;
$msg = '采集时间所属年份【'.$annex_date_year.'】不在【2020~~'.$nowYear.'】之间!';
}
}
}
}
return ['code'=>$code,'msg'=>$msg,'date'=>$annex_date];
}
/**
* Notes:验证时间
* User: lltyy
* DateTime: 2024/3/27 11:21
*
* @param string $annex_date
* @param int $type 【0 时分 1 小时】
* @return array
*/
public static function validAnnexDatetime($annex_date='',$type = 0){
$code = 200;
$msg = '';
//截取日期前4位数字
$new_annex_date = !empty($annex_date) ? substr($annex_date,0,4) : '';
if($type == 1){
$new_annex_date = !empty($annex_date) ? substr($annex_date,0,2) : '';
}
//判断报告时间是否符合要求
if(empty($annex_date)){
$code = 60010;
$msg = '不能为空!';
}else{
if($type == 1){
$new_annex_date = !empty($annex_date) ? substr($annex_date,0,2) : '';
$time_hour = substr($new_annex_date,0,2);
$time_str = $time_hour;
$time_reg = "/^([01]?[0-9]|2[0-3])$/";
//匹配日期格式
if (preg_match ($time_reg, $time_str)) {
$code = 200;
}else{
$code = 60011;
$msg = '格式不正确【正确格式如09】';
}
}else{
$time_hour = substr($new_annex_date,0,2);
$time_sceond = substr($new_annex_date,2,2);
$time_str = $time_hour.':'.$time_sceond;
$time_reg = "/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/";
//匹配日期格式
if (preg_match ($time_reg, $time_str)) {
$code = 200;
}else{
$code = 60011;
$msg = '格式不正确【正确格式如0909】';
}
}
}
return ['code'=>$code,'msg'=>$msg,'date'=>$new_annex_date];
}
/**
* Notes:Notes:识别结果去除首尾多余的1
* User: lltyy
* DateTime: 2024/2/18 9:06
*
* 1》上下箭头 在前面且结果大于最大值2倍首位是1去掉1后依然大于最大值则首位1直接去掉
* 2》上下箭头 在后面如果尾数为1且结果大于2两倍最大值去掉尾数1后小于最小值则直接去掉尾数1如果去掉尾数1大于最大值则去掉尾数1
*
* @param string $result
* @param string $min
* @param string $max
* @return string|string[]
*/
public static function cutResultOne($result='',$min='',$max='')
{
$new_result = $result;
if($result != '' && is_numeric($result)){
//首位是1
$firstDigit = substr(strval($new_result), 0, 1);
if($firstDigit == 1){
$first_set_judge = self::getResultSetJudge($new_result,$min,$max);
if(in_array($first_set_judge,[4])){
$firstCheckResult = substr_replace($new_result,'',0,1);
$first_check_set_judge = self::getResultSetJudge($firstCheckResult,$min,$max);
if(in_array($first_check_set_judge,[2,4])){
$new_result = $firstCheckResult;
}
}
}
//尾数为1
$endDigit = substr(strval($new_result), -1);
if($endDigit == 1){
$end_set_judge = self::getResultSetJudge($new_result,$min,$max);
if(in_array($end_set_judge,[4])){
$endCheckResult = substr_replace($new_result,'',-1);
$end_check_set_judge = self::getResultSetJudge($endCheckResult,$min,$max);
if(in_array($end_check_set_judge,[1,3,2,4])){
$new_result = $endCheckResult;
}
}
}
}
return $new_result;
}
/**
* Notes:结果判断异常
* User: lltyy
* DateTime: 2024/2/18 9:06
*
* @param string $result
* @param string $set_min
* @param string $set_max
* @return int
* $set_judge
* 0正常
* 1
* 2
* 3超低【低于最小值的二分之一】
* 4超高【高于最大值的2倍】
*/
public static function getResultSetJudge($result='',$set_min='',$set_max=''){
$result = is_null($result) || $result == '' ? '' : trim($result);
$set_min = is_null($set_min) || $set_min == '' ? '' : trim($set_min);
$set_max = is_null($set_max) || $set_max == '' ? '' : trim($set_max);
$set_judge = 0;
if($result != '' && is_numeric($result)){
if($set_min != ''){
if($result < $set_min){
$set_judge = 1;
//判断是否低于最小值2倍
$set_min_two = $set_min/2;
if($result <= $set_min_two){//超低
$set_judge = 3;
}
}else{
if($set_max != ''){
if(strpos($set_max,'<') !== false){
$set_max_number = str_replace('<','',$set_max);
if($result >= $set_max_number){
$set_judge = 2;
//判断是否高于最大值2倍
$set_max_two = $set_max_number*2;
if($result >= $set_max_two){//超高
$set_judge = 4;
}
}
}else{
if($result >= $set_max){
$set_judge = 2;
//判断是否高于最大值2倍
$set_max_two = $set_max*2;
if($result >= $set_max_two){//超高
$set_judge = 4;
}
}
}
}
}
}else{
if($set_max != ''){
if(strpos($set_max,'<') !== false){
$set_max_number = str_replace('<','',$set_max);
if($result >= $set_max_number){
$set_judge = 2;
//判断是否高于最大值2倍
$set_max_two = $set_max_number*2;
if($result >= $set_max_two){//超高
$set_judge = 4;
}
}
}else{
if($result >= $set_max){
$set_judge = 2;
//判断是否高于最大值2倍
$set_max_two = $set_max*2;
if($result >= $set_max_two){//超高
$set_judge = 4;
}
}
}
}
}
}
return $set_judge;
}
/**
* Notes:保留小数位数【多余直接舍弃】
* User: lltyy
* DateTime: 2023/8/22 11:14
*
* @param $str //数值
* @param $digit //小数位数
* @return false|float|string
*/
public static function numberDigit($str,$digit)
{
$new_str = $str;
if(is_numeric($str)) {
$last_digit = $digit+1;
switch ($digit) {
case 0:
$new_str = floor($str);
break;
default:
$new_str = sprintf("%.".$digit."f",substr(sprintf('%.'.$last_digit.'f',$str),0,-1));
break;
}
}
return $new_str;
}
/**
* Notes: 字符串切片
* User: llbjj
* DateTime: 2023/4/26 10:14
*
* @param string $str
* @return array
*/
public static function cutIntoSlices(string $str)
{
$result = [];
if($str != '') {
$strLen = mb_strlen($str);
for ($i = 0; $i < $strLen; $i++) {
$splitStr = $i ? mb_substr($str, $i) : $str;
for($len = $i ? 2 : 1; $len <= mb_strlen($splitStr); $len++) {
$splitArr = mb_str_split($splitStr, $len);
$result = ArrayUtils::merge($result, $splitArr);
}
}
}
return array_unique($result);
}
public function getTree($data, $pid = 0,$type = 0,$level = 2,$field = 'fid'){
$tree = [];
foreach($data as $k => $v){
$v['icon'] = $v['icon'] ?: 'formOcr';
if (isset($v['parent_id'])){
if(($v['parent_id'] == $pid)){
if (!empty($type) && $v['level'] > $level){
continue;
}
$v['children'] = $this->getTree($data, $v['id'],$type,$level);
$tree[] = $v;
unset($data[$k]);
}
}else{
if(($v[$field] == $pid)){
$v['children'] = $this->getTree($data, $v['id'],$type,$level,$field);
$tree[] = $v;
// unset($data[$k]);
}
}
}
return $tree;
}
/**
* 无限分类
* **/
public function getTreed($arr){
$items = array();
foreach($arr as $v){
$items[$v['id']] = $v;
}
$tree = array();
foreach($items as $k => $item){
if(isset($items[$item['pid']])){
$items[$item['pid']]['children'][] = &$items[$k];
}else{
$tree[] = &$items[$k];
}
}
return $tree;
}
/**
* 无限分类
* **/
public function getTreeall($arr,$pid=0,$step=0,$name='',$pidname=''){
global $tree;
foreach($arr as $key=>$val) {
if($val[$pidname] == $pid) {
$flg = str_repeat("&nbsp;&nbsp;&nbsp;",$step);
$val[$name] = $flg.$val[$name];
$tree[] = $val;
$this->getTreeallAction($arr , $val['id'] ,$step+1);
}
}
return $tree;
}
/**
* Notes: 组合sql WHERE条件
*
* @param array $searchArr
* @param array $formFieldData
* @param int $returnType 0/字符串 1、数组
* @return string
*/
public static function CreateSearchWhere(array $searchArr, array $formFieldData, $returnType = 0){
$popData = ['limit', 'page'];
$search_where_data = ['1'];
foreach($searchArr as $field => $searchVal){
if(!empty($formFieldData[$field]) && $searchVal !== ''){
switch($formFieldData[$field]['type']){
case 'Input':
array_push($search_where_data, new Like($field, "%{$searchVal}%"));
break;
default:
$search_where_data[$field] = $searchVal;
}
}
}
return $returnType ? $search_where_data : implode(' and ', $search_where_data);
}
/**
* Notes: 获取每个表单模块的说明数组select的options数组格式
*
* @return array
*/
public static function getSearchFormEventData(){
$result = [];
$eventFormData = include APP_PATH.'/formData/formMap.php';
if(!empty($eventFormData)){
foreach($eventFormData as $eventCode => $eventLabel){
$result[] = ['label' => $eventLabel, 'value' => $eventCode];
}
}
return $result;
}
/**
* @Description: 获取两个不同时间的相差的毫秒数(暂时不支持结束时间小于开始时间)
* @Author: llbjj
* @Date: 2022-07-11 14:17:11
* @param {string} $startDate 开始时间
* @param {string} $endDate 结束时间
* @return int
*/
public static function getDiffMs(string $startDate, string $endDate):int
{
// 开始时间 大于 结束时间,直接返回 0
if($startDate > $endDate) return 0;
$isMoreThan = false;
$oneDayMs = 86400000;
$diffMs = 0;
$start_time = date_create($startDate);
$end_time = date_create($endDate);
$dateDiffObj = date_diff($end_time, $start_time);
$date_params_arr = ['y', 'm', 'd', 'h', 'i', 's'];
foreach($date_params_arr as $date_param){
$diffVal = $dateDiffObj->{$date_param};
if($diffVal){
switch($date_param) {
case 'h': $diffMs += $diffVal * 60 * 60 * 1000; break;
case 'i': $diffMs += $diffVal * 60 * 1000; break;
case 's': $diffMs += $diffVal * 1000; break;
default: $isMoreThan = true;break;
}
}
}
// 如果日期差超出一天,直接获取相差的天数
if($isMoreThan) $diffMs += floor((strtotime($endDate) - strtotime($startDate)) / 86400) * $oneDayMs;
return $diffMs;
}
/**
* @Description: 将内容写入文件中
* @Author: llbjj
* @Date: 2022-07-12 17:17:11
* @param {string} $fileName 开始时间
* @param {string} $filePath 结束时间
* @param {string} $fileContent 文件内容
*/
public static function writeFile(string $fileName, string $filePath, string $fileContent)
{
try{
if($fileContent !== ''){
if(!file_exists($filePath)) {
mkdir($filePath, 0777, true);
}
if(substr($filePath, -1, 1) != '/') $filePath .= '/';
file_put_contents($filePath.$fileName, $fileContent, FILE_APPEND);
}
}catch(\Exception $e){
return false;
}
}
/**
* 执行树型数据生成
* @param array $data 要进行转化的数据
* @param string $children 子节点下标名称默认为children
* @param string $defaultID ID节点下标名称默认为'id'
* @param string $parentID 父节点下标名称默认为pid
* @param string $defaultTitle title节点下标名称默认为title
*/
public static function get_tree_data(array &$data, $children = 'children', $defaultID = 'id', $parentID = 'pid', $defaultTitle = 'title'){
$collection_data = [];
foreach ($data as $item) {
foreach($item as $field_key=>$field_val){
if($field_key == $defaultID){
$collection_data[$item[$defaultID]]['id'] = $field_val;
}else if($field_key == $defaultTitle){
$collection_data[$item[$defaultID]]['title'] = $field_val;
}else if($field_key == $parentID){
$collection_data[$item[$defaultID]][$parentID] = $field_val;
}else{
$collection_data[$item[$defaultID]][$field_key] = $field_val;
}
}
$collection_data[$item[$defaultID]][$children] = [];
}
foreach ($collection_data as $key => $item) {
if(isset($item[$parentID]) and isset($collection_data[$item[$parentID]])){
if (isset($item[$parentID]) and $item[$parentID] != 0 && count($collection_data[$item[$parentID]]) > 1) {
$collection_data[$item[$parentID]][$children][] = &$collection_data[$key];
if (empty($collection_data[$key][$children])) unset($collection_data[$key][$children]);
}
}
}
$tree = [];
foreach($collection_data as $key => &$item) {
if ($item[$parentID] != 0) unset($collection_data[$key]);
if (empty($item[$children])) unset($item[$children]);
if(isset($collection_data[$key]) and $collection_data[$key]){
$tree[] = $collection_data[$key];
}
}
return $tree;
}
/**
* 执行树型数据生成
* @param array $data 要进行转化的数据
* @param string $children 子节点下标名称默认为children
* @param string $defaultID ID节点下标名称默认为'id'
* @param string $parentID 父节点下标名称默认为pid
* @param string $defaultTitle title节点下标名称默认为title
*/
public static function get_treeoption_data(array &$data, $children = 'children', $defaultID = 'value', $parentID = 'pid', $defaultTitle = 'label'){
$collection_data = [];
foreach ($data as $item) {
foreach($item as $field_key=>$field_val){
if($field_key == $defaultID){
$collection_data[$item[$defaultID]][$defaultID] = $field_val;
}else if($field_key == $defaultTitle){
$collection_data[$item[$defaultID]][$defaultTitle] = $field_val;
}else if($field_key == $parentID){
$collection_data[$item[$defaultID]][$parentID] = $field_val;
}else{
$collection_data[$item[$defaultID]][$field_key] = $field_val;
}
}
$collection_data[$item[$defaultID]][$children] = [];
}
foreach ($collection_data as $key => $item) {
if(isset($item[$parentID]) and isset($collection_data[$item[$parentID]])){
if (isset($item[$parentID]) and $item[$parentID] != 0 && count($collection_data[$item[$parentID]]) > 1) {
$collection_data[$item[$parentID]][$children][] = &$collection_data[$key];
//if (empty($collection_data[$key][$children])) unset($collection_data[$key][$children]);
}
}
}
$tree = [];
foreach($collection_data as $key => &$item) {
if ($item[$parentID] != 0) unset($collection_data[$key]);
//if (empty($item[$children])) unset($item[$children]);
if(isset($collection_data[$key]) and $collection_data[$key]){
$tree[] = $collection_data[$key];
}
}
return $tree;
}
/**
* 执行树型数据生成
* @param array $data 要进行转化的数据
* @param string $children 子节点下标名称默认为children
* @param string $defaultID ID节点下标名称默认为'id'
* @param string $parentID 父节点下标名称默认为pid
* @param string $defaultTitle title节点下标名称默认为title
*/
public static function get_newtree_data(array &$data, $children = 'children', $defaultID = 'id', $parentID = 'pid', $defaultTitle = 'title'){
$collection_data = [];
foreach ($data as $item) {
foreach($item as $field_key=>$field_val){
if($field_key == $defaultID){
$collection_data[$item[$defaultID]]['id'] = $field_val;
}else if($field_key == $defaultTitle){
$collection_data[$item[$defaultID]]['title'] = $field_val;
}else if($field_key == $parentID){
$collection_data[$item[$defaultID]][$parentID] = $field_val;
}else{
$collection_data[$item[$defaultID]][$field_key] = $field_val;
}
}
$collection_data[$item[$defaultID]][$children] = [];
}
foreach ($collection_data as $key => $item) {
if(isset($item[$parentID]) and isset($collection_data[$item[$parentID]])){
if (isset($item[$parentID]) and $item[$parentID] != 0 && count($collection_data[$item[$parentID]]) > 1) {
$collection_data[$item[$parentID]][$children][] = &$collection_data[$key];
if (empty($collection_data[$key][$children])) unset($collection_data[$key][$children]);
}
}
}
$tree = [];
foreach($collection_data as $key => &$item) {
if ($item[$parentID] != 0) unset($collection_data[$key]);
if (empty($item[$children])) unset($item[$children]);
if (empty($item[$children])) unset($item['disabled']);
if(isset($collection_data[$key]) and $collection_data[$key]){
$tree[] = $collection_data[$key];
}
}
return $tree;
}
/**
* Notes:转换化验单识别结果
* @param array $ocrResult
*/
public static function changeOcrResult(array &$ocrResult) : array
{
$keyMap = [
'项目名称/编码' => 'item_name',
'项目名称' => 'item_name',
'结果' => 'result',
'单位' => 'unit',
'参考值' => 'reference_range',
'采样时间' => 'collect_date',
'参考范围' => 'reference_range',
'检验结果' => 'result',
'计量单位' => 'unit',
];
$result = [];
// 将结果存放到表中
if(!empty($ocrResult)) {
foreach($ocrResult as &$item) {
$row = [];
foreach($item as $key => &$val) {
if(!isset($keyMap[$key])) continue;
$row[$keyMap[$key]] = $val;
if($key === '参考值') {
$reference_range = str_ireplace(['--', '~'], '-', $val);
$rangeData = explode('-', $reference_range);
$row['reference_range_min'] = $rangeData[0] ?? '';
$row['reference_range_max'] = $rangeData[1] ?? '';
}
}
$result[] = $row;
}
}
return $result;
}
/**
* Notes: 获取图片的大小
* User: llbjj
* DateTime: 2024/5/28 17:02
*
* @param string $file
* @return false|int|mixed
*/
public static function customFilesize(string $file) {
$isHttp = strpos($file, '://');
if($isHttp) {
$header = get_headers($file, 1);
return $header['Content-Length'];
}else return filesize($file);
}
/**
* @note 字符串脱敏
* @param string|null $str
* @return string
*/
public static function maskingPhoneNumber( ?string $str): string
{
$replacement = '****';
$start = 3;
$end = -2;
$length = mb_strlen($str, 'UTF-8');
if($length < 6) {
return $replacement;
}
return mb_substr($str, 0, $start, 'UTF-8') . $replacement . mb_substr($str, $length + $end, $length, 'UTF-8');
}
/**
* @note 验证表单字段类型是否是日期类型
* @return bool
*/
public static function isValidDateField($formFieldType): bool
{
return in_array ($formFieldType, [
FormField::FORM_FIELD_TYPE_DATE_UK, // 日期(UK)
FormField::FORM_FIELD_TYPE_DATE, // 日期(年月日)
FormField::FORM_FIELD_TYPE_DATETIME, // 日期(年月日时分秒)
FormField::FORM_FIELD_TYPE_DATE_SECOND, // 日期(年月日时分)
FormField::FORM_FIELD_TYPE_DATETIME_UK, // 日期(年月日时分UK)
FormField::FORM_FIELD_TYPE_DATETIME_SECOND_UK, // 日期(年月日时分秒UK)
FormField::FORM_FIELD_TYPE_TIME_UK, // 日期(时分UK)
FormField::FORM_FIELD_TYPE_TIME_SECOND_UK, // 日期(时分秒Uk)
]);
}
}

View File

@ -0,0 +1,713 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/6 10:25
* @Description
*
*/
namespace Application\Common;
use Application\Command\Swoole\Client\SwLogClient;
use Application\Command\Swoole\Client\SwTaskClient;
use Application\SdmWork\WorkUser;
use Application\Service\Baidu\Ocr as BaiduOcr;
use Application\Service\DB\Admin\Appletsmenu;
use Application\Service\DB\Admin\Appletsrolemenurelation;
use Application\Service\DB\Admin\Configtable;
use Application\Service\DB\Admin\Log;
use Application\Service\DB\Admin\Menu;
use Application\Service\DB\Admin\Realrole;
use Application\Service\DB\Admin\Realrolesignatoryrelation;
use Application\Service\DB\Admin\Role;
use Application\Service\DB\Admin\Rolemenurelation;
use Application\Service\DB\Admin\Send;
use Application\Service\DB\Admin\User;
use Application\Service\DB\Admin\Userrolerelation;
use Application\Service\DB\Admin\Websitefiling;
use Application\Service\DB\Collect\Annex as CollectAnnex;
use Application\Service\DB\Collect\Category as CollectCategory;
use Application\Service\DB\Collect\Cost as CollectCost;
use Application\Service\DB\Collect\Ct as CollectCt;
use Application\Service\DB\Collect\Custom as CollectCustom;
use Application\Service\DB\Collect\Drug as CollectDrug;
use Application\Service\DB\Collect\Drugcategory as CollectDrugcategory;
use Application\Service\DB\Collect\Ecg as CollectEcg;
use Application\Service\DB\Collect\Hospital as CollectHospital;
use Application\Service\DB\Collect\Inspect as CollectInspect;
use Application\Service\DB\Collect\Itemcost as CollectItemcost;
use Application\Service\DB\Collect\Itemct as CollectItemct;
use Application\Service\DB\Collect\Itemdrug as CollectItemdrug;
use Application\Service\DB\Collect\Itemecg as CollectItemecg;
use Application\Service\DB\Collect\Itemhospital as CollectItemhospital;
use Application\Service\DB\Collect\Itemkeyword as CollectItemkeyword;
use Application\Service\DB\Collect\Itemout as CollectItemout;
use Application\Service\DB\Collect\Itemreport as CollectItemreport;
use Application\Service\DB\Collect\Keyword as CollectKeyword;
use Application\Service\DB\Collect\Keywordcat as CollectKeywordcat;
use Application\Service\DB\Collect\Medicaltake as CollectMedicaltake;
use Application\Service\DB\Collect\Medicalword as CollectMedicalword;
use Application\Service\DB\Collect\Out as CollectOut;
use Application\Service\DB\Collect\Patient as CollectPatient;
use Application\Service\DB\Collect\Patientct as CollectPatientct;
use Application\Service\DB\Collect\Patientecg as CollectPatientecg;
use Application\Service\DB\Collect\Patienthospital as CollectPatienthospital;
use Application\Service\DB\Collect\Patientmedical as CollectPatientmedical;
use Application\Service\DB\Collect\Patientmedicalblack as CollectPatientmedicalblack;
use Application\Service\DB\Collect\Patientmedicaldrug as CollectPatientmedicaldrug;
use Application\Service\DB\Collect\Patientmedicallock as CollectPatientmedicallock;
use Application\Service\DB\Collect\Patientmedicalwhite as CollectPatientmedicalwhite;
use Application\Service\DB\Collect\Patientout as CollectPatientout;
use Application\Service\DB\Collect\Patientraw as CollectPatientraw;
use Application\Service\DB\Collect\Patientrawblack as CollectPatientrawblack;
use Application\Service\DB\Collect\Patientrawlock as CollectPatientrawlock;
use Application\Service\DB\Collect\Patientrawmate as CollectPatientrawmate;
use Application\Service\DB\Collect\Patientreport as CollectPatientreport;
use Application\Service\DB\Collect\Rawword as CollectRawword;
use Application\Service\DB\Collect\Report as CollectReport;
use Application\Service\DB\Collect\Sighospital as CollectSighospital;
use Application\Service\DB\Collect\Sigkeyword as CollectSigkeyword;
use Application\Service\DB\Collect\Sigout as CollectSigout;
use Application\Service\DB\Collect\Table as CollectTable;
use Application\Service\DB\Collect\Text as CollectText;
use Application\Service\DB\Dictionary\Checkcategory;
use Application\Service\DB\Dictionary\Checkname;
use Application\Service\DB\Dictionary\Checknameattr;
use Application\Service\DB\Dictionary\Checknameweight;
use Application\Service\DB\Dictionary\Csset;
use Application\Service\DB\Dictionary\Detectblackword as DictionaryDetectblackword;
use Application\Service\DB\Dictionary\Detectkeyword as DictionaryDetectkeyword;
use Application\Service\DB\Dictionary\Detectname as DictionaryDetectname;
use Application\Service\DB\Dictionary\Document;
use Application\Service\DB\Dictionary\Drug as DictionaryDrug;
use Application\Service\DB\Dictionary\Drugcategory as DictionaryDrugcategory;
use Application\Service\DB\Dictionary\Region as DictionaryRegion;
use Application\Service\DB\Dictionary\Form;
use Application\Service\DB\Dictionary\FormField;
use Application\Service\DB\Dictionary\FormGroup;
use Application\Service\DB\Dictionary\FormRelation;
use Application\Service\DB\Dictionary\FormVersion;
use Application\Service\DB\Dictionary\Genercsetinfo;
use Application\Service\DB\Dictionary\Genercsetinfotype;
use Application\Service\DB\Dictionary\ItemForm;
use Application\Service\DB\Dictionary\ItemFormField;
use Application\Service\DB\Dictionary\ItemFormFieldRadio;
use Application\Service\DB\Dictionary\ItemFormFieldText;
use Application\Service\DB\Dictionary\ItemFormGroup;
use Application\Service\DB\Dictionary\Itemjob;
use Application\Service\DB\Dictionary\Medicaltake as DictionaryMedicaltake;
use Application\Service\DB\Dictionary\Medicalword as DictionaryMedicalword;
use Application\Service\DB\Dictionary\Patientattr;
use Application\Service\DB\Dictionary\Patientattrselect;
use Application\Service\DB\Dictionary\Questionanswer;
use Application\Service\DB\Dictionary\Questionconfig;
use Application\Service\DB\Dictionary\Unblinding;
use Application\Service\DB\Dictionary\Leverform;
use Application\Service\DB\Dictionary\Levervalue;
use Application\Service\DB\Export\Sas as ExportSas;
use Application\Service\DB\Item\Allowpatientwrite;
use Application\Service\DB\Item\Answer;
use Application\Service\DB\Item\Appletsdata;
use Application\Service\DB\Item\Blindmethodlog;
use Application\Service\DB\Item\Blockgroup;
use Application\Service\DB\Item\Checktime;
use Application\Service\DB\Item\Confirm;
use Application\Service\DB\Item\Downpicture;
use Application\Service\DB\Item\Eventwatchdog;
use Application\Service\DB\Item\Export;
use Application\Service\DB\Item\Exportpdf;
use Application\Service\DB\Item\File;
use Application\Service\DB\Item\Formmodel;
use Application\Service\DB\Item\Formpatientsign;
use Application\Service\DB\Item\Imgtxtdiscern;
use Application\Service\DB\Item\Info;
use Application\Service\DB\Item\Informedconsent;
use Application\Service\DB\Item\Informedconsentsign;
use Application\Service\DB\Item\ItemDrugbatch as ItemDrugbatch;
use Application\Service\DB\Item\ItemFormVersion;
use Application\Service\DB\Item\ItemInfosign;
use Application\Service\DB\Item\ItemLogicErrorReportBlack;
use Application\Service\DB\Item\ItemPatientdrugbatch as ItemPatientdrugbatch;
use Application\Service\DB\Item\ItemPatientdrugset as ItemPatientdrugset;
use Application\Service\DB\Item\ItemRemarks;
use Application\Service\DB\Item\ItemResultidentify as ItemResultidentify;
use Application\Service\DB\Item\ItemSigdrugbatch as ItemSigdrugbatch;
use Application\Service\DB\Item\ItemSigdrugset as ItemSigdrugset;
use Application\Service\DB\Item\Jobstaff;
use Application\Service\DB\Item\Lock;
use Application\Service\DB\Item\Logtype;
use Application\Service\DB\Item\Medication;
use Application\Service\DB\Item\Patient;
use Application\Service\DB\Item\PatientAeContent;
use Application\Service\DB\Item\Patientattrs;
use Application\Service\DB\Item\PatientCard;
use Application\Service\DB\Item\Patientchecktime;
use Application\Service\DB\Item\PatientChecktimeList;
use Application\Service\DB\Item\PatientForm;
use Application\Service\DB\Item\PatientFormContent;
use Application\Service\DB\Item\PatientFormContentCm;
use Application\Service\DB\Item\PatientFormContentDelete;
use Application\Service\DB\Item\PatientFormContentImg;
use Application\Service\DB\Item\Patientformimgcontent as ItemPatientformimgcontent;
use Application\Service\DB\Item\PatientFormLogicError;
use Application\Service\DB\Item\PatientFormLogicErrorLog;
use Application\Service\DB\Item\PatientFormLogicErrorPointer;
use Application\Service\DB\Item\PatientFormLogicErrorQuery;
use Application\Service\DB\Item\PatientFormUnlock;
use Application\Service\DB\Item\PatientWorkCount;
use Application\Service\DB\Item\Question;
use Application\Service\DB\Item\Randblock;
use Application\Service\DB\Item\Randgroup;
use Application\Service\DB\Item\Randnumber;
use Application\Service\DB\Item\Random;
use Application\Service\DB\Item\Randomdetails;
use Application\Service\DB\Item\Reply;
use Application\Service\DB\Item\Researchstage;
use Application\Service\DB\Item\Rolemodulerelation;
use Application\Service\DB\Item\Sign;
use Application\Service\DB\Item\Signatory as itemSignatory;
use Application\Service\DB\Item\SignatoryCollecttypeocr;
use Application\Service\DB\Item\Signatorypatient;
use Application\Service\DB\Item\Urgentunblind;
use Application\Service\DB\Item\Vicecopy;
use Application\Service\DB\Log\LogLogin;
use Application\Service\DB\Medical\Lock as MedicalLock;
use Application\Service\DB\Medical\Mateblack as MedicalMateblack;
use Application\Service\DB\Medical\Matedrug as MedicalMatedrug;
use Application\Service\DB\Medical\Matewhite as MedicalMatewhite;
use Application\Service\DB\Medical\Ocrdata as MedicalOcrdata;
use Application\Service\DB\Ocr\Annextype as OcrAnnextype;
use Application\Service\DB\Ocr\Caseremark as OcrCaseremark;
use Application\Service\DB\Ocr\Changetype as OcrChangetype;
use Application\Service\DB\Ocr\Ct as OcrCt;
use Application\Service\DB\Ocr\Ctcase as OcrCtcase;
use Application\Service\DB\Ocr\Ctreplace as OcrCtreplace;
use Application\Service\DB\Ocr\Deletename as OcrDeletename;
use Application\Service\DB\Ocr\Drug as OcrDrug;
use Application\Service\DB\Ocr\Drugcategory as OcrDrugcategory;
use Application\Service\DB\Ocr\Keyword as OcrKeyword;
use Application\Service\DB\Ocr\Loseannex as OcrLoseannex;
use Application\Service\DB\Ocr\Mateblack as OcrMateblack;
use Application\Service\DB\Ocr\Matedata as OcrMatedata;
use Application\Service\DB\Ocr\Matedrug as OcrMatedrug;
use Application\Service\DB\Ocr\Matewhite as OcrMatewhite;
use Application\Service\DB\Ocr\Medical as OcrMedical;
use Application\Service\DB\Ocr\Medicallock as OcrMedicallock;
use Application\Service\DB\Ocr\Medicalword as OcrMedicalword;
use Application\Service\DB\Ocr\Ocrannex as OcrOcrannex;
use Application\Service\DB\Ocr\Ocrannexnew as OcrOcrannexnew;
use Application\Service\DB\Ocr\OcrMatesearch as OcrMatesearch;
use Application\Service\DB\Ocr\Rawblack as OcrRawblack;
use Application\Service\DB\Ocr\Rawdata as OcrRawdata;
use Application\Service\DB\Ocr\Rawlock as OcrRawlock;
use Application\Service\DB\Ocr\Rawlockunique as OcrRawlockunique;
use Application\Service\DB\Ocr\Rawword as OcrRawword;
use Application\Service\DB\Ocr\Replace as OcrReplace;
use Application\Service\DB\Ocr\Sigkeyword as OcrSigkeyword;
use Application\Service\DB\Ocr\Sigpatient as OcrSigpatient;
use Application\Service\DB\Ocr\Specialmedical as OcrSpecialmedical;
use Application\Service\DB\Ocr\Take as OcrTake;
use Application\Service\DB\Odm\OdmSyncRecord;
use Application\Service\DB\Pay\Recharge;
use Application\Service\DB\Project\Backupschange;
use Application\Service\DB\Project\Changesendlog;
use Application\Service\DB\Project\Csae;
use Application\Service\DB\Project\Doctoridea;
use Application\Service\DB\Project\Identificationexport;
use Application\Service\DB\Project\Identificationresult;
use Application\Service\DB\Project\Identificationresultchange;
use Application\Service\DB\Project\Identificationresultdestroy;
use Application\Service\DB\Project\Patientworkannex;
use Application\Service\DB\Project\Setocrfield;
use Application\Service\DB\Signatory\Department;
use Application\Service\DB\Signatory\Info as signatoryInfo;
use Application\Service\DB\Signatory\User as signatoryUser;
use Application\Service\DB\Temple\checklist;
use Application\Service\DB\Tmp\Annex as TmpAnnex;
use Application\Service\DB\Tmp\Ctreplace as TmpCtreplace;
use Application\Service\DB\Tmp\Custom as TmpCustom;
use Application\Service\DB\Tmp\Deletename as TmpDeletename;
use Application\Service\DB\Tmp\Doctoradviceannex as TmpDoctoradviceannex;
use Application\Service\DB\Tmp\Doctoradviceformal as TmpDoctoradviceformal;
use Application\Service\DB\Tmp\Doctoradvicelock as TmpDoctoradvicelock;
use Application\Service\DB\Tmp\Doctoradvicemateblack as TmpDoctoradvicemateblack;
use Application\Service\DB\Tmp\Doctoradvicematedrug as TmpDoctoradvicematedrug;
use Application\Service\DB\Tmp\Doctoradvicematewhite as TmpDoctoradvicematewhite;
use Application\Service\DB\Tmp\Doctoradviceoriginal as TmpDoctoradviceoriginal;
use Application\Service\DB\Tmp\Doctoradvicepatient as TmpDoctoradvicepatient;
use Application\Service\DB\Tmp\Doctoradvicereplace as TmpDoctoradvicereplace;
use Application\Service\DB\Tmp\Doctoradvicetable as TmpDoctoradvicetable;
use Application\Service\DB\Tmp\Drug as TmpDrug;
use Application\Service\DB\Tmp\Drugcategory as TmpDrugcategory;
use Application\Service\DB\Tmp\Hospital as TmpHospital;
use Application\Service\DB\Tmp\Inspect as TmpInspect;
use Application\Service\DB\Tmp\Intervene as TmpIntervene;
use Application\Service\DB\Tmp\Intervene0 as TmpIntervene0;
use Application\Service\DB\Tmp\Intervene1 as TmpIntervene1;
use Application\Service\DB\Tmp\Intervene2 as TmpIntervene2;
use Application\Service\DB\Tmp\Keyword as TmpKeyword;
use Application\Service\DB\Tmp\Medical as TmpMedical;
use Application\Service\DB\Tmp\Medicalblack as TmpMedicalblack;
use Application\Service\DB\Tmp\Medicaldrug as TmpMedicaldrug;
use Application\Service\DB\Tmp\Medicallock as TmpMedicallock;
use Application\Service\DB\Tmp\Medicaltake as TmpMedicaltake;
use Application\Service\DB\Tmp\Medicalwhite as TmpMedicalwhite;
use Application\Service\DB\Tmp\Medicalword as TmpMedicalword;
use Application\Service\DB\Tmp\Outmedical as TmpOutmedical;
use Application\Service\DB\Tmp\Patient as TmpPatient;
use Application\Service\DB\Tmp\Patientct as TmpPatientct;
use Application\Service\DB\Tmp\Patienthospital as TmpPatienthospital;
use Application\Service\DB\Tmp\Rawblack as TmpRawblack;
use Application\Service\DB\Tmp\Rawdata as TmpRawdata;
use Application\Service\DB\Tmp\Rawlock as TmpRawlock;
use Application\Service\DB\Tmp\Rawmate as TmpRawmate;
use Application\Service\DB\Tmp\Rawword as TmpRawword;
use Application\Service\DB\Tmp\Replace as TmpReplace;
use Application\Service\DB\Tmp\Report as TmpReport;
use Application\Service\DB\Tmp\Sigkeyword as TmpSigkeyword;
use Application\Service\DB\Tmp\Table as TmpTable;
use Application\Service\DB\Tmp\Text as TmpText;
use Application\Service\DB\Item\ItemMedicaltake;
use Application\Service\Extension\Formatter\Formatter;
use Application\Service\Extension\Helper\SDMHelper;
use Application\Service\Extension\Identity\Identity;
use Application\Service\Extension\Sms\SmsApplication;
use Application\Service\Extension\Uploader\ImageUploader;
use Application\Service\Extension\Wechat\Wechat;
use Application\Service\Extension\Wechat\WechatWork;
use Application\Service\HttpSv;
use Application\Service\Logic\form\CheckFormLogic;
use Application\Service\Login\LoginClient;
use Application\Service\Logs;
use Application\Service\OA\OaClient;
use Application\Service\Project\OcrCasePatientSpecialdetail as ItemOcrCasePatientSpecialdetail;
use Application\Service\Project\OcrCasePatientSpecialdetailNew as ItemOcrCasePatientSpecialdetailNew;
use Application\Service\Project\OcrCsaePatientDetail as ItemOcrCsaePatientDetail;
use Application\Service\Project\OcrCsaePatientDetailNew as ItemOcrCsaePatientDetailNew;
use Application\Service\Redis\RedisExtend;
use Application\Service\ToolSys\SyncOcrAnnex;
use Application\Service\ToolSys\ToolSys;
use Laminas\Http\Request;
use Psr\Container\ContainerInterface;
use Application\Service\DB\Doctoradvice\DoctoradviceOriginal as DoctoradviceOriginal;
use Application\Service\DB\Item\Patientinfo as ItemPatientinfo;
use Application\Service\DB\Item\Signaturebatch AS ItemSignaturebatch;
use Application\Service\DB\Item\Signaturedetail AS ItemSignaturedetail;
use Application\Service\DB\Item\Detectpatient AS ItemDetectpatient;
use Application\Service\DB\Dictionary\Ocrreplace AS DictionaryOcrreplace;
use Application\Service\DB\Item\Cissclass AS ItemCissclass;
use Application\Service\DB\Item\Cissoption AS ItemCissoption;
use Application\Service\DB\Item\Patientciss AS ItemPatientciss;
use Application\Service\DB\Dictionary\Fixednametype;
use Application\Service\DB\Dictionary\Fixedname;
use Application\Service\DB\Project\Msgset AS ProjectMsgset;
use Application\Service\DB\Project\Msginfo AS ProjectMsginfo;
use Application\Service\DB\Project\Msgsend AS ProjectMsgsend;
use Application\Service\DB\Item\Planviolate;
use Application\Service\DB\Admin\Weblink;
use Application\Service\DB\Admin\Workbatch AS AdminWorkbatch;
use Application\Service\DB\Admin\Workinfo AS AdminWorkinfo;
use Application\Service\DB\Dictionary\Eventset as DictionaryEventset;
use Application\Service\DB\Dictionary\Eventsttr as DictionaryEventattr;
use Application\Service\DB\Admin\Medicallock AS AdminMedicallock;
use Application\Service\DB\Item\Patientevent AS ItemPatientevent;
use Application\Service\DB\Item\Patienteventannex AS ItemPatienteventannex;
use Application\Service\DB\Item\Patienteventset AS ItemPatienteventset;
use Application\Service\DB\Project\Patientwork AS ProjectPatientwork;
use Application\Service\DB\Item\Randomsecondary AS ItemRandomsecondary;
use Application\Service\DB\Project\Medicalquestion AS ProjectMedicalquestion;
use Application\Service\DB\Project\Medicalquestioninfo AS ProjectMedicalquestioninfo;
use Application\Service\DB\Project\Medicalconfirm AS ProjectMedicalconfirm;
use Application\Service\DB\Project\Medicalconfirminfo AS ProjectMedicalconfirminfo;
use Application\Service\DB\Project\Medicalset AS ProjectMedicalset;
use Application\Service\DB\Item\Checkdate AS ItemCheckdate;
use Application\Service\DB\Project\Patientworkbatch AS ProjectPatientworkbatch;
use Application\Service\DB\Project\Patientworkinfo AS ProjectPatientworkinfo;
use Application\Service\DB\Dictionary\Region AS Region;
use Application\Service\DB\Item\PatientFormContentUpdatedLog as PatientFormContentUpdatedLog;
use Application\Service\DB\Project\Exceedswindow;
use Application\Service\DB\Project\Cmdrugset AS ProjectCmdrugset;
use Application\Service\DB\Collect\Patientdrug AS CollectPatientdrug;
use Application\Service\DB\Dictionary\Itemcategory AS DictionaryItemcategory;
use Application\Service\DB\Item\Package AS ItemPackage;
/**
*
* Class Container
* @package Application\Common
*
* ----------------------- ↓↓↓组件↓↓↓ ---------------------------
* @property Request $request
* @property RedisExtend $redisExtend redis组件
* @property ImageUploader $imageUploader 文件上传组件
* @property Wechat $wechat wechat组件
* @property SmsApplication $sms sms组件
* @property Identity $identity identity
* @property Logs $log log
* @property Formatter $formatter
* @property HttpSv $httpSv
* @property WorkUser $workUser
* @property WechatWork $wechatWork
* @property BaiduOcr $ocr 百度文字识别
* @property ToolSys $toolSys
* @property SyncOcrAnnex $syncOcrAnnex
* @property SDMHelper $SDMHelper
* @property OaClient $OAClient
* @property CheckFormLogic $CheckFormLogic
* @property LoginClient $loginClient
* ----------------------- ↓↓↓Swoole客户端↓↓↓ --------------------
* @property SwLogClient $swLogClient
* @property SwTaskClient $swTaskClient
* ----------------------- ↓↓↓数据库↓↓↓ --------------------------
* @property Info $itemInfo
* @property itemSignatory $itemSignatory
* @property Superrole $itemSuperrole
* @property Menu $adminMenu
* @property User $adminUser
* @property Role $adminRole
* @property Rolemenurelation $roleMenuRelation
* @property Userrolerelation $userRoleRelation
* @property Checkcategory $dictionaryCheckcategory
* @property Checkname $dictionaryCheckname
* @property Checknameattr $dictionaryChecknameattr
* @property Csset $dictionaryCsset
* @property Document $dictionaryDocument
* @property Genercsetinfo $dictionaryGenercsetinfo
* @property Genercsetinfotype $dictionaryGenercsetinfotype
* @property Itemjob $dictionaryItemjob
* @property Unblinding $dictionaryUnblinding
* @property Leverform $dictionaryLeverform
* @property Levervalue $dictionaryLevervalue
* @property Ocr $dictionaryOcr
* @property Patientattr $dictionaryPatientattr
* @property Patientattrselect $dictionaryPatientattrselect
* @property Realrole $realRole
* @property Log $adminLog
* @property signatoryInfo $signatoryInfo
* @property signatoryUser $signatoryUser
* @property Department $signatoryDepartment
* @property Patient $patient
* @property PatientForm $patientForm
* @property PatientFormContent $patientFormContent
* @property PatientFormContentImg $patientFormContentImg 表单填写化验单图片表
* @property Patientattrs $patientattrs
* @property Form $dictionaryForm
* @property Region $dictionaryRegion
* @property FormRelation $dictionaryFormRelation
* @property FormVersion $dictionaryFormVersion
* @property FormGroup $dictionaryFormGroup
* @property PatientCard $patientCard
* @property Randblock $itemRandblock
* @property Randgroup $itemRandgroup
* @property Randnumber $itemRandnumber
* @property Randomdetails $itemRandomdetails
* @property Random $itemRandom
* @property Blockgroup $itemBlockgroup
* @property Medication $itemMedication
*
* @property FormField $dictionaryFormField
* @property ItemFormFieldText $dictionaryFormFieldText
* @property FormField $dictionaryFormFieldRadio
* @property ItemForm $itemForm
* @property PatientFormContentCm $patientFormContentCm
* @property ItemFormVersion $itemFormVersion
* @property ItemFormGroup $itemFormGroup
* @property ItemFormField $itemFormField
* @property ItemFormFieldRadio $itemFormFieldRadio
* @property ItemFormFieldText $itemFormFieldText
* @property Rolemodulerelation $realRolemodulerelation
* @property ItemDrugbatch $itemDrugbatch
* @property ItemSigdrugbatch $itemSigdrugbatch
* @property ItemSigdrugset $itemSigdrugset
* @property ItemPatientdrugbatch $itemPatientdrugbatch
* @property ItemPatientdrugset $itemPatientdrugset
* @property Jobstaff $itemJobstaff
* @property Patientchecktime $itemPatientchecktime
* @property Informedconsent $itemInformedconsent
* @property Patientworkannex $itemPatientworkannex
* @property Identificationresult $itemIdentificationresult
* @property Identificationresultchange $itemIdentificationresultchange
* @property Unblinding $itemUnblinding
* @property Checkname $itemCheckname
* @property Imgtxtdiscern $itemImgtxtdiscern
* @property Urgentunblind $itemUrgentunblind
* @property File $itemFile
* @property Setocrfield $dictionarySetocrfield
* @property Question $itemQuestion
* @property Reply $itemReply
* @property Export $itemExport
* @property Csae $itemCsae
* @property Appletsmenu $adminAppletsmenu
* @property Appletsrolemenurelation $adminAppletsrolemenurelation
* @property Appletsdata $itemAppletsdata
* @property Vicecopy $itemVicecopy
* @property Researchstage $itemResearchstage
* @property Checktime $itemChecktime
* @property Informedconsentsign $itemInformedconsentsign
* @property Downpicture $itemDownpicture
* @property Answer $itemQuestionanswer
* @property Signatorypatient $signatoryPatient
* @property Realrolesignatoryrelation $roleSignatoryRelation
* @property PatientAeContent $itemPatientAeContent
* @property DictionaryRule $dictionaryRule
* @property DictionaryFormtype $dictionaryFormtype
* @property DictionaryFormtyperule $dictionaryFormtyperule
* @property ItemAgecountset $itemAgecountset
* @property DictionaryWorkset $dictionaryWorkset
* @property WorklistItemworklist $worklistItemworklist
* @property WorklistItemcustomname $worklistItemcustomname
* @property WorklistItemworklistset $worklistItemworklistset
* @property WorklistSigworklist $worklistSigworklist
* @property WorklistSigcustomname $worklistSigcustomname
* @property WorklistSigworklistset $worklistSigworklistset
* @property WorklistPatientinfo $worklistPatientinfo
* @property WorklistPatientconnect $worklistPatientconnect
* @property WorklistPatientworklist $worklistPatientworklist
* @property Formpatientsign $itemFormpatientsign
* @property DictionaryListset $dictionaryListset
* @property ListsetItemlist $listsetItemlist
* @property ListsetSiglist $listsetSiglist
* @property ListsetOperate $listsetOperate
* @property ListsetAnnex $listsetAnnex
* @property ListsetAnnexcat $listsetAnnexcat
* @property ListsetFlow $listsetFlow
* @property BusinessCategory $businessCategory
* @property BusinessRecord $businessRecord
* @property BusinessRecordannex $businessRecordannex
* @property Backupschange $itemBackupschange
* @property Questionanswer $dictionaryQuestionanswer
* @property Changesendlog $itemChangesendlog
* @property OdmSyncRecord $odmSyncRecord
* @property ItemInfosign $itemInfosign
* @property Logtype $itemLogtype
* @property Exportpdf $itemExportpdf
* @property Identificationresultdestroy $itemIdentificationresultdestroy
* @property PatientWorkCount $patientWorkCount
* @property Websitefiling $adminWebsitefiling
* @property Doctoridea $itemDoctoridea
* @property Questionconfig $itemQuestionconfig
* @property Configtable $adminConfigtable
* @property Send $adminSend
* @property PatientChecktimeList $patientChecktimeList
* @property OcrKeyword $ocrKeyword
* @property OcrRawdata $ocrRawdata
* @property OcrMatedata $ocrMatedata
* @property OcrMedicalword $ocrMedicalword
* @property OcrMatewhite $ocrMatewhite
* @property OcrMateblack $ocrMateblack
* @property OcrSigpatient $ocrSigpatient
* @property OcrMedical $ocrMedical
* @property OcrOcrannex $ocrOcrannex
* @property OcrRawword $ocrRawword
* @property OcrRawblack $ocrRawblack
* @property Formmodel $itemFormmodel
* @property OcrRawlock $ocrRawlock
* @property OcrMedicallock $ocrMedicallock
* @property OcrChangetype $ocrChangetype
* @property OcrDeletename $ocrDeletename
* @property OcrReplace $ocrReplace
* @property OcrAnnextype $ocrAnnextype
* @property OcrSigkeyword $ocrSigkeyword
* @property OcrCt $ocrCt
* @property Blindmethodlog $blindMethodLog
* @property OcrLoseannex $ocrLoseannex
* @property Checknameweight $dictionaryChecknameweight
* @property OcrMatesearch $ocrMatesearch
* @property Checknameweight $itemChecknameweight
* @property Sign $itemSign
* @property ItemOcrCsaePatientDetail $itemOcrCsaePatientDetail
* @property ItemOcrCasePatientSpecialdetail $itemOcrCasePatientSpecialdetail
* @property ItemRemarks $itemRemarks
* @property OcrCtcase $ocrCtcase
* @property OcrCaseremark $ocrCaseremark
* @property ItemOcrCsaePatientDetailNew $itemOcrCsaePatientDetailNew
* @property ItemOcrCasePatientSpecialdetailNew $itemOcrCasePatientSpecialdetailNew
* @property OcrOcrannexnew $ocrOcrannexnew
* @property OcrDrug $ocrDrug
* @property OcrTake $ocrTake
* @property OcrCtreplace $ocrCtreplace
* @property OcrMatedrug $ocrMatedrug
* @property OcrDrugcategory $ocrDrugcategory
* @property DictionaryMedicaltake $dictionaryMedicaltake
* @property DictionaryMedicalword $dictionaryMedicalword
* @property DictionaryDrugcategory $dictionaryDrugcategory
* @property DictionaryDrug $dictionaryDrug
* @property Confirm $itemConfirm
* @property Lock $itemLock
* @property MedicalMatewhite $medicalMatewhite
* @property MedicalMateblack $medicalMateblack
* @property MedicalMatedrug $medicalMatedrug
* @property MedicalOcrdata $medicalOcrdata
* @property MedicalLock $medicalLock
* @property Allowpatientwrite $Allowpatientwrite
* @property Recharge $Recharge
* @property Recharge $Transfer
* @property TmpDeletename $tmpDeletename
* @property TmpDrug $tmpDrug
* @property TmpDrugcategory $tmpDrugcategory
* @property TmpKeyword $tmpKeyword
* @property TmpMedical $tmpMedical
* @property TmpMedicalblack $tmpMedicalblack
* @property TmpMedicaldrug $tmpMedicaldrug
* @property TmpMedicallock $tmpMedicallock
* @property TmpMedicaltake $tmpMedicaltake
* @property TmpMedicalwhite $tmpMedicalwhite
* @property TmpMedicalword $tmpMedicalword
* @property TmpRawblack $tmpRawblack
* @property TmpRawdata $tmpRawdata
* @property TmpRawlock $tmpRawlock
* @property TmpRawmate $tmpRawmate
* @property TmpRawword $tmpRawword
* @property TmpReplace $tmpReplace
* @property TmpSigkeyword $tmpSigkeyword
* @property TmpHospital $tmpHospital
* @property TmpInspect $tmpInspect
* @property TmpPatienthospital $tmpPatienthospital
* @property TmpReport $tmpReport
* @property TmpAnnex $tmpAnnex
* @property TmpPatient $tmpPatient
* @property TmpPatientct $tmpPatientct
* @property TmpCustom $tmpCustom
* @property TmpTable $tmpTable
* @property TmpText $tmpText
* @property TmpOutmedical $tmpOutmedical
* @property TmpIntervene $tmpIntervene
* @property TmpIntervene0 $tmpIntervene0
* @property TmpIntervene1 $tmpIntervene1
* @property TmpIntervene2 $tmpIntervene2
* @property OcrRawlockunique $ocrRawlockunique
* @property TmpCtreplace $tmpCtreplace
* @property TmpDoctoradviceoriginal $tmpDoctoradviceoriginal
* @property TmpDoctoradviceannex $tmpDoctoradviceannex
* @property TmpDoctoradvicereplace $tmpDoctoradvicereplace
* @property TmpDoctoradvicematewhite $tmpDoctoradvicematewhite
* @property TmpDoctoradvicemateblack $tmpDoctoradvicemateblack
* @property TmpDoctoradvicematedrug $tmpDoctoradvicematedrug
* @property TmpDoctoradvicetable $tmpDoctoradvicetable
* @property TmpDoctoradvicepatient $tmpDoctoradvicepatient
* @property TmpDoctoradvicelock $tmpDoctoradvicelock
* @property TmpDoctoradviceformal $tmpDoctoradviceformal
* @property CollectCategory $collectCategory
* @property CollectInspect $collectInspect
* @property CollectHospital $collectHospital
* @property CollectItemhospital $collectItemhospital
* @property CollectOut $collectOut
* @property CollectItemout $collectItemout
* @property CollectDrugcategory $collectDrugcategory
* @property CollectDrug $collectDrug
* @property CollectMedicaltake $collectMedicaltake
* @property CollectMedicalword $collectMedicalword
* @property CollectItemdrug $collectItemdrug
* @property CollectEcg $collectEcg
* @property CollectItemecg $collectItemecg
* @property CollectCt $collectCt
* @property CollectItemct $collectItemct
* @property CollectReport $collectReport
* @property CollectItemreport $collectItemreport
* @property CollectKeywordcat $collectKeywordcat
* @property CollectKeyword $collectKeyword
* @property CollectRawword $collectRawword
* @property CollectItemkeyword $collectItemkeyword
* @property CollectCost $collectCost
* @property CollectItemcost $collectItemcost
* @property CollectPatienthospital $collectPatienthospital
* @property CollectPatientecg $collectPatientecg
* @property CollectPatientct $collectPatientct
* @property CollectPatientreport $collectPatientreport
* @property CollectPatientraw $collectPatientraw
* @property CollectPatientrawmate $collectPatientrawmate
* @property CollectPatientrawblack $collectPatientrawblack
* @property CollectPatientrawlock $collectPatientrawlock
* @property CollectPatientmedical $collectPatientmedical
* @property CollectPatientmedicalwhite $collectPatientmedicalwhite
* @property CollectPatientmedicalblack $collectPatientmedicalblack
* @property CollectPatientmedicaldrug $collectPatientmedicaldrug
* @property CollectPatientmedicallock $collectPatientmedicallock
* @property CollectPatientout $collectPatientout
* @property OcrSpecialmedical $ocrSpecialmedical
* @property CollectPatient $collectPatient
* @property CollectAnnex $collectAnnex
* @property ExportSas $exportSas
* @property CollectSighospital $collectSighospital
* @property CollectSigout $collectSigout
* @property CollectSigkeyword $collectSigkeyword
* @property DictionaryDetectname $dictionaryDetectname
* @property DictionaryDetectblackword $dictionaryDetectblackword
* @property DictionaryDetectkeyword $dictionaryDetectkeyword
* @property CollectTable $collectTable
* @property CollectText $collectText
* @property CollectCustom $collectCustom
* @property ItemPatientformimgcontent $itemPatientformimgcontent
* @property Identificationexport $itemIdentificationexport
* @property ItemResultidentify $itemResultidentify
* @property ItemEventwatchdog $itemEventwatchdog
* @property \Application\Service\DB\Temple\Annex $templeAnnex
* @property checklist $templeChecklist
* @property ItemMedicaltake $itemMedicaltake
* @property DoctoradviceOriginal $doctoradviceOriginal
* @property ItemPatientinfo $itemPatientinfo
* @property ItemSignaturebatch $itemSignaturebatch
* @property ItemSignaturedetail $itemSignaturedetail
* @property SignatoryCollecttypeocr $itemSignatoryCollecttypeocr
* @property ItemDetectpatient $itemDetectpatient
* @property DictionaryOcrreplace $dictionaryOcrreplace
* @property ItemCissclass $itemCissclass
* @property ItemCissoption $itemCissoption
* @property ItemPatientciss $itemPatientciss
* @property PatientFormLogicError $itemPatientFormLogicError
* @property PatientFormLogicErrorPointer $itemPatientFormLogicErrorPointer
* @property PatientFormLogicErrorLog $itemPatientFormLogicErrorLog
* @property PatientFormLogicErrorQuery $itemPatientFormLogicErrorQuery
* @property ItemLogicErrorReportBlack $itemLogicErrorReportBlack
* @property Fixednametype $fixednametype
* @property Fixedname $fixedname
* @property ProjectMsgset $projectMsgset
* @property ProjectMsginfo $projectMsginfo
* @property ProjectMsgsend $projectMsgsend
* @property Planviolate $itemPlanviolate
* @property Weblink $adminWeblink
* @property AdminWorkbatch $adminWorkbatch
* @property AdminWorkinfo $adminWorkinfo
* @property DictionaryEventset $dictionaryEventset
* @property DictionaryEventattr $dictionaryEventattr
* @property AdminMedicallock $adminMedicallock
* @property ItemPatientevent $itemPatientevent
* @property ItemPatienteventannex $itemPatienteventannex
* @property ItemPatienteventset $itemPatienteventset
* @property ProjectPatientwork $projectPatientwork
* @property ItemRandomsecondary $itemRandomsecondary
* @property ProjectMedicalquestion $projectMedicalquestion
* @property ProjectMedicalquestioninfo $projectMedicalquestioninfo
* @property ProjectMedicalconfirm $projectMedicalconfirm
* @property ProjectMedicalconfirminfo $projectMedicalconfirminfo
* @property ProjectMedicalset $projectMedicalset
* @property ItemCheckdate $itemCheckdate
* @property PatientFormContentDelete $itemPatientFormContentDelete
* @property ProjectPatientworkbatch $projectPatientworkbatch
* @property ProjectPatientworkinfo $projectPatientworkinfo
* @property LogLogin $logLogin
* @property PatientFormContentUpdatedLog $patientFormContentUpdatedLog
* @property Exceedswindow $projectExceedswindow
* @property ProjectCmdrugset $projectCmdrugset
* @property PatientFormUnlock $patientFormUnlock
* @property CollectPatientdrug $collectPatientdrug
* @property DictionaryItemcategory $dictionaryItemcategory
* @property ItemPackage $itemPackage
*/
class Container
{
protected $container;
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
public function __get($name)
{
// TODO: Implement __get() method.
return $this->container->get($name);
}
}

View File

@ -0,0 +1,48 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/5 18:20
* @Description
*
*/
namespace Application\Common;
use Laminas\Crypt\BlockCipher;
use Laminas\Crypt\Key\Derivation\Pbkdf2;
use Laminas\Crypt\Key\Derivation\Scrypt;
use Laminas\Crypt\Password\Bcrypt;
use Laminas\Crypt\Password\BcryptSha;
use Laminas\Math\Rand;
class Crypt
{
/**
* Notes: 对称加解密 使用例子Crypt::blockCipher()->encrypt($data) Crypt::blockCipher()->decrypt($data)
* User: llbjj
* DateTime: 2022/5/5 18:48
*
* @return BlockCipher
*/
static function blockCipher() {
$blockCipher = BlockCipher::factory('openssl', ['algo' => 'aes', 'mode' => 'gcm']);
$blockCipher->setKey('ae60e54db83a30ea985fcd77b14c063320922864a584c5dfb96e77d84e7317aa');
return $blockCipher;
}
/**
* Notes: 获取加密字符串
* User: llbjj
* DateTime: 2022/5/5 19:12
*
* @param string $data
* @return string
*/
static function createKey(string $data = 'YikeenEDC') {
$salt = Rand::getBytes(32, true);
$key = Scrypt::calc($data, $salt, 2048, 3, 1, 32);
return bin2hex($key);
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace Application\Common;
/**
* 字典项字段。
* 有些字段的子集是通过字典项设置的, 无法通过表单配置读取选项内容。
*/
class DictionaryVarNameEnum
{
public const COLLECT_MEDICAL_TAKE_CMINDC = 'CMINDC100';
}

View File

@ -0,0 +1,91 @@
<?php
namespace Application\Common;
use Application\Service\DB\Dictionary\FormField;
class Enum
{
/**
* 这里应该删了
* 都转移到 @var FormField 类中了
*/
public const FORM_FIELD_TYPE_TEXT = '1';
public const FORM_FIELD_TYPE_DATE_UK = '2';
public const FORM_FIELD_TYPE_DATE = '3';
public const FORM_FIELD_TYPE_DATETIME = '5';
public const FORM_FIELD_TYPE_INTEGER = '6';
public const FORM_FIELD_TYPE_FLOAT_1 = '7';
public const FORM_FIELD_TYPE_FLOAT_2 = '8';
public const FORM_FIELD_TYPE_FLOAT_3 = '9';
public const FORM_FIELD_TYPE_RADIO = '10';
public const FORM_FIELD_TYPE_CHECKBOX = '11';
public const FORM_FIELD_TYPE_DROPDOWN = '12';
public const FORM_FIELD_TYPE_UPLOAD_FILE = '13';
public const FORM_FIELD_TYPE_UPLOAD_IMAGE = '14';
public const FORM_FIELD_TYPE_EDITOR = '15';
public const FORM_FIELD_TYPE = [
['value' => FormField::FORM_FIELD_TYPE_TEXT, 'label' => '文本'],
['value' => FormField::FORM_FIELD_TYPE_TEXTAREA, 'label' => '文本域'],
['value' => FormField::FORM_FIELD_TYPE_DATE_UK, 'label' => '日期(UK)'],
['value' => FormField::FORM_FIELD_TYPE_DATE, 'label' => '日期(年月日)'],
['value' => FormField::FORM_FIELD_TYPE_DATE_SECOND, 'label' => '日期(年月日时分)'],
['value' => FormField::FORM_FIELD_TYPE_DATETIME, 'label' => '日期(年月日时分秒)'],
['value' => FormField::FORM_FIELD_TYPE_DATETIME_UK, 'label' => '日期(年月日时分UK)'], // DateTimeUK
['value' => FormField::FORM_FIELD_TYPE_DATETIME_SECOND_UK, 'label' => '日期(年月日时分秒UK)'], // DateTimeSecondUK
['value' => FormField::FORM_FIELD_TYPE_TIME_UK, 'label' => '日期(时分UK)'], // TimeUK
['value' => FormField::FORM_FIELD_TYPE_TIME_SECOND_UK, 'label' => '日期(时分秒Uk)'], // TimeSecondUK
['value' => FormField::FORM_FIELD_TYPE_INTEGER, 'label' => '整数'],
['value' => FormField::FORM_FIELD_TYPE_FLOAT_1, 'label' => '小数(保留一位)'],
['value' => FormField::FORM_FIELD_TYPE_FLOAT_2, 'label' => '小数(保留二位)'],
['value' => FormField::FORM_FIELD_TYPE_FLOAT_3, 'label' => '小数(保留三位)'],
['value' => FormField::FORM_FIELD_TYPE_RADIO, 'label' => '单选'],
['value' => FormField::FORM_FIELD_TYPE_CHECKBOX, 'label' => '多选'],
['value' => FormField::FORM_FIELD_TYPE_DROPDOWN, 'label' => '下拉'],
['value' => FormField::FORM_FIELD_TYPE_UPLOAD_FILE, 'label' => '上传文件'],
['value' => FormField::FORM_FIELD_TYPE_UPLOAD_IMAGE, 'label' => '上传图片'],
['value' => FormField::FORM_FIELD_TYPE_EDITOR, 'label' => '编辑器'],
['value' => FormField::FORM_FIELD_TYPE_LABEL, 'label' => '文本(不可编辑)'],
['value' => FormField::FORM_FIELD_TYPE_SPAN, 'label' => '纯文本'],
['value' => FormField::FORM_FIELD_TYPE_UPLOAD_SHARE_IMAGE, 'label' => '上传共享图片'],
['value' => FormField::FORM_FIELD_TYPE_ITEM_FORM_SOURCE, 'label' => '项目表单数据'],
['value' => FormField::FORM_FIELD_TYPE_REGION_OPTION, 'label' => '级联选择'],
];
// 中心角色信息
public const SIGNATORY_ROLE_DATA = [
['value' => '1', 'label' => '研究医生','code'=>'yjys'],
['value' => '2', 'label' => '研究助理','code'=>'yjzl'],
['value' => '3', 'label' => 'PM','code'=>'pm'],
['value' => '4', 'label' => 'CRA','code'=>'cra'],
['value' => '5', 'label' => 'CRC','code'=>'crc'],
['value' => '6', 'label' => 'DM','code'=>'dm']
];
public const LOG_EVENT_SDV = 'SDV';
public const LOG_EVENT_UNSDV = 'Un-SDV';
public const LOG_EVENT_REVIEW = 'Review';
public const LOG_EVENT_UNREVIEW = 'Un-Review';
public const LOG_EVENT_LOCK = 'Lock';
public const LOG_EVENT_UNLOCK = 'Un-Lock';
public const LOG_EVENT_SIGN = 'Sign';
public const LOG_EVENT_UNSIGN = 'Un-Sign';
public const LOG_EVENT = [
self::LOG_EVENT_SDV => 'SDV',
self::LOG_EVENT_UNSDV => '取消SDV',
self::LOG_EVENT_REVIEW => 'Review',
self::LOG_EVENT_UNREVIEW => '取消Review',
self::LOG_EVENT_LOCK => 'Lock',
self::LOG_EVENT_UNLOCK => '解锁',
self::LOG_EVENT_SIGN => '签名',
self::LOG_EVENT_UNSIGN => '取消签名',
'More-SDV'=>'批量SDV',
'More-Lock'=>'批量锁定',
'More-Review'=>'批量Review',
'MoreUn-SDV'=>'批量取消SDV',
'MoreUn-Review'=>'批量取消Review',
'MoreUn-Lock'=>'批量解锁',
'MoreUn-Sign'=>'批量取消签名'
];
}

View File

@ -0,0 +1,72 @@
<?php
namespace Application\Common;
use Application\Form\item\FormForm;
class EventEnum {
/** @var string 字典项表单创建 */
const EVENT_DICTIONARY_FORM_CREATE = 'DICTIONARY_FORM_CREATE';
/**
* @var string 表单内容创建 【已迁移】
* @see EventEnumV2 已迁移至这里
*/
const EVENT_FORM_CONTENT_CREATE = 'FORM_CONTENT_CREATE';
/** @var string 表单字段创建 */
const AFTER_EVENT_FORM_FIELD_CREATE = 'AFTER_EVENT_FORM_FIELD_CREATE';
const AFTER_EVENT_CM_FORM_EDIT = 'AFTER_EVENT_CM_FORM_EDIT';
/** @var string 在CM列表中添加了AE表单。 */
const EVENT_CM_AE_FORM_CONTENT_CREATE = 'EVENT_CM_AE_FORM_CONTENT_CREATE';
const EVENT_CM_AE_FORM_CONTENT_EDIT = 'EVENT_CM_AE_FORM_CONTENT_EDIT';
/** @var string 项目表单创建 */
/** @see FormForm::createForm() */
const EVENT_AFTER_ITEM_FORM_CREATE = 'BEFORE_ITEM_FORM_CREATE';
/** @var string 表单内容编辑 [已迁移] */
/** @see EventEnumV2 已迁移至这里 **/
const EVENT_FORM_CONTENT_EDIT = 'FORM_CONTENT_EDIT';
/** @var string 通过质疑沟通来修改表单内容 [已迁移] */
/** @see EventEnumV2 */
const EVENT_FORM_CONTENT_EDIT_BY_QUESTION = 'FORM_CONTENT_EDIT_BY_QUESTION';
/** @var string 表单字段编辑 */
const AFTER_EVENT_FORM_FIELD_EDIT = 'AFTER_EVENT_FORM_FIELD_EDIT';
/** @var string 表单字段删除 */
const EVENT_FORM_FIELD_DELETE = 'EVENT_FORM_FIELD_DELETE';
/** @var string 表单字段删除 */
const AFTER_EVENT_FORM_FIELD_DELETE = 'AFTER_EVENT_FORM_FIELD_DELETE';
/** @var string 表单内容预览 */
const EVENT_FORM_CONTENT_VIEW = 'FORM_CONTENT_VIEW';
/** @var string 提交锚点时间 */
const BEFORE_EVENT_SUBMIT_ANCHOR_TIME = 'BEFORE_EVENT_SUBMIT_ANCHOR_TIME';
/** @var string 提交随机时间 */
const BEFORE_EVENT_SUBMIT_RANDOM_TIME = 'BEFORE_EVENT_SUBMIT_RANDOM_TIME';
/** @var string 更新完成状态之后 */
const AFTER_EVENT_SUBMIT_PATIENT_FORM = 'AFTER_EVENT_SUBMIT_PATIENT_FORM';
/** @var string 表单内容暂存 */
const EVENT_FORM_CONTENT_TEMP_STORAGE = 'FORM_CONTENT_TEMP_STORAGE';
/** @var string 表单内容重置 */
const EVENT_FORM_CONTENT_FLUSH = 'FORM_CONTENT_FLUSH';
/** @var string 锁定常规识别类表单 */
const EVENT_LOCK_SHARE_FORM_CONTENT = 'LOCK_SHARE_FORM_CONTENT';
/** @var string 解锁常规识别类表单 */
const EVENT_UNLOCK_SHARE_FORM_CONTENT = 'UNLOCK_SHARE_FORM_CONTENT';
}

View File

@ -0,0 +1,51 @@
<?php
namespace Application\Common;
/**
* 新的枚举类型
* @method static string getVal($key) 获取常量值
* @method static string getDesc($key) 获取常量描述
*/
class EventEnumV2
{
const
// 应该是通过进度管理来编辑
EVENT_FORM_CONTENT_EDIT = ['val' => 'FORM_CONTENT_EDIT', 'desc' => '编辑表单内容'],
// 应该是通过进度管理来创建
EVENT_FORM_CONTENT_CREATE = ['val' => 'FORM_CONTENT_CREATE', 'desc' => '填写表单内容'],
// 表单删除(一对多)
EVENT_FORM_CONTENT_DELETE = ['val' => 'FORM_CONTENT_DELETE', 'desc' => '表单内容删除' ],
// 恢复删除的表单内容
EVENT_FORM_CONTENT_RECOVERY = ['val' => 'FORM_CONTENT_RECOVERY', 'desc' => '表单内容恢复' ],
// 表单申请解锁
EVENT_FORM_CONTENT_APPLY_UNLOCK = ['val' => 'EVENT_FORM_CONTENT_APPLY_UNLOCK', 'desc' => '表单申请解锁'],
// 申请解锁后又取消了
EVENT_FORM_CONTENT_REVOKE_UNLOCK = ['val' => 'EVENT_FORM_CONTENT_REVOKE_UNLOCK', 'desc' => '取消表单申请解锁'],
// 通过质疑沟通来修改表单内容
EVENT_FORM_CONTENT_EDIT_BY_QUESTION = ['val' => 'FORM_CONTENT_EDIT_BY_QUESTION', 'desc' => '通过质疑沟通来修改表单内容'],
// 通过逻辑核查回复修改表单内容
EVENT_FORM_CONTENT_EDIT_BY_LOGIC_REPLY = ['val' => 'EVENT_FORM_CONTENT_EDIT_BY_LOGIC_REPLY', 'desc' => '常规识别类型的表单, 通过逻辑核查回复修改表单内容'],
EVENT_MULTI_SHARE_FORM_UPLOAD_IMAGE = ['val' => 'EVENT_MULTI_SHARE_FORM_UPLOAD_IMAGE', 'desc' => '常规识别类型一对多的表单, 上传图片。'],
EVENT_MULTI_SHARE_FORM_UPDATE_IMAGE = ['val' => 'EVENT_MULTI_SHARE_FORM_UPDATE_IMAGE', 'desc' => '常规识别类型一对多的表单, 修改图片。'],
EVENT_FORM_CONTENT_CONFIRM_APPLY_UNLOCK = ['val' => 'EVENT_FORM_CONTENT_CONFIRM_APPLY_UNLOCK', 'desc' => '确认表单解锁申请'];
public static function __callStatic($name, $arguments)
{
if ($name === 'getVal') {
return (current($arguments)['val']);
} elseif ($name === 'getDesc') {
return (current($arguments)['desc']);
}
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace Application\Common;
class Exportenum
{
public const Not_AE = [['INVSITE', 'PT', 'SUBNAM', 'FORM_SEQ', 'FORM_SEQ', '', '', '', ''], ['项目ID', '中心编号', '筛选号', '受试者姓名', '访视名称', '表单序号', '指标', '非AE类型', '备注']];
// SAE类
public const Experimentsummary = [['INVSITE', 'PT', 'SUBNAM', 'FORM_SEQ', ''], ['项目ID', '中心编号', '筛选号', '受试者姓名', '表单序号']];
//AE类
public const AE = [['INVSITE', 'PT', 'SUBNAM', 'FORM_SEQ', ''], ['项目ID', '中心编号', '筛选号', '受试者姓名', '表单序号']];
//指标AE
public const CheckAE = [['INVSITE', 'PT', 'SUBNAM', 'CPEVENT', 'FORM_SEQ', '', '',], ['项目ID', '中心编号', '筛选号', '受试者姓名', '访视名称', '表单序号', '指标名称']];
//随机分组和检查类
public const RAND_CHECK = [['INVSITE', 'PT', 'SUBNAM', 'CPEVENT', 'FORM_SEQ', ''], ['项目ID', '中心编号', '筛选号', '受试者姓名', '访视名称', '表单序号']];
//默认
public const DEFAULT = [['INVSITE', 'PT', 'SUBNAM', 'CPEVENT', 'FORM_SEQ', ''], ['项目ID', '中心编号', '筛选号', '受试者姓名', '访视名称', '表单序号']];
//随机号
public const RandNumber = [['分层名称', '方案分组', '区组号', '研究中心', '随机号码', '药物分组名称', '药物信息', '是否被调用', '是否作废']];
//随机号-非盲
public const RandNumber_01 = [['分层名称', '区组号', '研究中心', '随机号码', '是否被调用', '是否作废']];
//用药信息导出--无药物分类
public const Doctoradvice = [['项目号','中心','受试者','访视','药物名称','开始日期','结束日期','剂量','剂量单位','服用频率','服用方式','出院带药']];
//用药信息导出--有药物分类
public const Doctoradvice_category = [['项目号','中心','受试者','访视','药物分类','药物名称','开始日期','结束日期','剂量','剂量单位','服用频率','服用方式','出院带药']];
// 导出自定义表单
public const EXPORT_CUSTOM_FORM = [
[
'value' => 0,
'label' => '受试者基本信息[ PATIENT_BASIC ]'
],
[
'value' => 'DC',
'label' => '脱离完成[ DC ]'
],
[
'value' => 'AENE',
'label' => 'AE【非AE解释】[ AENE ]'
],
[
'value' => 'AETE',
'label' => 'AE【指标相关】[ AETE ]'
]
];
// 导出自定义表单日志
public const EXPORT_LOG_CUSTOM_FORM = [
[
'value' => 0,
'label' => '受试者基本信息[ PATIENT_BASIC ]'
],
[
'value' => 'Itempatientbreak',
'label' => '受试者中止/完成[ Itempatientbreak ]'
]
];
public const EXPORT_TYPE_MAP_CUSTOM_FORM = [
0 => self::EXPORT_LOG_CUSTOM_FORM,
1 => self::EXPORT_CUSTOM_FORM,
];
}

View File

@ -0,0 +1,74 @@
<?php
declare(strict_types=1);
/**
* @authorllbjj
* @DateTime2023/4/25 14:00
* @Description
*/
namespace Application\Common;
use Gumlet\ImageResize;
use Gumlet\ImageResizeException;
use function imagecolorallocate;
use function imagecolorallocatealpha;
use function imagecopy;
use function imagecreatetruecolor;
use function imagefilledrectangle;
use function imagerotate;
use function imagesx;
use function imagesy;
use function imagettfbbox;
use function imagettftext;
use function max;
use function min;
use const Application\Utils\APP_PATH;
class ImageResizeExtends extends ImageResize
{
/**
* Notes:
*
* DateTime: 2023/5/26 9:36
*
* @param float $angle 正数向左旋转,负数向右旋转
* @return $this
*/
public function rotate(float $angle): ImageResizeExtends
{
if (! $angle) {
return $this;
}
// 设置旋转后的背景色
$transparentBlack = imagecolorallocatealpha($this->source_image, 0, 0, 0, 127);
$this->source_image = imagerotate($this->source_image, $angle, $transparentBlack);
// 重新获取原图片的宽
$this->original_w = imagesx($this->source_image);
// 重新获取原图片的高
$this->original_h = imagesy($this->source_image);
$this->resize($this->getSourceWidth(), $this->getSourceHeight());
return $this;
}
public function outputLength($image_type = null, $quality = null, $filesize = 0)
{
$image_type = $image_type ?: $this->source_type;
header('Content-Type: ' . image_type_to_mime_type($image_type));
header('Content-Length: '. $filesize);
$this->save(null, $image_type, $quality);
}
public static function createFromString($image_data)
{
if (empty($image_data) || $image_data === null) {
throw new ImageResizeException('image_data must not be empty');
}
$resize = new self('data://application/octet-stream;base64,' . base64_encode($image_data));
return $resize;
}
}

View File

@ -0,0 +1,204 @@
<?php
namespace Application\Common;
use \baidu\AipOcr;
use Laminas\Config\Config;
use Application\Service\Extension\Laminas;
class Ocr
{
public static function ocr_result($imgPath = '', $templateSign = '', $delimit = '', &$setocrfield_data = [])
{
$_result = [];
$baidu_config = new Config(include realpath(__DIR__).'/../../../../config/autoload/zend-baidu.global.php');
$client = new \AipOcr($baidu_config['baidu']['app_id'], $baidu_config['baidu']['api_key'], $baidu_config['baidu']['aecret_key']);
$image = file_get_contents($imgPath);
if ($templateSign == '-1') {
//通用文字识别接口
$text = $options = array();
$options['probability'] = "true";
$result = $client->basicGeneralUrl($imgPath,$options);
if($result['error_code'] != 0){
return $result;
}
foreach ($result['words_result'] as $item) {
array_push($text, $item['words']);
}
$_result['item_name'] = 'text';
$_result['user']['result'] = implode(',', $text);
$_result['user']['result_type'] = 1;
}else if($templateSign == '-2'){
//通用医疗检查单
$result = $client->medicalReportDetection($image);
if($result['error_code'] != 0){
return $result;
}
if($result['Item_row_num'] && !empty($setocrfield_data)){
foreach($result['words_result'] as $itemKey => &$itemVal){
switch ($itemKey){
case 'Item':
foreach($itemVal as $fieldKey => &$fieldData){
foreach($fieldData as &$item){
if(!empty($setocrfield_data[1][$item['word_name']])){
$_result['user']['info'][$fieldKey][$setocrfield_data[1][$item['word_name']]] = $item['word'];
if($setocrfield_data[1][$item['word_name']] == 'reference_range'){
$item['word'] = str_ireplace(['~', '--'], '-', $item['word']);
$word_value_arr = explode('-', $item['word']);
if (count($word_value_arr) > 1) {
$word_value_arr = array_filter($word_value_arr);
$reference_range_max = floatval(array_pop($word_value_arr));
$reference_range_min = floatval(array_pop($word_value_arr));
} else {
$reference_range_max = '';
$reference_range_min = '';
}
$_result['user']['info'][$fieldKey]['reference_range_min'] = $reference_range_min;
$_result['user']['info'][$fieldKey]['reference_range_max'] = $reference_range_max;
}
}
}
}
break;
case 'CommonData':
foreach($itemVal as &$item){
if(!empty($setocrfield_data[0][$item['word_name']])) {
$_result['user'][$setocrfield_data[0][$item['word_name']]] = $item['word'];
}
}
break;
}
}
}
} else {
if ($delimit == 1) {
$delimiter = '-';
}elseif($delimit == 2) {
$delimiter = '~';
}elseif($delimit == 3) {
$delimiter = '--';
}
$result = $client->custom($image, array('templateSign' => $templateSign));
if($result['error_code'] != 0){
return $result;
}
foreach ($result['data']['ret'] as $key => &$val) {
$word_name_arr = explode('#', $val['word_name']);
if (count($word_name_arr) == 3) {
$_result['user']['info'][$word_name_arr[1]][$word_name_arr[2]] = $val['word'];
if (in_array($word_name_arr[2], array('reference_range', 'reference_range-1'))) {
$word_value_arr = explode($delimiter, $val['word']);
if (count($word_value_arr) > 1) {
$word_value_arr = array_filter($word_value_arr);
$reference_range_max = floatval(array_pop($word_value_arr));
$reference_range_min = floatval(array_pop($word_value_arr));
} else {
$reference_range_max = '';
$reference_range_min = '';
}
$_result['user']['info'][$word_name_arr[1]][$word_name_arr[2] . '_min'] = $reference_range_min;
$_result['user']['info'][$word_name_arr[1]][$word_name_arr[2] . '_max'] = $reference_range_max;
}
} else {
$word_value_arr = explode(':', $val['word']);
if (count($word_value_arr) == 2) {
$_result['user'][$val['word_name']] = $word_value_arr[1];
} else {
$_result['user'][$val['word_name']] = $val['word'];
}
}
}
}
foreach ($_result['user']['info'] as $k => $v) {
$two_col_data = [];
foreach ($v as $k1 => $v1) {
if (strpos($k1, "-1")) {
unset($_result['user']['info'][$k][$k1]);
if($v1 !== ''){
$two_col_data[str_ireplace('-1', '', $k1)] = $v1;
}
}
}
if(count($two_col_data)){
$_result['user']['info'][] = $two_col_data;
}
}
$collect_date = '';
if($_result['user']['collect_date']){
$collect_date = strtotime($_result['user']['collect_date']);
if ($collect_date > time() || $collect_date < 0) {
$collect_date = '';
}
}
$_result['user']['collect_date'] = $collect_date;
if(isset($_result['user']['result'])){
$_result['user']['result_type'] = 1;
}
return $_result;
}
/**
* Notes: 识别身份证信息
* User: lltyy
* DateTime: 2021/8/2 10:00
*
* @param string $imgPath
* @param string $templateSign
* @return array
*/
public static function ocr_card($imgPath = '', $templateSign = '')
{
$baidu_config = new Config(include realpath(__DIR__).'/../../../../config/autoload/zend-baidu.global.php');
$client = new \AipOcr($baidu_config['baidu']['app_id'], $baidu_config['baidu']['api_key'], $baidu_config['baidu']['aecret_key']);
$image = file_get_contents($imgPath);
$front_result = $client->custom($image, array('templateSign'=>$templateSign));
$field_arr = [
'姓名' => 'form_name',
'公民身份号码' => 'form_card',
'年龄' => 'form_age',
'出生' => 'form_birth',
'性别' => 'form_sex',
'民族' => 'form_nation',
'住址' => 'form_address',
];
$result = [
'code' => $front_result['error_code'],
'message' => $front_result['error_msg'],
'data' => []
];
if($front_result['error_code'] == 0){
$ocrContent = $front_result['data']['ret'];
foreach($ocrContent as $rowInfo){
//$fieldName = iconv('utf-8', 'gbk', $rowInfo['word_name']);
$fieldName = $rowInfo['word_name'];
$fieldValue = $rowInfo['word'];
$fieldId = $field_arr[$fieldName];
$newValue = $fieldValue;
if($fieldId == 'form_birth'){//年龄、出生
$date = strtotime($fieldValue); //获得出生年月日的时间戳
$newValue = date('Y-m-d',$date);
$today = strtotime('today'); //获得今日的时间戳
$diff = floor(($today - $date) / 86400 / 365); //得到两个日期相差的大体年数
//strtotime加上这个年数后得到那日的时间戳后与今日的时间戳相比
$ageValue = strtotime(substr($fieldValue, 6,8) . ' +' . $diff . 'years') > $today ? ($diff + 1) : $diff;
$result['data']['form_age'] = $ageValue;
}elseif($fieldId == 'form_sex'){
//$newValue = iconv('utf-8', 'gbk', $fieldValue) == '男' ? '0' : '1';
$newValue = $fieldValue == '男' ? '0' : '1';
}
$result['data'][$fieldId] = $newValue;
}
}
return $result;
}
}
?>

View File

@ -0,0 +1,43 @@
<?php
namespace Application\Common;
class RedisEnum
{
const USER_TOKEN = 'token:';
// 生成的临时key, 判断登陆二维码是否过期
const TMP_CODE = 'code:';
/**
* 登录用的状态
*/
const USER_STATUS = 'status:';
/**
* 存储用户绑定验证码
* sms:{$mobile}
*/
const SMS = 'sms:';
/**
* 存储用户登录验证码
* sms:login:{$mobile}
*/
const SMS_LOGIN = 'sms:login';
/**
* 短信速率验证
* smsLimit:{$mobile}
*/
const SMS_LIMIT = 'smsLimit:';
/**
* 项目充值验证
* smsRecharge{$mobile}
*/
const SMS_Recharge = 'smsRecharge:';
const PATIENT_FORM_TEMP_STORAGE = 'patientFormTempStorage:';
}

View File

@ -0,0 +1,62 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/4 14:08
* @Description
*
*/
namespace Application\Common;
class StatusCode{
const SUCCESS = [
'code' => 200,
'msg' => ''
],
NO_TOKEN = [
'code' => 60001,
'msg' => '非法访问'
],
NO_BIND_USER = [
'code' => 60002,
'msg' => '请绑定用户信息'
],
NO_USER = [
'code' => 60003,
'msg' => '用户不存在'
],
NO_LOGIN = [
'code' => 401,
'msg' => '请重新登录'
],
E_FIELD_VALIDATOR = [
'code' => 60011,
'msg' => '表单字段验证失败'
],
E_LOGIN_CODE_EXPIRE = [
'code' => 60012,
'msg' => '登录二维码过期'
],
E_RUNTIME = [
'code' => -1,
'msg' => '服务器异常'
],
E_ACCESS = [
'code' => 60013,
'msg' => '不合法访问'
],
E_RAND_NUMBER = [
'code' => 600110,
'msg' => '随机号码有误'
];
/**------------------ 短信模块 ----------------- */
const E_SMS_RATE_LIMIT = [
'code' => 61000,
'msg' => '短信发送过于频繁',
];
}

View File

@ -0,0 +1,59 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/5 20:27
* @Description
*
*/
namespace Application\Common;
use Application\Common\Crypt;
use Laminas\Stdlib\ArrayUtils;
class Token
{
/**
* Notes: 创建Token值
* User: llbjj
* DateTime: 2022/5/6 9:02
*
* @param array $data
* @return string
*/
static function createToken(array $data) {
$data['ip'] = $_SERVER['REMOTE_ADDR'];
return rtrim(Crypt::blockCipher()->encrypt(json_encode($data)), '==');
}
/**
* Notes: 验证Token是否为有效值
* User: llbjj
* DateTime: 2022/5/6 9:03
*
* @param string $token
* @return bool
*/
static function verifyToken(string $token) {
$decryptData = self::decryptToken($token);
return !empty($decryptData);
}
/**
* Notes: 解密token值
* User: llbjj
* DateTime: 2022/5/6 9:03
*
* @param string $data
* @return mixed|void
*/
static function decryptToken(string $data) {
try {
$data = $data.'==';
return json_decode(Crypt::blockCipher()->decrypt($data));
}catch (\Exception $e){
}
}
}

View File

@ -0,0 +1,473 @@
<?php
namespace Application\Controller;
use Application\Common\DictionaryVarNameEnum;
use Application\Common\EventEnum;
use Application\Common\StatusCode;
use Application\Form\CmAEModel;
use Application\Form\item\patient\PatientFormModel;
use Application\Mvc\Controller\BasicController;
use Application\Service\DB\Db;
use Application\Service\DB\Dictionary\Form;
use Application\Service\Exceptions\InvalidArgumentException;
use Application\Service\Extension\Event;
use Application\Service\Extension\Events\FormEventHandler;
use Application\Service\Extension\Helper\ArrayHelper;
use Application\Service\Extension\Helper\DataHelper;
use Application\Service\Extension\Helper\SDMHelper;
use Application\Service\Extension\Helper\StringHelper;
use Application\Service\Extension\Laminas;
use Exception;
use Laminas\Db\ResultSet\ResultSet;
use Laminas\Db\Sql\Expression;
use Laminas\Db\Sql\Select;
use Laminas\Db\Sql\Sql;
use Laminas\Db\Sql\Where;
use Laminas\View\Model\JsonModel;
class CmController extends BasicController
{
/**
* @url /cm
* @behavior CM_INDEX
* @return JsonModel
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function indexAction(): JsonModel
{
$this->validator->attach(
[['item_id', 'itemsig_id'], 'required'],
[['patient_id', 'operate_user', 'status'], 'default', 'value' => 0],
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
$this->validator->attributes['form_id'] = Laminas::$serviceManager->itemFormField->fetchOne(['where' => ['var_name' => DictionaryVarNameEnum::COLLECT_MEDICAL_TAKE_CMINDC, 'item_id' => $this->validator->attributes['item_id'], 'is_del' => 0]])['form_id'];
if (!$this->validator->attributes['form_id']) {
return $this->RenderApiJson()->Success();
}
$model = new PatientFormModel($this->validator);
$model->setScenario($model::SCENARIO_CM_LIST);
$where = new Where();
$where->equalTo('cm.is_del', 0)->equalTo('cm.item_id', $this->validator->attributes['item_id'])->equalTo('cm.sign_id', $this->validator->attributes['itemsig_id'])->equalTo('cm.status', $this->validator->attributes['status']);
if ($this->validator->attributes['patient_id']) {
$searchStr = $this->validator->attributes['patient_id'];
$searchPatientId = Laminas::$serviceManager->patient->fetchCol('id', [
'item_id' => $this->validator->attributes['item_id'],
"(patient_number LIKE '%{$searchStr}%' OR AES_DECRYPT( UNHEX( `patient_name` ), 'ykeEdc' ) LIKE '%{$searchStr}%')"
]);
$where->nest()
->in('cm.patient_id', $searchPatientId)->or
->in('cm.update_user_id', [$this->validator->attributes['patient_id']])
->unnest();
}
//药物名称检索
$serch_drug = isset($this->validator->attributes['serch_drug']) && $this->validator->attributes['serch_drug'] != '' ? trim($this->validator->attributes['serch_drug']) : '';
if ($serch_drug != '') {
$where->expression("JSON_SEARCH(content.data, 'all', ?)", "%$serch_drug%");
}
unset($serch_drug);
$limit = $this->validator->attributes['limit'] ?: 10;
$select = (new Select())
->from(['cm' => Laminas::$serviceManager->patientFormContentCm->getTableName()])
->join(['content' => Laminas::$serviceManager->patientFormContent->getTableName()], 'content.id = cm.content_id', ['id', 'update_user_id', 'update_time', 'data', 'checktime_id'], Select::JOIN_LEFT)
->where($where);
$totalSqlObject = clone $select;
$select->limit($limit)
->offset($limit * (Laminas::$app->getRequest()->getPost('page', 1) - 1));
$res = function ($sqlObject) {
$sql = new Sql(Laminas::$app->getServiceManager()->get('dbAdapter'));
$statement = $sql->prepareStatementForSqlObject($sqlObject);
$resultSet = new ResultSet();
return $resultSet->initialize($statement->execute())->toArray();
};
$totalSqlObject->columns([new Expression('COUNT(`cm`.`id`) as `count`')]);
$totalCount = intval($res($totalSqlObject)[0]['count'] ?? 0);
$query = $res($select);
$getCMINDCStatus = function($val) {
if ($val == 0) {
return '未判断>>';
} elseif ($val == 1) {
return '属于新增AE>>';
} elseif ($val == 2) {
return '属于已有AE>>';
}
return '非AE>>';
};
foreach ($query as &$item) {
$operateUser = $item['update_user_id'];
$updatedAt = $item['update_time'];
$patientId = $item['patient_id'];
$item = ArrayHelper::merge(current($model->getMultiView('', [$item])), [
'patient_id_str' => SDMHelper::app()->patient->getPatientName($patientId) . ' [' . SDMHelper::app()->patient->getPatientNumber($patientId) . '] ',
'operate_data' => $operateUser ? SDMHelper::app()->user->getRealName($operateUser) . ' / ' . date('Y-m-d H:i:s', $updatedAt) : date('Y-m-d H:i:s', $updatedAt),
'cmindc_status_str' => $item['status'] == 0 ? '未判断' : $getCMINDCStatus($item['cmindc_status']),
// 'patient_id_str' => $item['status'] == 0 ? '未判断' : $getCMINDCStatus($item['cmindc_status']),
'sign_id_str' => SDMHelper::app()->sign->getSignName($item['sign_id'])
]);
$item['checktime_id_str'] = $item['checktime_id'] ? SDMHelper::app()->checkTime->getCheckName($item['checktime_id']) : '';
}
$table = ArrayHelper::remove(ArrayHelper::merge([
["label" => "受试者", "prop" => "patient_id_str"],
], Laminas::$serviceManager->itemForm->getPreviewConfig($this->validator->attributes['form_id'])['table'] ?? []), 'width');
if ($this->validator->attributes['status'] == 1) {
$table = ArrayHelper::merge($table, [
["label" => "操作人/操作时间", "prop" => "operate_data"],
]);
}
return $this->RenderApiJson()->Success($query, 'ok', [
'total' => $totalCount,
'table' => ArrayHelper::merge($table, [
["label" => "CM判断", "prop" => "cmindc_status_str"],
])
]);
}
/**
* @url /cm/create
* @behavior CM_CREATE
* @return JsonModel
* @throws Exception
*/
public function createAction(): JsonModel
{
$this->validator->attach(
[['patient_id', 'form_id', 'item_id', 'checktime_id', 'itemsig_id'], 'required'],
[['patient_id', 'form_id', 'item_id', 'checktime_id', 'itemsig_id'], 'integer'],
);
$cmId = SDMHelper::app()->form->getCMINDCId($this->validator->attributes['form_id']);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
// 受试者新增AE必须要添加数据
if ($this->validator->attributes[$cmId] == 1 && !StringHelper::jsonDecode($this->validator->attributes['ae'], false)) {
throw new InvalidArgumentException('请添加AE数据。');
}
if (!isset($this->validator->attributes[$cmId]) || !$this->validator->attributes[$cmId]) {
throw new InvalidArgumentException(SDMHelper::app()->form->field->getName($cmId) . '不能为空。');
}
// 当用药原因CM判断结果不是其他备注清空
if( !$this->LocalService()->collectMedicaltake->isCmOptionsOther($this->validator->attributes[$cmId])) {
$this->validator->setAttributes([
'note' => ''
]);
}
$save_log_data = $this->validator->attributes;
Event::on(EventEnum::AFTER_EVENT_CM_FORM_EDIT, [FormEventHandler::class, 'afterEventCmFormEdit']);
$model = new PatientFormModel();
$model->setPostValues($this->validator->attributes);
$postData = DataHelper::handleFormData($this->validator->attributes, $this->params()->fromPost('form_id'));
$model->setBeforeCommit(function() use ($model) {
Event::trigger(EventEnum::AFTER_EVENT_CM_FORM_EDIT, [$model]);
})->editForm($postData);
$AEModel = new CmAEModel();
// 属于新增AE
if ($this->validator->attributes[$cmId] == 1) {
$AEModel->createNewPatientAE();
} elseif ($this->validator->attributes[$cmId] == 2) {
if (!isset($this->validator->attributes['checked_content_id']) && !$this->validator->attributes['checked_content_id']) {
throw new InvalidArgumentException('请选择关联的AE。');
}
$AEModel->setPostValues(ArrayHelper::merge([
'cm_content_id' => $this->validator->attributes['id']
], $this->validator->attributes));
$AEModel->createAlreadyHaveAE();
} elseif (Laminas::$serviceManager->collectMedicaltake->fetchOne(['where' => ['id' => $this->validator->attributes[$cmId]]])['english'] === 'CMINDC4') {
// 选的其他, 备注原因要必填
if (!isset($this->validator->attributes['note']) && !$this->validator->attributes['note']) {
throw new InvalidArgumentException('请填写原因。');
}
$AEModel->setPostValues(ArrayHelper::merge(['cm_content_id' => $this->validator->attributes['id']], ['note' => $this->validator->attributes['note']]));
// 更新选中其他的有原因
$AEModel->updateNote();
}
//日志存储
if(!empty($this->validator->attributes['id'])){
$this->LocalService()->log->saveFileLog($this->validator->attributes['id'],'ItemPatientformcontentcmlog',$save_log_data,1,'修改cm判断',$this->validator->attributes['item_id'],' ',['item_id'=>$this->validator->attributes['item_id']]);
}
unset($save_log_data);
return $this->RenderApiJson()->Success([]);
}
/**
* @url /cm/preview
* @behavior CM_PREVIEW
* @return JsonModel
* @throws Exception
*/
public function previewAction(): JsonModel
{
// 生成表单令牌 存储进redis 设置过期时间
$only_keys1 = bin2hex(random_bytes(32));
$redis = Laminas::$serviceManager->redisExtend->getRedisInstance();
$redis->setex($only_keys1,3600,1);
$this->validator->attach(
[['id'], 'required'],
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
$val = Laminas::$serviceManager->itemForm->setPreviewScenario(Form::SCENARIO_CM_LIST_VIEW)->getPreviewConfig($this->validator->attributes['id']);
return $this->RenderApiJson()->Success($val,'OK',['only_keys1' => $only_keys1]);
}
/**
* @url /cm/view
* @behavior CM_VIEW
* @return JsonModel
* @throws Exception
*/
public function viewAction(): JsonModel
{
$this->validator->attach(
[['id'], 'required'],
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
$model = new PatientFormModel();
$val = $model->setScenario($model::SCENARIO_CM_LIST_VIEW)->viewById($this->validator->attributes['id']);
// 如果选项是其他, 要把备注内容带出来
$query = Laminas::$serviceManager->patientFormContentCm->fetchOne(['where' => ['content_id' => $this->validator->attributes['id']]]);
if ($query && SDMHelper::app()->form->field->compareMedicalTake($query['cmindc_status'], 'CMINDC4')) {
$val['note'] = $query['note'];
}
return $this->RenderApiJson()->Success($val);
}
/**
* @url /cm/ae/index
* @behavior CM_AE_INDEX
* @return JsonModel
* @throws Exception
*/
public function aeListAction(): JsonModel
{
$this->validator->attach(
[['item_id'], 'required'],
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
$model = new CmAEModel();
$model->setPostValues($this->validator->attributes);
$val = $model->getNewAEList();
return $this->RenderApiJson()->Success($val);
}
/**
* @url /cm/ae/view
* @behavior CM_AE_VIEW
* @return JsonModel
* @throws Exception
*/
public function aeListViewAction(): JsonModel
{
$this->validator->attach(
[['id', 'item_id', 'patient_id', 'ae_type'], 'required']
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(
StatusCode::E_FIELD_VALIDATOR,
$this->validator->getFirstErrorToString()
);
}
$model = new PatientFormModel();
$model->setPostValues($this->validator->attributes);
$res = [];
if ($this->validator->attributes['ae_type'] == 2) {
$query = Laminas::$serviceManager->itemCsaeRelation->fetchAll([
'where' => [
'patient_id' => $this->validator->attributes['patient_id'],
'is_del' => 0
]
]);
} elseif ($this->validator->attributes['ae_type'] == 1) {
$query = Laminas::$serviceManager->itemCsaeRelation->fetchAll([
'where' => [
'cm_content_id' => $this->validator->attributes['id'],
'is_del' => 0
]
]);
}
foreach ($query as $item) {
$res[] = [
'data' => Laminas::$serviceManager->itemPatientAeContent->fetchOne(['where' => ['branch' => $item['branch'], 'is_del' => 0]])['data'],
'id' => $item['content_id'],
'branch' => $item['branch']
];
}
$data = $res;
$res = [];
if ($data) {
$res = $model->viewAe($data);
if ($this->validator->attributes['ae_type'] == 2) {
foreach ($res as &$resItem) {
$resItem['is_bind'] = Laminas::$serviceManager->itemCsaeChecked->fetchOne([
'where' => [
'is_del' => 0,
'branch' => $resItem['branch'],
'cm_content_id' => $this->validator->attributes['id']
]
]) ? 1 : 0;
}
}
}
return $this->RenderApiJson()->Success($res, 'OK');
}
/**
* @url /cm/ae/viewRow
* @behavior CM_AE_VIEW_ROW
* @return JsonModel
* @throws Exception
*/
public function aeViewRowAction(): JsonModel
{
$data = Laminas::$serviceManager->itemPatientAeContent->fetchOne([
'where' => ['id' => $this->params()->fromPost('id')]
]);
$data['content_id'] = $this->LocalService()->itemPatientAeContent->getOneFieldVal('id', [
'branch' => $data['branch']
]);
$model = new PatientFormModel($this->validator);
$res = json_decode($data['data'], true);
$res['id'] = $this->params()->fromPost('id');
return $this->RenderApiJson()->Success($model->viewById(0, $data));
}
/**
* @url /cm/ae/edit
* @behavior CM_AE_EDIT
* @return JsonModel
* @throws Exception
*/
public function aeEditAction(): JsonModel
{
$this->validator->attach(
[['id'], 'required'],
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
$model = new CmAEModel();
// $model->setPostValues($this->validator->attributes);
$model->editAEForm();
return $this->RenderApiJson()->Success([]);
}
/**
* @url /cm/ae/delete
* @behavior CM_AE_DELETE
* @return JsonModel
* @throws Exception
*/
public function aeDeleteAction()
{
$this->validator->attach(
[['content_id', 'cm_content_id'], 'required'],
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
Db::beginTransaction();
$cmindcStatus = Laminas::$serviceManager->patientFormContentCm->fetchOne([
'where' => ['content_id' => $this->validator->attributes['cm_content_id']]
]);
// 已有AE
if ($cmindcStatus['cmindc_status'] == 2) {
// 删除已有AE
if (SDMHelper::app()->ae->discardCMListIsAlreadyAE($this->validator->attributes['content_id'], $this->validator->attributes['cm_content_id']) === false) {
// 如果都删除干净了, 就要弄到带判断列表内
SDMHelper::app()->ae->setCMAEEstimate($this->validator->attributes['cm_content_id']);
SDMHelper::app()->ae->flushCMINDCContent($this->validator->attributes['cm_content_id']);
}
} elseif($cmindcStatus['cmindc_status'] == 1) {
// 新增AE
SDMHelper::app()->ae->discardCMNewAE($this->validator->attributes['cm_content_id'], $this->validator->attributes['content_id']);
if (!Laminas::$serviceManager->itemCsaeRelation->fetchAll([
'where' => ['cm_content_id' => $this->validator->attributes['cm_content_id'], 'is_del' => 0]
])) {
SDMHelper::app()->ae->setCMAEEstimate($this->validator->attributes['cm_content_id']);
SDMHelper::app()->ae->flushCMINDCContent($this->validator->attributes['cm_content_id']);
}
}
Db::commit();
//异步处理访视进度情况信息
$this->LocalService()->swTaskClient->send([
'svName' => 'projectPatientworkbatch',
'methodName' => 'multipleUpdateData',
'params' => [
'item_id' => $cmindcStatus['item_id'],
'itemsig_id' => $cmindcStatus['sign_id'],
'patient_id' => $cmindcStatus['patient_id'],
'checktime_id' => 0,
'form_id' => $cmindcStatus['form_id'],
'operate_type'=>11,
'content_arr' => !empty($this->validator->attributes['cm_content_id']) ? [$this->validator->attributes['cm_content_id']] : [],
'user_id' => $this->LocalService()->identity->getId()
]
]);
return $this->RenderApiJson()->Success([]);
}
}

View File

@ -0,0 +1,706 @@
<?php
namespace Application\Controller;
use Application\Common\Com;
use Application\Common\ImageResizeExtends;
use Application\Common\StatusCode;
use Application\Form\CommonModel;
use Application\Service\Extension\Helper\CurlHelper;
use Application\Service\Extension\Helper\FormHelper;
use Application\Service\Extension\Helper\SDMHelper;
use Application\Service\Extension\Helper\StringHelper;
use Application\Service\Extension\Laminas;
use Application\Service\Extension\Uploader\adapter\Oss;
use Application\Service\Extension\Uploader\ImageUploader;
use EasyWeChat\Kernel\Exceptions\HttpException;
use EasyWeChat\Kernel\Exceptions\InvalidArgumentException;
use EasyWeChat\Kernel\Exceptions\InvalidConfigException;
use EasyWeChat\Kernel\Exceptions\RuntimeException;
use Gumlet\ImageResizeException;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Mvc\MvcEvent;
use Laminas\Stdlib\ArrayUtils;
use Laminas\View\Model\JsonModel;
class CommonController extends AbstractActionController
{
/** @var string 上传附件接口地址 */
public const UPLOAD_URL = '/common/upload';
/** @var string 上传图片接口地址 */
public const UPLOAD_IMG_URL = '/common/uploadImg';
/** @var string 加密参数 */
public const SECRET_KEY = 'yikeen';
/** @var string[] 需要token验证的接口 */
public const AUTH_ACTION = [
'upload', // 上传附件
'showPic', // 图片预览
'signFileUrl', // 下载附件路径签名
];
protected function attachDefaultListeners()
{
$event = $this->getEventManager();
$event->attach(MvcEvent::EVENT_DISPATCH, [$this, 'checkLogin'], 99);
parent::attachDefaultListeners(); // TODO: Change the autogenerated stub
}
/**
* 检查是否登录
* @param MvcEvent $event
*/
function checkLogin(MvcEvent $event)
{
// $host = "{$_SERVER['REQUEST_SCHEME']}://{$this->getRequest()->getHeader('host')->getFieldValue()}/";
if (in_array($event->getRouteMatch()->getParam('action'), self::AUTH_ACTION)) {
if( ( $_COOKIE['thirdAppId'] ?? time() ) != ( $this->LocalService()->config['toolSys']['appId'] ?? '' ) ) {
if( ( $_REQUEST['bucket'] ?? '' ) != 'login_url'){
Laminas::$serviceManager->identity->getIdentityData();
}
}
}
}
public function errormsgAction() {
$code = $this->params()->fromQuery('code');
// $errData = explode('|', Crypt::blockCipher()->decrypt($code));
$errData = explode('|', $code);
echo "<pre>";print_r(file_get_contents(APP_PATH.'/runtime/'.$errData[1].'/'.str_ireplace(':','_', $errData[2]).'_'.$errData[0].'.log'));exit;
}
public function qrcodeAction() {
$filePath = APP_PATH . '/data/qrcode_258.jpg';
ImageResizeExtends::createFromString(file_get_contents($filePath))->output();
die;
}
/**
* 上传附件
* @url http://xxx.com/common/upload
* @return JsonModel
* @throws \League\Flysystem\FilesystemException
* @throws \OSS\Core\OssException
*/
public function uploadAction(): JsonModel
{
$uploader = new ImageUploader();
$config = Laminas::$app->getConfig();
$uploader->setConfig([
'allowExtensions' => ArrayUtils::merge($config['image_uploader']['allowFileExtensions'] ?? [], $config['image_uploader']['allowExtensions'] ?? []),
'maxSize' => $config['image_uploader']['fileMaxSize'],
'driver' => ImageUploader::DRIVER_OSS,
]);
return $this->RenderApiJson()->Success($uploader->save($uploader::getInstanceByName('file')));
}
/**
* 显示图片
* @throws ImageResizeException
*/
public function showPicAction()
{
if($this->request->isPost()){
$imgPath = $this->params()->fromPost('path');
$bucket = $_POST['bucket'] ?: 'yikeen';
$style = $_POST['style'] ?: 'thumb';
//******************正则匹配 path、bucket 和 style 参数 【后端先做兼容,前端后续会拆分传输相应的参数】*****************
preg_match_all('/(?:\?|&)([^&=]+)=([^&]+)/', $imgPath, $matches, PREG_SET_ORDER);
if(!empty($matches)) {
$params = [];
foreach ($matches as $match) {
$key = urldecode($match[1]);
$value = urldecode($match[2]);
if(empty($value)) continue;
$params[$key] = $value;
}
$imgPath = $params['path'];
if(isset($params['bucket'])) $bucket = $params['bucket'];
if(isset($params['style']) && $params['style'] != 'thumb') $style = $params['style'];
}
//******************************************************************************************************
}else{
$imgPath = trim($this->params()->fromQuery("path", ''), '/');
$bucket = $this->params()->fromQuery("bucket", 'yikeen');
$style = $this->params()->fromQuery("style", 'thumb');
}
$bucket = $bucket == 'tmp' || $bucket == 'login_url' ? 'yikeen' : $bucket;
$fileUpLoader = new Oss(Laminas::$app->getConfig()['image_uploader'], $bucket);
// style => ['iphone' => 最不清楚的, 'sample' => 还挺清楚的, 'origin' => 原图, 'thumb' => 高度为100的缩略图]
$imgUrl = $fileUpLoader->getSignUrl($imgPath, $style);
$imgContent = file_get_contents($imgUrl);
if(!$imgContent) {
$imgUrl = $fileUpLoader->getOriginUrl($imgPath);
$imgContent = file_get_contents($imgUrl);
if(!in_array($style, ['origin', 'ocr'])) {
$imgStyleMapWidth = [
'sample' => '1000',
'thumb' => '80',
'iphone' => '400',
];
$imageResizeExtends = ImageResizeExtends::createFromString($imgContent);
// 压缩图片
$imageResizeExtends = $imageResizeExtends->resizeToWidth($imgStyleMapWidth[$style]);
$imageResizeExtends->output();
exit;
}
}
if($_COOKIE['thirdAppId'] ?? '') {
$imageResizeExtends = ImageResizeExtends::createFromString($imgContent);
// 原图显示,检测图片的大小
$imgSize = Com::customFilesize($imgUrl);
if ($imgSize / 1024 / 1024 > 20) {
// 压缩图片
$imageResizeExtends = $imageResizeExtends->resizeToWidth(3000);
}
$imageResizeExtends->outputLength(null, null, get_headers($imgUrl, 1)['Content-Length']);
exit;
}
echo $imgContent;die;
}
/**
* Notes: 在线文件下载
* User: llbjj
* DateTime: 2024/5/31 9:11
*
* @throws \OSS\Core\OssException
* @throws \OSS\Http\RequestCore_Exception
*/
public function downloadAction() {
$filePath = trim($this->params()->fromQuery('path', ''), '/');
$fileName = $this->params()->fromQuery('fileName', '');
$bucket = $this->params()->fromQuery('bucket', 'yikeen');
$fileUpLoader = new Oss(Laminas::$app->getConfig()['image_uploader'], $bucket);
$fileUpLoader->downloadOnline($filePath, $fileName);
}
/**
* @note 文件签名
* @return JsonModel
*/
public function signFileUrlAction(): JsonModel
{
$filePath = $this->params()->fromPost('path');
$bucket = $this->params()->fromPost('bucket', 'yikeen');
$filePath = str_ireplace(Oss::getUploadDomain(), '', $filePath);
$fileUpLoader = new Oss(Laminas::$app->getConfig()['image_uploader'], $bucket);
return $this->RenderApiJson()->Success([
'signUrl' => $fileUpLoader->getSignUrl($filePath),
]);
}
/**
* 上传图片
* @url http://xxx.com/common/uploadImg
* @return JsonModel
* @throws \League\Flysystem\FilesystemException
* @throws \OSS\Core\OssException
*/
public function uploadImgAction(): JsonModel
{
$uploader = new ImageUploader();
$config = Laminas::$app->getConfig();
$uploader->setConfig([
'allowExtensions' => $config['image_uploader']['allowExtensions'],
'maxSize' => $config['image_uploader']['imgMaxSize'],
'driver' => ImageUploader::DRIVER_OSS,
]);
return $this->RenderApiJson()->Success($uploader->save($uploader::getInstanceByName('file')));
}
/**
* 渲染表单组件
* - TableButton (表格按钮)
*/
public function renderFormComponentAction(): JsonModel
{
$componentName = $this->params()->fromPost('component', '');
$item_id = $this->params()->fromPost('item_id',0);//副项目ID
//获取该项目下设置的化验单采集时间类型
$dateType = 1;
if(!empty($item_id)){
$dateType = Laminas::$serviceManager->itemCheckdate->getOneFieldVal('date_type','is_del = 0 and item_id = '.$item_id);
$dateType = empty($dateType) ? 1 : $dateType;
}
$dateType = intval($dateType);
$model = new CommonModel();
$datas = $model->render($componentName,$dateType);
return $this->RenderApiJson()->Success($datas,'',['dateType'=>$dateType]);
}
/**
* 验证公式格式
* @return JsonModel
*/
public function formatExpressionAction(): JsonModel
{
// 表单变量 //计算符号
list($constVar, $condition) = FormHelper::getCalculateConditionWithClass();
$expression = str_replace(' ', '', $_POST['expression']);
// 正则验证
$pregConst = implode('|', $constVar);
preg_match("/^($pregConst)=(.*)/", $expression, $match);
if (!$match || count($match) != 3 && $match[2] == '') {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "语法错误 `a = b + c` 才是正确的格式, 或者你没有定义好的变量当作开头!!");
}
$expressionLen = strlen($expression);
$res = [];
for ($i = 0; $i < $expressionLen; $i++) {
if ($expression[$i] === '(') {
$res[] = $expression[$i];
} elseif ($expression[$i] === ')') {
$res[] = $expression[$i];
} elseif (in_array($expression[$i], $condition)) {
$res[] = $expression[$i];
} else {
$res[] = "$expression[$i]";
}
}
$parseExpression = (implode('', $res));
$exStr = array_filter(explode(' ', $parseExpression));
return $this->RenderApiJson()->Success([
'expression' => implode('', $exStr)
]);
}
/**
* @return JsonModel
*/
public function calculateExpressionAction(): JsonModel
{
// 防止被除数写0, eval报错好像try catch抓不到。
register_shutdown_function(function () {
$err = error_get_last();
if (isset($err['message']) && $err['message'] == 'Division by zero') {
$msg = ['code' => 60011, 'msg' => '请输入正确的数字'];
die(json_encode($msg));
}
});
try {
$formId = $this->params()->fromPost('id');
$expression = $this->LocalService()->itemForm->fetchOne([
'where' => ['id' => $formId]
])['expression'];
if (!$expression) {
return $this->RenderApiJson()->Success([], '该表单暂未设置公式。');
}
$expression = FormHelper::getFormatFormExpression($expression);
$runStr = $runExpression = '';
$constVar = FormHelper::getCalculateConditionWithClass()[0];
foreach ($expression['expression'] as $v) {
if (in_array($v, $constVar)) {
$runStr .= '$' . "$v = " . floatval($this->params()->fromPost($v) ?: 0) . '; ';
$runExpression .= '$' . $v;
} else {
$runExpression .= $v;
}
}
$func = <<<EOL
function run() {
$runStr;
return $runExpression;
}
EOL;
eval($func);
$res = round(run(), 2);
} catch (\Throwable $e) {
$res = -1;
}
return $this->RenderApiJson()->Success([
'res' => $res
]);
}
/**
* 计算公式
* @url: http://xxx.com/common/v2/calculateExpression
* @return JsonModel
*/
public function calculateExpressionV2Action(): JsonModel
{
$values = $this->params()->fromPost();
$expression = Laminas::$serviceManager->itemForm->fetchOne([
'where' => ['id' => $this->params()->fromPost('id')]
])['expression'];
$expressionArr = explode('=', $expression);
unset($expressionArr[0]);
$expression = implode('=', $expressionArr);
$exec = SDMHelper::app()->expression->setExpression($expression)->setValues($values)->execute();
return $this->RenderApiJson()->Success([
'res' => $exec->getExecuteVal(),
'message' => '',
'exStr' => $exec->getExecuteCompile(),
'values' => $values
]);
}
/**
* 获取上一个小程序版本
* @url http://xxx.com/common/miniVersion
* @return JsonModel
* @throws HttpException
* @throws InvalidArgumentException
* @throws InvalidConfigException
* @throws RuntimeException
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function miniVersionAction(): JsonModel
{
$platform = $this->getRequest()->getPost('platform');
$refresh = $this->getRequest()->getPost('refresh');
$token = Laminas::$serviceManager->wechat->getMiniApp($platform)->access_token->getToken();
$cacheKey = "applets:" . $platform;
if (($cache = Laminas::$serviceManager->redisExtend->getRedisInstance()->get($cacheKey)) && !$refresh) {
$data = StringHelper::jsonDecode($cache);
return $this->RenderApiJson()->Success([
'last_version' => $data['version_list'][0]['user_version'],
'cached_at' => $data['cached_at']
]);
} else {
$response = CurlHelper::getMiniAppHistoryVersion($token['access_token']);
if (!$response) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "获取版本数据出错啦!");
}
$data = StringHelper::jsonDecode($response);
if ($data['errcode'] == 0) {
$data['cached_at'] = time();
Laminas::$serviceManager->redisExtend->getRedisInstance()->setex($cacheKey, 60*60*2, json_encode($data)); // 缓存两个小时
return $this->RenderApiJson()->Success([
'last_version' => $data['version_list'][0]['user_version'] ?? 99999, // 取不到给个默认值
'cached_at' => $data['cached_at']
]);
} else {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $data['errmsg']);
}
}
}
/**
* 用于微信公众号和受试者手机号绑定
* @url xxx.com/common/patient-mobile
*/
public function patientMobileAction()
{
$mobile = $this->params()->fromQuery('mobile');
$openid = $this->params()->fromQuery('openid');
$sign = $this->params()->fromQuery('sign');
if ($sign !== md5($mobile . self::SECRET_KEY)) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, 'sign error.');
}
// 不传openid 是查询当前手机号是否属于受试者
if (!$openid) {
if ($query = Laminas::$serviceManager->patient->fetchOne([
'where' => ['patient_tel' => $mobile, 'is_del' => 0]
])) {
if ($query['openid']) {
die('-1'); // 已经绑定用户了
} else {
die('1'); // 找不到手机号
}
}
die('0');
}
Laminas::$serviceManager->patient->isSetInfo(false)->update(['openid' => $openid], ['patient_tel' => $mobile]);
return $this->RenderApiJson()->Success();
}
public function editSendAction() {
$com = new Com();
// $id = $_POST['id'] ?:1;
$item_id = $_POST['item_id'] ?: 0;
$patient_id = $_POST['patient_id'] ?: 0;
$itemsig_id = $_POST['itemsig_id'] ?: 0;
$date = $_POST['date'] ? : 0;
if (empty($item_id) || empty($patient_id)) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '参数不正确');
//验证链接
if((strtotime(date('Y-m-d',$date)) != strtotime(date('Y-m-d'))) || empty($date)){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '信息已过期');
}
$whereMess['where'] = [
'is_del' => 0,
'item_id' => $item_id,
];
$whereMess['columns'] = ['item_id','content'];
$itemMessageSendInfos = $this->LocalService()->itemMessageSend->fetchOne($whereMess);
if (empty($itemMessageSendInfos)) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '后台推送新增表单还未设置');
// if (empty($itemMessageSendInfos)){
// return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '信息已过期');
// }
// $current_time = date('G');
// if ($current_time < $itemMessageSendInfos['send_time']){
// return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '信息已过期');
// }
$fieldId = implode(',',array_column(json_decode($itemMessageSendInfos['content'],true),'id'));
$itemMessageFieldData = $this->LocalService()->itemMessageField->fetchAll(['where' => 'is_del=0 and item_id='.$item_id.' and (id in('.$fieldId.') or parent in('.$fieldId.'))','order' => ['mess_order']]);
$relation = [];
if(!empty($itemMessageFieldData)){
$relationFieldDatas = [];
$relationFieldData = [];
$relationIdArr = [];
$relationId = array_filter(array_column($itemMessageFieldData,'relation_id'));
if (!empty($relationId)){
$relationIds = implode(',',$relationId);
$relationFieldData = $this->LocalService()->itemMessageField->fetchAll(['where' => 'is_del=0 and item_id='.$item_id.' and (id in('.$relationIds.') or parent in('.$relationIds.'))','order' => ['mess_order']]);
}
if(!empty($relationFieldData)){
$relationFieldData = $com->getTree($relationFieldData,0,0,2,'parent');
$relationIdArr = array_column($relationFieldData,'id');
}
$relationFieldDatas = $this->LocalService()->itemMessageSend->getPatientattrTemplate($relationFieldData);
$unsetArr = [];
foreach ($itemMessageFieldData as $itemMessageFieldDataK=>$itemMessageFieldDataV){
if (!empty($itemMessageFieldDataV['relation_id'])){
$relationIdData = explode(',',$itemMessageFieldDataV['relation_id']);
foreach ($relationFieldDatas as $relationFieldDatasK=>$relationFieldDatasV) {
if (in_array($relationFieldDatasV['id'],$relationIdData)){
// $relationFieldDatasV['prop'] = $getTypeCode[$itemMessageFieldDataV['id']];
$relationFieldDatasV['prop'] = $relationFieldDatasV['id'];//$itemMessageFieldDataV['parent'].'-'.$itemMessageFieldDataV['id'].'-'.$relationFieldDatasV['id'];
$relation[$itemMessageFieldDataV['parent']][$itemMessageFieldDataV['id']][] = $relationFieldDatasV;
}
}
}
if (in_array($itemMessageFieldDataV['id'],$relationIdArr)){
unset($itemMessageFieldData[$itemMessageFieldDataK]);
}
}
}
!empty($itemMessageFieldData) && $itemMessageFieldData = $com->getTree($itemMessageFieldData,0,0,2,'parent');
$FormFileDatas = $this->LocalService()->itemMessageSend->getPatientattrTemplate($itemMessageFieldData);
$FormFileData =array_values($this->Introduce('MessageSend',['item_id'=>$item_id,'messageSend'=>$FormFileDatas,'MINI_PATIENT'=>1]));
$itemMessageSendPatientWhere = [
'where' => 'is_del=0 and is_write=0 and item_id='.$item_id.' and patient_id='.$patient_id.' and FROM_UNIXTIME(create_time ,"%Y-%m-%d")="'.date('Y-m-d').'"',
'columns'=>['item_id','content','itemsig_id','patient_id','id'],
];
$itemMessageSendInfo = $this->LocalService()->itemMessageSendPatient->fetchOne($itemMessageSendPatientWhere);
if (!empty($itemMessageSendInfo)){
$itemInfoName = $this->LocalService()->itemInfo->getOneFieldVal('name','id='.$item_id)?:'';
$patientInfo = $this->LocalService()->patient->fetchOne(['where'=>'is_del=0 and id='.$patient_id,'columns'=>['id','patient_name','patient_number']]);
$itemMessageSendInfo['itemInfoName'] = $itemInfoName;
$itemMessageSendInfo['patient_name'] = '';
if (!empty($patientInfo)){
if (!empty($patientInfo['patient_name'])){
$itemMessageSendInfo['patient_name'] = $patientInfo['patient_name'];
}
if (!empty($patientInfo['patient_number'])){
$itemMessageSendInfo['patient_name'] .= '【'.$patientInfo['patient_number'].'】';
}
}
if (!empty($itemMessageSendInfo['content'])){
$itemMessageSendInfo['content'] = json_decode($itemMessageSendInfo['content'],true);
}else{
$itemMessageSendInfo['content'] = [];
}
}else{
$itemMessageSendInfo = ['is_write'=>1];
}
// if (empty($itemMessageSendInfo)){
// $whereMess['where'] = 'is_del=0 and item_id = ' . $item_id;
// $whereMess['columns'] = ['item_id','content'];
// $itemMessageSendInfo = $this->LocalService()->itemMessageSend->fetchOne($whereMess);
// if (!empty($itemMessageSendInfo)){
// $itemMessageSendInfo['id'] = 0;
// $itemMessageSendInfo['patient_id'] = $patient_id;
// $itemInfoName = $this->LocalService()->itemInfo->getOneFieldVal('name','id='.$item_id)?:'';
// $patientInfo = $this->LocalService()->patient->fetchOne(['where'=>'is_del=0 and id='.$patient_id,'columns'=>['id','patient_name','patient_number']]);
//
// $itemMessageSendInfo['itemInfoName'] = $itemInfoName;
// $itemMessageSendInfo['patient_name'] = '';
// if (!empty($patientInfo)){
// if (!empty($patientInfo['patient_name'])){
// $itemMessageSendInfo['patient_name'] = $patientInfo['patient_name'];
// }
// if (!empty($patientInfo['patient_number'])){
// $itemMessageSendInfo['patient_name'] .= '【'.$patientInfo['patient_number'].'】';
// }
// }
//
// if (!empty($itemMessageSendInfo['content'])){
// $itemMessageSendInfo['content'] = json_decode($itemMessageSendInfo['content'],true);
// }else{
// $itemMessageSendInfo['content'] = [];
// }
// }else{
// $itemMessageSendInfo = [];
// }
// }else{
// $itemMessageSendInfo = ['is_write'=>1];
// }
$data['itemMessageSendInfo'] = $itemMessageSendInfo;
$data['FormFileData'] =$FormFileData;
$data['relation'] =$relation;
return $this->RenderApiJson()->Success($data);
}
public function savePatientSendAction() {
$id = $newData['id'] = $_POST['id'] ?: 0;
$newData['item_id'] = $_POST['item_id'] ?: 0;
$newData['patient_id'] = $_POST['patient_id'] ?: 0;
$newData['itemsig_id'] = $_POST['itemsig_id'] ?: 0;
$newData['content'] = $_POST['content'] ?: '';
$newData['create_user_id'] = $newData['update_user_id'] = $_POST['user_id'] ?: 0;
$date = $_POST['date'] ? : 0;
$com = new Com();
if (empty($newData['item_id']) || empty($newData['content']) || empty($newData['patient_id'])){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '参数不正确');
}
//验证链接
if((strtotime(date('Y-m-d',$date)) != strtotime(date('Y-m-d'))) || empty($date)){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '信息已过期');
}
$itemMessageSendInfo = $this->LocalService()->itemMessageSend->fetchOne(['where'=>'is_del=0 and item_id='.$newData['item_id']]);
if (empty($itemMessageSendInfo)){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '信息已过期');
}
$current_time = date('G');
// if ($current_time < $itemMessageSendInfo['send_time']){
// return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '信息已过期');
// }
$checkSave = [
'item_id'=>$newData['item_id'],
'sendPatientData'=>$newData['content'],
];
//没有填写数据
// $resultCheckSave = $this->LocalService()->itemMessageSend->checkSend($checkSave);
// if (empty($resultCheckSave)) return $this->RenderApiJson()->Success();
$itemMessageSendPatientWhere = [
'where' => 'is_del=0 and item_id='.$newData['item_id'].' and patient_id='.$newData['patient_id'].' and FROM_UNIXTIME(create_time ,"%Y-%m-%d")="'.date('Y-m-d').'"',
'columns'=>['item_id','content','itemsig_id','patient_id','id'],
];
$itemMessageSendPatientInfo = $this->LocalService()->itemMessageSendPatient->fetchOne($itemMessageSendPatientWhere);
if(empty($itemMessageSendPatientInfo) || !empty($itemMessageSendPatientInfo['is_write'])) return $this->RenderApiJson()->Success();
$itemMessageFieldData = $this->LocalService()->itemMessageField->fetchAll(['where' => 'is_del=0 and item_id='.$newData['item_id'],'order' => ['mess_order']]);
$itemMsgParent = [];
$itemMsgParents = [];
if (!empty($itemMessageFieldData)){
$itemMsgParents = array_column($itemMessageFieldData,null,'id');
foreach ($itemMessageFieldData as $itemMessageFieldDataK=>$itemMessageFieldDataV){
if (empty($itemMessageFieldDataV['parent']) && $itemMessageFieldDataV['is_required'] == 1){
$itemMsgParent[] = $itemMessageFieldDataV['id'];
}
}
$itemMessageFieldData = $com->getTree($itemMessageFieldData,0,0,2,'parent');
}
// !empty($itemMessageFieldData) && $itemMessageFieldData = $com->getTree($itemMessageFieldData,0,0,2,'parent');
$FormFileDatas = $this->LocalService()->itemMessageSend->getPatientattrTemplate($itemMessageFieldData);
$contentField = $newData;
if (!empty($newData['content'])){
$newContentData = json_decode($newData['content'],true);
foreach ($newContentData as $newContentDataK=>$newContentDataV){
$var_name = isset($itemMsgParents[$newContentDataV['id']]['var_name'])?$itemMsgParents[$newContentDataV['id']]['var_name']:'';
$names = isset($itemMsgParents[$newContentDataV['id']]['name'])?$itemMsgParents[$newContentDataV['id']]['name']:'';
if (in_array($newContentDataV['id'],$itemMsgParent) && empty($newContentDataV['value'])){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '【'.$names.'】:不能为空');
}
$contentField[$var_name] = $newContentDataV['value'];
}
//必填写都填写则为已完成
// $newData['is_complete'] = 1;
$newData['is_write'] = 1;
unset($contentField['content']);
}
// echo '<pre>';print_r($contentField);die;
$FormFileData =$this->Introduce('MessageSendPatient',['item_id'=>$newData['item_id'],'messageSend'=>$FormFileDatas]);
// $newData['update_user_id'] = $newData['user_id'];
// $newData['create_user_id'] = $newData['user_id'];
empty($newData['id']) && $newData['id'] = $itemMessageSendPatientInfo['id'];
$newData['write_time'] = time();
// echo '<pre>';print_r($FormFileData);die;
$result = $this->LocalService()->itemMessageSendPatient->save($newData);
unset($newData['write_time']);
unset($newData['update_user_id']);
$realname = $this->LocalService()->adminUser->getOneFieldVal('realname','is_del=0 and id='.$newData['create_user_id'])?:'';
// unset($newData['create_user_id']);
$contentField['realname'] = $realname;
$contentField['data_type_flag'] = 1;
if (!empty($result)) $this->LocalService()->log->saveFileLog($newData['id'],'MessageSendPatient',$contentField,0,'暂无说明',$newData['item_id'],'',['item_id'=>$newData['item_id'],'messageSend'=>$FormFileData]);
return $this->RenderApiJson()->Success();
}
//引入
private function Introduce($formValidator, array $params = []){
$path=APP_PATH.'/formData/';
$fromMap=include $path.'formMap.php';
$fromData=include $path.ucfirst($formValidator).'Data.php';
if (!empty($fromData)){
if(is_callable($fromData)) return $fromData($params);
return $fromData;
}else{
return [];
}
}
}

View File

@ -0,0 +1,70 @@
<?php
namespace Application\Controller;
use Application\Common\StatusCode;
use Application\Form\project\AeForm;
use Application\Mvc\Controller\BasicController;
use Application\Common\Com;
use Application\Service\Log;
use Application\Common\Ocr;
use Laminas\Db\Sql\Predicate\Operator;
use Laminas\Mvc\Controller\AbstractActionController;
class CrontabController extends AbstractActionController {
private $ossPath = 'http://yikeen.oss-cn-beijing.aliyuncs.com';
//批量识别数据
public function manyReidentificationAction()
{
//附件===未锁定
$whereItemPatientworkannex['where'] = [
'lock_state' => 0,
'ocr_state' => 0,
'confirm_state' => 0,
'is_result' => 0,
'annex_type' => 1,
new Operator('ocr_id', Operator::OP_NE, 0)
];
$itemPatientworkannexData = $this->LocalService()->itemPatientworkannex->fetchAll($whereItemPatientworkannex);
if (empty($itemPatientworkannexData)){
return false;
}
$dictionarySetocrfieldData = $this->LocalService()->dictionarySetocrfield->getAllGroupType();
foreach ($itemPatientworkannexData as $itemPatientworkannexDataKey=>$itemPatientworkannexDataValue) {
//识别数据
$whereItemIdentificationresult['where'] = ['is_del' => 0, 'workannex_id' => $itemPatientworkannexDataValue['id']];
$itemIdentificationresultInfo = $this->LocalService()->itemIdentificationresult->fetchOne($whereItemIdentificationresult);
//识别模板设置数据
$whereDictionaryOcr['where'] = ['is_del' => 0, 'id' => $itemPatientworkannexDataValue['ocr_id']];
$whereDictionaryOcr['columns'] = ['id','name','key_val','separator'];
$dictionaryOcrInfo = $this->LocalService()->dictionaryOcr->fetchOne($whereDictionaryOcr);
if (empty($dictionaryOcrInfo) || empty($dictionaryOcrInfo['key_val']) || empty($dictionaryOcrInfo['separator']) || empty($itemPatientworkannexDataValue['annex_path'])){
continue;
}
$imgPath = $this->ossPath.$itemPatientworkannexDataValue['annex_path'];
$result = Ocr::ocr_result($imgPath, $dictionaryOcrInfo['key_val'], $dictionaryOcrInfo['separator'], $dictionarySetocrfieldData);
if ($result['error_code'] != 0) {
continue;
}
$upWorkannex['ocr_state'] = 1;
$upWorkannex['is_result'] = 1;
$upWorkannex['confirm_state'] = 1;
$upWorkannex['id'] = $itemPatientworkannexDataValue['id'];
$resultItemPatientworkannex = $this->LocalService()->itemPatientworkannex->save($upWorkannex);
$arr['content'] = json_encode($result);
$arr['workannex_id'] = $itemPatientworkannexDataValue['id'];
if (!empty($itemIdentificationresultInfo)){
$resultId = $arr['id'] = $itemIdentificationresultInfo['id'];
$resultItemIdentificationresult = $this->LocalService()->itemIdentificationresult->save($arr);
}else{
$resultId = $this->LocalService()->itemIdentificationresult->save($arr);
}
}
return true;
}
}

View File

@ -0,0 +1,211 @@
<?php
namespace Application\Controller;
use Application\Form\item\LogicModel;
use Application\Form\LogicFormModel;
use Application\Service\Extension\Helper\ArrayHelper;
use Application\Service\Extension\Helper\components\AnalysisHelper;
use Application\Service\Extension\Helper\FileHelper;
use Application\Service\Extension\Laminas;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;
class DashboardController extends AbstractActionController // BaseController
{
public function __construct()
{
// if (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'] === '/dashboard') {
// return;
// }
//
// Laminas::$serviceManager->identity->getId();
}
public function indexAction()
{
$view = new ViewModel();
$view->setTemplate('dashboard/index');
$view->setVariables([
'filesCount' => count(FileHelper::getFiles(APP_PATH . '/runtime/' . date('Y-m-d')))
]);
return $view;
}
public function fileTimestampAction(): ViewModel
{
$view = new ViewModel();
$view->setTemplate('dashboard/fileTimestamp');
$view->setVariables([
'files' => FileHelper::getFiles(APP_PATH . '/config')
]);
return $view;
}
public function apiFileTimestampAction()
{
$path = $this->params()->fromPost('path');
$files = FileHelper::getFiles(APP_PATH . '/' . trim($path, '/'));
$r = [];
foreach ($files as $file) {
$r[] = [
'path' => $file,
'timestamp' => date("Y-m-d H:i:s", filemtime($file))
];
}
return $this->RenderApiJson()->Success($r);
}
public function exceptionAction(): ViewModel
{
$view = new ViewModel();
$view->setTemplate('dashboard/exception');
$view->setVariables([
'files' => FileHelper::getFiles(APP_PATH . '/runtime/' . date('Y-m-d'))
]);
return $view;
}
public function apiExceptionAction(): ViewModel
{
$path = $this->params()->fromPost('date');
$files = FileHelper::getFiles(APP_PATH . '/runtime/' . trim($path, '/'));
return $this->RenderApiJson()->Success($files);
}
public function apiExceptionDetailAction(): ViewModel
{
$file = $this->params()->fromPost('path');
return $this->RenderApiJson()->Success([file_get_contents($file)]);
}
public function unitTestAction(): ViewModel
{
$view = new ViewModel();
$view->setTemplate('dashboard/unitTest');
// $view->setVariables([
// 'files' => FileHelper::getFiles(APP_PATH . '/runtime/' . date('Y-m-d'))
// ]);
return $view;
}
public function apiUnitTestAction(): ViewModel
{
system('php' . ' -d memory_limit=-1 ' . APP_PATH . '/vendor/bin/phpunit');die;
$view = new ViewModel();
$view->setTemplate('dashboard/unitTest');
// $view->setVariables([
// 'files' => FileHelper::getFiles(APP_PATH . '/runtime/' . date('Y-m-d'))
// ]);
return $view;
}
public function redisAction(): ViewModel
{
$view = new ViewModel();
$view->setTemplate('dashboard/redis');
// $view->setVariables([
// 'files' => FileHelper::getFiles(APP_PATH . '/runtime/' . date('Y-m-d'))
// ]);
return $view;
}
public function apiRedisAction()
{
$method = $this->params()->fromPost('params');
$params = explode(' ', $method);
$redisMethod = array_shift($params);
$val = Laminas::$serviceManager->redisExtend->getRedisInstance()->{$redisMethod}(...$params);
return $this->RenderApiJson()->Success(!is_array($val) ? array($val) : $val);
}
public function formLogAction()
{
$view = new ViewModel();
$view->setTemplate('dashboard/formLog');
return $view;
}
public function apiFormLogAction()
{
$contentId = $this->params()->fromPost('params');
$query = Laminas::$serviceManager->patientFormContentUpdatedLog->fetchAll([
'where' => [
'content_id' => $contentId
]
]) ?: [];
return $this->RenderApiJson()->Success($query);
}
public function analysisAction()
{
$view = new ViewModel();
$view->setTemplate('dashboard/analysis');
$val = $this->getAnalysisData();
$view->setVariables([
'data' => $val,
'title' => ArrayHelper::getColumn($val, 'name')
]);
return $view;
}
public function analysisResponseTimeAction()
{
$view = new ViewModel();
$view->setTemplate('dashboard/analysisResponseTime');
$val = $this->getAnalysisData();
$view->setVariables([
'data' => $val,
'title' => ArrayHelper::getColumn($val, 'name'),
]);
return $view;
}
private function getAnalysisData()
{
$res = $data = [];
for ($i = 0; $i < 24; $i++) {
$value = Laminas::$serviceManager->redisExtend->getRedisInstance()->hGetAll(AnalysisHelper::getRequestTimesKey($i));
foreach ($value as $url => $item) {
if (!isset($data[$url])) {
$data[$url] = array_fill(0, 24, 0);
}
$data[$url][$i] = $item;
}
}
foreach ($data as $url => $item) {
$slow = Laminas::$serviceManager->redisExtend->getRedisInstance()->lLen(AnalysisHelper::getResponseTimeKey() . ':' . $url);
$total = array_sum($item);
$res[] = [
'name' => $url,
'data' => $item,
'total' => $total,
'slow' => $slow,
'normal' => $total - $slow
];
}
return $res;
}
public function apiAnalysisResponseTimeAction()
{
$url = $this->params()->fromQuery('url');
$val = Laminas::$serviceManager->redisExtend->getRedisInstance()->lRange(AnalysisHelper::getResponseTimeKey() . ':' . $url, 0, -1);
return $this->RenderApiJson()->Success($val);
}
}

View File

@ -0,0 +1,63 @@
<?php
/**
*
* @authorllbjj
* @DateTime2024/2/2 13:27
* @Description
*
*/
namespace Application\Controller\Drug;
use Laminas\Config\Factory;
class DrugController extends \Laminas\Mvc\Controller\AbstractActionController
{
public function patientDrugAction() {
return $this->RenderApiJson()->Success(
$this->LocalService()->tmpDoctoradvicelock->getpatientdrug()
);
}
public function drugLockAction() {
$patient_id = $this->params()->fromPost('patient_id', 0);
$drug_id = $this->params()->fromPost('drug_id', 0);
if(empty($patient_id) || empty($drug_id)) return $this->RenderApiJson()->Success();
return $this->RenderApiJson()->Success(
$this->LocalService()->tmpDoctoradvicelock->getlockdrugData($patient_id, $drug_id)
);
}
public function drugDayAction() {
$patient_id = $this->params()->fromPost('patient_id', 0);
$drug_id = $this->params()->fromPost('drug_id', 0);
if(empty($patient_id) || empty($drug_id)) return $this->RenderApiJson()->Success();
return $this->RenderApiJson()->Success(
$this->LocalService()->tmpDoctoradviceformal->getdormaldrugData($patient_id,$drug_id)
);
}
public function drugDaySaveAction() {
$drugDayData = $this->params()->fromPost('drugDay', []);
foreach($drugDayData as $drugDay) {
$this->LocalService()->tmpDoctoradviceformal->save($drugDay);
}
return $this->RenderApiJson()->Success();
}
public function arrangeDrugSaveAction() {
$fileName = $this->params()->fromPost('fileName', '');
$arrangeDrug = $this->params()->fromPost('arrangeDrug', []);
if(!file_exists(APP_PATH . '/data/drug/')) {
mkdir(APP_PATH . '/data/drug/', 0777, true);
}
Factory::toFile(APP_PATH . '/data/drug/'.$fileName.'.php', $arrangeDrug);
return $this->RenderApiJson()->Success();
}
}

View File

@ -0,0 +1,91 @@
<?php
namespace Application\Controller;
use Application\Common\StatusCode;
use Application\Form\item\LogicModel;
use Application\Form\item\patient\PatientFormModel;
use Application\Form\LogicFormModel;
use Application\Form\project\AeForm;
use Application\Form\project\LogicAeForm;
use Application\Mvc\Controller\BasicController;
use Application\Service\DB\AbstractDb;
use Application\Service\DB\Db;
use Application\Service\DB\Dictionary\FormField;
use Application\Service\DB\Dictionary\FormGroup;
use Application\Service\DB\Item\PatientFormLogicErrorQuery;
use Application\Service\DB\Item\Signatory;
use Application\Service\Extension\CheckLogic\CheckLogicApplication;
use Application\Service\Extension\CheckLogic\ExpressionGenerator;
use Application\Service\Extension\ErrorHandler;
use Application\Service\Extension\Formatter\Formatter;
use Application\Service\Extension\Formatter\LogicErrorFormatter;
use Application\Service\Extension\Helper\ArrayHelper;
use Application\Service\Extension\Helper\CurlHelper;
use Application\Service\Extension\Helper\FileHelper;
use Application\Service\Extension\Helper\StringHelper;
use Application\Service\Extension\Helper\VarDumperHelper;
use Application\Service\Extension\Laminas;
use Application\Service\Extension\Validator\ValidatorApplication;
use Laminas\Db\ResultSet\ResultSet;
use Laminas\Db\Sql\Expression;
use Laminas\Db\Sql\Predicate\IsNotNull;
use Laminas\Db\Sql\Predicate\Like;
use Laminas\Db\Sql\Predicate\Operator;
use Laminas\Db\Sql\Predicate\Predicate;
use Laminas\Db\Sql\Select;
use Laminas\Db\Sql\Sql;
use Laminas\Db\TableGateway\Feature\EventFeatureEventsInterface;
use Laminas\Mvc\Controller\AbstractActionController;
class ExposeController extends AbstractActionController // BaseController
{
public function reportAction()
{
// type , content_id
$changeId = intval($this->params()->fromPost('change_id'));
$isCollectDate = intval($this->params()->fromPost('is_collectDate'));
$query = Laminas::$serviceManager->itemCsae->fetchOne(['where' => ['patient_change_id' => $changeId, 'is_del' => 0, 'is_ae_sure' => 1]]);
$type = $query['ae_type'] ?? false;
$csaeId = $query['id'] ?? false;
$v = new ValidatorApplication($this->params()->fromPost());
$v->attributes['type'] = $type;
$model = new LogicAeForm($v);
Db::beginTransaction();
// 属于已有ae
if ($type == 5) {
$model->updateAeType($csaeId);
} if ($type == 6) { // 属于新增ae
$model->updateAeType($csaeId);
}
if ($isCollectDate) {
Laminas::$serviceManager->itemCsae->isAnnulDate($changeId);
} else {
Laminas::$serviceManager->itemCsae->isAnnulChecknameSaveAction($changeId);
}
Db::commit();
return $this->RenderApiJson()->Success();
}
public function fileTimestampAction()
{
$directory = APP_PATH . '/' . ($this->getRequest()->getQuery('path') ?: 'module/Application');
$files = FileHelper::getFiles($directory);
foreach ($files as $file) {
$fileLastModifiedTime = filemtime($file);
$fileLastModifiedTimeFormatted = date("Y-m-d H:i:s", $fileLastModifiedTime);
$file = strtr($file, [
APP_PATH => ''
]);
echo "{$file} [{$fileLastModifiedTimeFormatted}]" . PHP_EOL;
}
// 输出结果
die;
}
}

View File

@ -0,0 +1,495 @@
<?php
namespace Application\Controller;
use Application\Common\StatusCode;
use Application\Form\FieldForm;
use Application\Form\FormForm;
use Application\Form\research\ContentForm;
use Application\Mvc\Controller\BasicController;
use Application\Service\DB\Dictionary\Form;
use Application\Service\Extension\Formatter\Formatter;
use Application\Service\Extension\Formatter\FormFormatter;
use Application\Service\Extension\Helper\StringHelper;
use Application\Service\Extension\Laminas;
use Application\Service\Extension\Validator\FormValidator;
use Application\Service\Extension\Validator\ValidatorApplication;
use Application\Service\Logs;
use Exception;
use Laminas\Db\Sql\Expression;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Validator\Between;
use Laminas\Validator\Db\NoRecordExists;
use Laminas\Validator\Db\RecordExists;
use Laminas\Validator\Digits;
use Laminas\Validator\Exception\InvalidArgumentException;
use Laminas\Validator\GreaterThan;
use Laminas\Validator\InArray;
use Laminas\Validator\LessThan;
use Laminas\Validator\NotEmpty;
use Laminas\Validator\StringLength;
use Laminas\View\Model\JsonModel;
use Laminas\View\Model\ViewModel;
class FieldController extends BasicController
{
/** @var string 表单字段配置key */
public const FORM_VALIDATOR = 'itemFormField';
public const LOG_TARGET = 'DictionaryFormField';
/**
* 字段列表
* @doc https://www.showdoc.com.cn/p/e986fbe555c06367a9a8b96459908abd
* @url http://xx.com/dictionary/form/field
* @return JsonModel
* @throws Exception
*/
public function indexAction(): JsonModel
{
$validator = new ValidatorApplication();
// TODO id验证
$validator->attach(
[['version', 'id'], 'required'],
);
if (!$validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $validator->getFirstErrorToString());
}
$data = $this->LocalService()->dictionaryFormVersion->getField([
'form_id' => $validator->attributes['id'],
'version' => $validator->attributes['version'],
]);
return $this->RenderApiJson()->Success($data);
}
/**
* 版本列表
* @doc https://www.showdoc.com.cn/p/38faccc31ac49c9c8e0cc678bb6d56cd
* @url http://xx.com/dictionary/field/version
* @return JsonModel
*/
public function versionAction(): JsonModel
{
$validator = new ValidatorApplication();
$validator->attach(
[['id'], 'required']
);
if (!$validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $validator->getFirstErrorToString());
}
// 获取所有版本
// 新增无版本, 返回默认值
$query = $this->LocalService()->dictionaryFormVersion->fetchAll([
'columns' => ['version as label', 'version as value'],
'where' => ['form_id' => $validator->attributes['id']]
]) ?: [['label' => 'v1.0', 'value' => 'v1.0']];
return $this->RenderApiJson()->Success($query);
}
/**
* 创建表单
* @doc https://www.showdoc.com.cn/p/624d4f2f3c33f1e7b8e0f5adf6a2f776
* @url http://xx.com/api/dictionary/field/create
* @return JsonModel
* @throws Exception
*/
public function createAction(): JsonModel
{
$this->validator->attach(
[['form_id'], 'required'],
[['form_id'], 'exist', 'targetClass' => $this->LocalService()->dictionaryForm, 'targetAttribute' => 'id'], // 验证 form_id 是否存在
[['form_type'], 'default', 'value' => FieldForm::FORM_CONFIG_TEXT],
[['is_list', 'is_booked_time','is_hide','dicform_id'], 'default', 'value' => 0],
[['is_export'], 'default', 'value' => 1],
[['value'], 'function', 'targetClass' => FieldForm::class, 'method' => 'invalidRadioValue'],
[['is_booked_time'], 'function', 'targetClass' => FieldForm::class, 'method' => 'invalidBookedTime']
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
// 前端传的 `default` 字段可能会有前缀, 需要处理一下
$default = 'default' . $this->validator->attributes['type'];
if (isset($this->validator->attributes[$default])) {
$this->validator->attributes['default'] = $this->validator->attributes[$default];
}
if(isset($this->validator->attributes['checkname_id'])){
if(is_array($this->validator->attributes['checkname_id'])){
$this->validator->attributes['checkname_id'] = !empty($this->validator->attributes['checkname_id']) ? implode(',',$this->validator->attributes['checkname_id']) : '';
}else{
$this->validator->attributes['checkname_id'] = !empty($this->validator->attributes['checkname_id']) ? trim($this->validator->attributes['checkname_id'],',') : '';
}
}
//选项无关联信息时,关联分类、关联类型默认为空值
if(isset($this->validator->attributes['relation_information']) && empty($this->validator->attributes['relation_information'])){
$this->validator->attributes['relation_classification'] = 0;
$this->validator->attributes['relation_type'] = 0;
}
$model = new FieldForm($this->validator);
if ($this->validator->attributes['id']) {
//先验证是否可以修改
$model->editCheck();
//查询选项值 判断本次是否修改了表单选项的字典项 如果修改了 提示先去删除旧的选项值 再进行修改
$childen_count = $this->LocalService()->dictionaryFormField->getCount([
'is_del' => 0,
'parent' => $this->validator->attributes['id'],
]);
$oldform_id = $this->LocalService()->dictionaryFormField->getOneFieldVal('dicform_id',[
'id' => $this->validator->attributes['id'],
]);
$oldform_id = !empty($oldform_id) ? $oldform_id : 0;
if($childen_count > 0 && $this->validator->attributes['dicform_id'] != $oldform_id){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '请先删除旧的选项值再进行修改选项字典!');
}
$model->editField();
//处理选项值
if($childen_count == 0 && isset($this->validator->attributes['dicform_id']) && !empty($this->validator->attributes['dicform_id'])){
//查询对应的选项值
$where_value = [
'where'=> [
'is_del' => 0,
'form_id' => $this->validator->attributes['dicform_id'],
],
'columns'=>['id','value_name','option_value','option_variable','is_score','score_value']
];
$value_datas = $this->LocalService()->dictionaryLevervalue->fetchAll($where_value);
if(!empty($value_datas)){
$i = 1;
foreach ($value_datas as $value_data){
$i++;
$res =[
'parent' => $this->validator->attributes['id'],
'name' => $value_data['value_name'], //选项名称
'var_name' => $value_data['option_variable'], //变量名
'value' => $value_data['option_value'], //选项值
'is_check' => 0, //是否默认选中
'is_score' => $value_data['is_score'], //分值选项
'score' => $value_data['score_value'], //分值
'form_id' => $this->validator->attributes['form_id'],
'form_type' => 'RADIO', //分值选项
'version' => $this->validator->attributes['version'],
'order' => $i,
];
//print_r($res);die;
//选项值入库
$newresult_id = $model->createField($res,1);
$this->LocalService()->log->saveFileLog(
$newresult_id,
self::LOG_TARGET . '.' . $this->validator->attributes['form_type'] . '.form',
$this->validator->attributes,
Logs::OPERATE_CREATE,
'创建字典项表单字段'
);
}
}
}
$this->LocalService()->log->saveFileLog(
$this->validator->attributes['id'],
self::LOG_TARGET . '.' . $this->validator->attributes['form_type'] . '.form',
$this->validator->attributes,
Logs::OPERATE_EDIT,
'编辑字典项表单字段'
);
} else {
$result_id = $model->createField();
$res = [];
//判断是否选择了表单选项的字典项 选了的话 把选项值直接带过来保存到本次表单字段的子集中
if(isset($this->validator->attributes['dicform_id']) && !empty($this->validator->attributes['dicform_id'])){
//查询对应的选项值
$where_value = [
'where'=> [
'is_del' => 0,
'form_id' => $this->validator->attributes['dicform_id'],
],
'columns'=>['id','value_name','option_value','option_variable','is_score','score_value']
];
$value_datas = $this->LocalService()->dictionaryLevervalue->fetchAll($where_value);
if(!empty($value_datas)){
$i = 1;
foreach ($value_datas as $value_data){
$i++;
$res =[
'parent' => $result_id,
'name' => $value_data['value_name'], //选项名称
'var_name' => $value_data['option_variable'], //变量名
'value' => $value_data['option_value'], //选项值
'is_check' => 0, //是否默认选中
'is_score' => $value_data['is_score'], //分值选项
'score' => $value_data['score_value'], //分值
'form_id' => $this->validator->attributes['form_id'],
'form_type' => 'RADIO', //分值选项
'version' => $this->validator->attributes['version'],
'order' => $i,
];
//print_r($res);die;
//选项值入库
$newresult_id = $model->createField($res,1);
$this->LocalService()->log->saveFileLog(
$newresult_id,
self::LOG_TARGET . '.' . $this->validator->attributes['form_type'] . '.form',
$this->validator->attributes,
Logs::OPERATE_CREATE,
'创建字典项表单字段'
);
}
}
}
$this->LocalService()->log->saveFileLog(
$result_id,
self::LOG_TARGET . '.' . $this->validator->attributes['form_type'] . '.form',
$this->validator->attributes,
Logs::OPERATE_CREATE,
'创建字典项表单字段'
);
}
return $this->RenderApiJson()->Success();
}
/**
* Notes: 处理旧的研究分层的字段数据 手写 和系统分配的默认显示字段
* @param
* @return
* @author haojinhua
* @date 2025-02-24
*/
public function setolddataAction(){
//查询所有小项目id
$item_ids = $this->LocalService()->itemInfo->fetchCol('id','is_del= 0 and fid > 0');
//查询所有小项目中的随机分组类型的表单
$randomgroup_id = $this->LocalService()->dictionaryFormGroup->getOneFieldVal('id', 'is_del = 0 and code = "RDG"');
//查询所有随机分组的表单
$form_ids = $this->LocalService()->itemForm->fetchCol('id',[
'is_del' => 0,
'group_id' => $randomgroup_id,
'item_id' => StringHelper::toArray($item_ids),
]);
//字段id信息
$form_filed_infos = $this->LocalService()->itemFormField->fetchAll([
'where' => [
'is_del' => 0,
'form_id' => StringHelper::toArray($form_ids),
'type' => 12
],
'columns'=>['id','form_id']
]);
if(!empty($form_filed_infos)){
foreach ($form_filed_infos as $form_filed_info){
$var_name = $form_filed_info['var_name'];
if(in_array($var_name,['RANDOM_GROUP_CUSTOM', 'RANGC'])){
//手写随机分组
$show_name = '随机号';
}else{
//系统分配
$show_name = '随机号/方案分组';
}
//修改随机号字段名称信息及缓存表
$this->LocalService()->itemFormField->updateField($form_filed_info['id'], 'showfiled_name', $show_name);
$v = $this->LocalService()->itemForm->buildFieldVersion($form_filed_info['form_id']);
$this->LocalService()->itemFormVersion->update(['field' => $v], ['form_id' => $form_filed_info['form_id']]);
}
echo "处理完成!";die;
}
}
/**
* Notes:处理itemFormVersion 表中历史数据增加是否隐私字段的值
* @param
* @return
* @author haojinhua
* @date 2025-03-31
*/
public function setversiondataAction(){
//查询所有小项目id
$item_ids = $this->LocalService()->itemInfo->fetchCol('id','is_del= 0 and fid > 0');
//查询所有小项目中的常规识别类型的表单
$gcogroup_id = $this->LocalService()->dictionaryFormGroup->getOneFieldVal('id', 'is_del = 0 and code = "GCO"');
//查询所有随机分组的表单
$form_ids = $this->LocalService()->itemForm->fetchCol('id',[
'is_del' => 0,
'group_id' => $gcogroup_id,
'item_id' => StringHelper::toArray($item_ids),
]);
foreach ($form_ids as $form_id){
$v = $this->LocalService()->itemForm->buildFieldVersion($form_id);
}
echo "处理完成!";die;
}
/**
* 添加版本
* @doc https://www.showdoc.com.cn/p/28696c346fb0381c8b38250b30929375
* @url http://xx.com/dictionary/field/addVersion
* @return JsonModel
* @throws Exception
*/
public function addVersionAction(): JsonModel
{
$validator = new ValidatorApplication();
$validator->attach(
[['version', 'form_id'], 'class' => new NotEmpty(), 'message' => fn($attr) => "{$attr}不能为空"]
);
if (!$validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, current($validator->getErrors()));
}
$form = [
'version' => $validator->attributes['version'],
'field' => '[]',
'form_id' => $validator->attributes['form_id'],
];
$query = $this->LocalService()->dictionaryFormVersion->fetchOne([
'where' => [
'version' => $validator->attributes['version'],
'form_id' => $validator->attributes['form_id']
]
]);
if ($query) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '版本号重复啦~~');
}
$this->LocalService()->dictionaryFormVersion->insert($form);
return $this->RenderApiJson()->Success();
}
/**
* 表单详情
* @doc https://www.showdoc.com.cn/p/45af2714da57a616fcb21b118c25fa98
* @url http://xx.com/dictionary/field/view
* @return JsonModel
* @throws Exception
*/
public function viewAction(): JsonModel
{
$validator = new ValidatorApplication();
$validator->attach(
[['id', 'form_type', 'form_id'], 'required', 'strict' => true], // 验证参数是否为 null
[['form_id'], 'integer'], // 验证 form_id 是否为整数
[['form_id'], 'exist', 'targetClass' => $this->LocalService()->dictionaryForm, 'targetAttribute' => 'id'] // 验证 form_id 是否存在
);
if (!$validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $validator->getFirstErrorToString());
}
$model = new FieldForm($validator);
$query = $model->view() ?: ['order' => $this->getOrder()];
return $this->RenderApiJson()->Success($query, 'OK', [
'FormFileData' => $model->getFieldConfig(),
]);
}
/**
* 获取order
* @return int
*/
protected function getOrder(): int
{
return ($this->LocalService()->dictionaryFormField->getCount(['form_id' => $this->validator->attributes['form_id']]) + 1) * 10;
}
/**
* @param string $type
* @param string $validatorName
* @return mixed
*/
protected function getFieldConfig(string $type = '', string $validatorName = 'DictionaryFormField')
{
$config = include Laminas::$app->getConfig()['formValidator'][$validatorName];
$default = FieldForm::FORM_CONFIG_TEXT;
if ($type) {
$default = $type;
}
$formType = $this->LocalService()->dictionaryForm->fetchOne(['where' => ['id' => $this->validator->attributes['form_id']]])['type'];
if ($formType == Form::FORM_TYPE_SINGLE) {
unset($config[$default]['form']['is_list']);
}
$config[$default]['form'] = array_values($config[$default]['form'] ?? []);
return $config[$default];
}
/**
* 删除字段
* @doc https://www.showdoc.com.cn/p/6c88b2eada517628bfdc3ba0d87ce931
* @url http://xx.com/dictionary/field/del
* @return JsonModel
* @throws Exception
*/
public function delAction(): JsonModel
{
$this->validator->attach(
[['id'], 'required'],
[['id'], 'function', 'targetClass' => FieldForm::class, 'method' => 'invalidDeleteId']
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
$model = new FieldForm($this->validator);
$model->delete();
$this->LocalService()->log->saveFileLog($this->validator->attributes['id'], self::LOG_TARGET, $this->validator->attributes, Logs::OPERATE_DELETE, '删除字段');
return $this->RenderApiJson()->Success();
}
public function getRelationInformationAction()
{
$this->validator->attach(
[['type'], 'required'],
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
if ($this->validator->attributes['type'] == 0) {
return $this->RenderApiJson()->Success([
['label' => '无关联信息', 'value' => '0']
]);
} elseif ($this->validator->attributes['type'] == 1) { // 表单
$query = $this->LocalService()->dictionaryForm->fetchAll([
'columns' => [ new Expression('name as label'),new Expression('id as value')],
'where' => ['is_del' => 0]
]);
return $this->RenderApiJson()->Success($query);
} elseif ($this->validator->attributes['type'] == 2) { // 属性
$query = Laminas::$serviceManager->dictionaryFormVersion->getField([
'form_id' => $this->validator->attributes['form_id'],
'version' => 'v1.0'
], true);
$options[] = ['label' => '无关联信息', 'value' => '0'];
foreach ($query as $v) {
$options[] = ['label' => $v['name'], 'value' => $v['id']];
}
return $this->RenderApiJson()->Success($options);
}
}
}

View File

@ -0,0 +1,229 @@
<?php
namespace Application\Controller;
use Application\Common\Enum;
use Application\Common\StatusCode;
use Application\Form\item\FormForm;
use Application\Mvc\Controller\BasicController;
use Application\Service\DB\Db;
use Application\Service\Extension\Formatter\Formatter;
use Application\Service\Extension\Formatter\FormFormatter;
use Application\Service\Extension\Formatter\FormViewFormatter;
use Application\Service\Extension\Helper\ArrayHelper;
use Application\Service\Extension\Laminas;
use Application\Service\Extension\Validator\ValidatorApplication;
use Application\Service\Logs;
use Exception;
use Laminas\View\Model\JsonModel;
/**
* 字典项设置 - 表单设置
*/
class FormController extends BasicController
{
/** @var string 表单字段配置key */
public const FORM_VALIDATOR = 'DictionaryForm';
public const LOG_TARGET = 'DictionaryForm';
/**
* 获取表单设置列表
* @doc https://www.showdoc.com.cn/p/757c59c613bc3c71675699d33694c165
* @url http://xx.com/dictionary/form
* @return JsonModel
*/
public function indexAction(): JsonModel
{
// 表单类型id
$form_group_id = $this->params()->fromPost('form_group_id', '');
// 表单tpye
$form_type = $this->params()->fromPost('form_type', '');
// 表单检索条件
$formWhereArr = ['is_del' => 0];
if($form_group_id) $formWhereArr['group_id'] = $form_group_id;
if($form_type !== '') $formWhereArr['type'] = $form_type;
$data = $this->LocalService()->dictionaryForm->fetchAllWithPagination([
'order' => ['order ASC'],
'columns' => ['id as parent', 'id', 'group_id', 'name', 'type', 'order'],
'where' => $formWhereArr
]);
Formatter::format($data['data'], new FormFormatter());
return $this->RenderApiJson()->Success($data['data'], 'OK', [
'total' => $data['count']
]);
}
/**
* 创建表单
* @doc https://www.showdoc.com.cn/p/e0d7e9989e501ccbfd039af9d025e572
* @url http://xx.com/dictionary/form/create
* @return JsonModel
* @throws Exception
*/
public function createAction(): JsonModel
{
$validator = new ValidatorApplication();
$validator->attach(
[[], 'form', 'config' => self::FORM_VALIDATOR],
[['reference_file'], 'default', 'value' => '[]'],
[['group_id'], 'exist', 'targetClass' => $this->LocalService()->dictionaryFormGroup, 'targetAttribute' => 'id'],
[['name'], 'function', 'targetClass' => \Application\Form\FormForm::class, 'method' => 'invalidCreateName'],
[['checklist_id'], 'function', 'targetClass' => \Application\Form\FormForm::class, 'method' => 'invalidCheckListId'],
);
if (!$validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $validator->getFirstErrorToString());
}
$model = new \Application\Form\FormForm($validator);
if ($validator->attributes['id']) {
$model->editForm();
$this->LocalService()->log->saveFileLog($this->validator->attributes['id'], self::LOG_TARGET . '.form', $this->validator->attributes, Logs::OPERATE_EDIT, '编辑表单');
} else {
$this->LocalService()->log->saveFileLog($model->createForm(), self::LOG_TARGET . '.form', $this->validator->attributes, Logs::OPERATE_CREATE, '创建表单');
}
return $this->RenderApiJson()->Success();
}
/**
* 表单详情
* @doc https://www.showdoc.com.cn/p/e4c896652e7ae80c5560851e8ec8c171
* @url http://xx.com/dictionary/form/view
* @return JsonModel
* @throws Exception
*/
public function viewAction(): JsonModel
{
$validator = new ValidatorApplication();
$query = $this->LocalService()->dictionaryForm->fetchOne([
'columns' => [
'id', 'group_id', 'name', 'type', 'order', 'is_required', 'checklist_id', 'finish_condition',
'is_show', 'show_type', 'reference_file', 'rdg_type', 'var_name', 'can_patient_write', 'is_handwritten_signature',
'ds_stage','identification_edit'
],
'where' => ['id' => $validator->attributes['id']]
]) ?: ['order' => $this->getOrder()];
Formatter::format($query, new FormViewFormatter());
return $this->RenderApiJson()->Success($query, 'OK', [
'FormFileData' => ($this->getFieldConfig())
]);
}
/**
* 删除表单
* @doc https://www.showdoc.com.cn/p/2ed2ef0a8894ed47b8226d6daed08634
* @url http://xx.com/dictionary/form/del
* @return JsonModel
* @throws Exception
*/
public function delAction(): JsonModel
{
$validator = new ValidatorApplication();
$this->LocalService()->dictionaryForm->update([
'is_del' => 1
], [
'id' => $validator->attributes['id']
]);
$this->LocalService()->dictionaryFormField->update([
'is_del' => 1
], [
'form_id' => $validator->attributes['id']
]);
$this->LocalService()->log->saveFileLog($this->validator->attributes['id'], self::LOG_TARGET . '.form', $this->validator->attributes, Logs::OPERATE_DELETE, '删除表单');
return $this->RenderApiJson()->Success();
}
/**
* 获取字典项页面表单配置
* @return mixed
*/
protected function getFieldConfig(string $formValidator = self::FORM_VALIDATOR)
{
$config = include Laminas::$app->getConfig()['formValidator'][$formValidator];
$config['form'] = array_values($config['form']);
return $config;
}
protected function getOrder()
{
return $this->LocalService()->dictionaryForm->getMaxOrder('order');
}
/**
* 表单预览页面~
*/
public function previewAction()
{
$id = $this->params()->fromPost('id');
if (!$id) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '请传入正确的参数');
}
$query = $this->LocalService()->dictionaryForm->fetchOne([
'where' => ['id' => $id]
]);
return $this->RenderApiJson()->Success(ArrayHelper::merge($this->LocalService()->dictionaryForm->getPreviewConfig($id), [
'type' => $query['type'],
'show_type' => $query['show_type'] ?: 'right',
]));
}
/**
* 选择表单列表
*/
public function copyAction()
{
$this->validator->attach(
[['item_id'], 'required']
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
$model = new \Application\Form\FormForm($this->validator);
$data = $model->getCopyList();
return $this->RenderApiJson()->Success($data['data'], 'OK', [
'total' => $data['total']
]);
}
/**
* 选择表单
* @url
* @doc
* @return JsonModel
* @throws Exception
*/
public function copyToAction(): JsonModel
{
$this->validator->attach(
[['id', 'item_id'], 'required'],
[['id'], 'exist', 'targetClass' => $this->LocalService()->dictionaryForm, 'targetAttribute' => ['id']],
[['item_id'], 'exist', 'targetClass' => $this->LocalService()->itemInfo, 'targetAttribute' => ['id']],
[['id'], 'function', 'targetClass' => \Application\Form\FormForm::class, 'method' => 'invalidCopyId']
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
$model = new \Application\Form\FormForm($this->validator);
$model->copyTo();
return $this->RenderApiJson()->Success();
}
}

View File

@ -0,0 +1,183 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/6/1 11:40
* @Description 表单管理 - 表单类型管理
*
*/
namespace Application\Controller;
use Application\Common\Com;
use Application\Common\StatusCode;
use Application\Mvc\Controller\BasicController;
use Laminas\Db\Sql\Predicate\Operator;
use Laminas\Stdlib\ArrayUtils;
class FormgroupController extends BasicController
{
/**
* Notes: 左侧列表数据
* User: llbjj
* DateTime: 2022/6/1 20:51
*
* @return \Laminas\View\Model\JsonModel
*/
public function treelistAction(){
$formgroupWhere = 'is_del = 0';
$formgroupDatas = $this->LocalService()->dictionaryFormGroup->fetchAll([
'where' => $formgroupWhere,
'columns' => ['id', 'name', 'code'],
'order' => 'order',
]);
return $this->RenderApiJson()->Success($formgroupDatas);
}
/**
* Notes: 表单类型列表
* User: llbjj
* DateTime: 2022/6/1 11:41
*
*/
public function listAction(){
$searchField = [];
$searchField = $this->params()->fromPost();
$limit = $searchField['limit'] ?? 10;
$page = $searchField['page'] ?? 1;
$offset = ($page - 1) * $limit;
$formgroupWhere = [
'is_del' => 0
];
//表单类型列表检索表单
$DictionaryFormGroupSearchFormData = $this->Introduce('DictionaryFormGroup')['listSearch'];
$searchFormFieldData = array_values($DictionaryFormGroupSearchFormData);
// 根据检索创建where条件
if(!empty($searchField)) $formgroupWhere = ArrayUtils::merge($formgroupWhere, Com::CreateSearchWhere($searchField, $DictionaryFormGroupSearchFormData));
//表单类型总数
$formgroupCount = $this->LocalService()->dictionaryFormGroup->getCount($formgroupWhere);
//表单类型列表信息
$formgroupDatas = $this->LocalService()->dictionaryFormGroup->fetchAll([
'where' => $formgroupWhere,
'columns' => ['id', 'name', 'code', 'order'],
'order' => 'order',
'limit' => $limit,
'offset' => $offset
]);
return $this->RenderApiJson()->Success($formgroupDatas, '', ['total' => $formgroupCount, 'searchFormFieldData' => $searchFormFieldData]);
}
/**
* Notes: 表单类型增改
* User: llbjj
* DateTime: 2022/6/1 11:42
*
*/
public function editAction(){
$id = $this->params()->fromPost('id', 0);
$formFieldData = array_values($this->Introduce('DictionaryFormGroup')['editForm']);
$formGroupData = [];
if(!empty($id)){
$formGroupData = $this->LocalService()->dictionaryFormGroup->fetchOne([
'where' => [
'is_del' => 0,
'id' => $id,
],
'columns' => ['id', 'name', 'code', 'order']
]);
}else{
$formGroupData['order'] = $this->LocalService()->dictionaryFormGroup->getMaxOrder('order');
}
return $this->RenderApiJson()->Success($formGroupData, '', ['formFieldData' => $formFieldData]);
}
/**
* Notes: 保存表单类型信息
* User: llbjj
* DateTime: 2022/6/1 11:42
*
*/
public function saveAction(){
if($this->getRequest()->isPost()){
$this->Check('DictionaryFormGroup.editForm');
$dictionaryFormGroupSv = $this->LocalService()->dictionaryFormGroup;
$submitData = $this->params()->fromPost();
if(isset($submitData['old_data_str'])) unset($submitData['old_data_str']);
$id = 0;
$oper_type = 0;
if(!empty($submitData['id'])){
// 编辑检测信息是否存在
if(!$dictionaryFormGroupSv->getCount([
'id' => $submitData['id'],
'is_del' => 0
])) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '信息不存在!');
$id = $submitData['id'];
$oper_type = 1;
}else{
$submitData['is_del'] = 0;
}
// 验证名称是否重复
$dictionaryFormGroupSv->check_field_repeat('name', $submitData['name'], [
'is_del' => 0,
new Operator('id', Operator::OP_NE, $id)
], '表单类型名称【'.$submitData['name'].'】已存在!');
// 验证编码是否重复
$dictionaryFormGroupSv->check_field_repeat('code', $submitData['code'], [
'is_del' => 0,
new Operator('id', Operator::OP_NE, $id)
], '表单类型编码【'.$submitData['code'].'】已存在!');
$result = $dictionaryFormGroupSv->save($submitData);
$event_id = $id ?: $result;
if($result) $this->LocalService()->log->saveFileLog($event_id, 'DictionaryFormGroup.editForm', $submitData, $oper_type);
return $this->RenderApiJson()->Success(['id' => $event_id]);
}else{
return $this->RenderApiJson()->Error(StatusCode::E_ACCESS);
}
}
/**
* Notes: 删除表单类型 - 表单类型下已有表单信息,则不可删除
* User: llbjj
* DateTime: 2022/6/1 11:43
*
*/
public function deleteAction(){
if($this->getRequest()->isPost()){
$id = $this->params()->fromPost('id', 0);
$dictionaryFormGroupSv = $this->LocalService()->dictionaryFormGroup;
// 检测信息是否存在
if(!$dictionaryFormGroupSv->getCount([
'id' => $id,
'is_del' => 0
])) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '信息不存在!');
// 检测表单类型下是否有表单信息,有则不能删除
$dictionaryFormCount = $this->LocalService()->dictionaryForm->getCount([
'group_id' => $id,
'is_del' => 0
]);
if($dictionaryFormCount) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '此表单类型下已存在表单信息,不可删除!');
$result = $dictionaryFormGroupSv->upDelState([
'id' => $id,
], 1);
if($result) $this->LocalService()->log->saveFileLog($id, 'DictionaryFormGroup', [], 2);
return $this->RenderApiJson()->Success();
}else{
return $this->RenderApiJson()->Error(StatusCode::E_ACCESS);
}
}
}

View File

@ -0,0 +1,368 @@
<?php
//declare(strict_types=1);
namespace Application\Controller;
use Application\Common\Container;
use Application\Form\ExportModel;
use Application\Mvc\Controller\Plugins\RenderApiJson;
use Application\Service\DB\Dictionary\FormGroup;
use Application\Service\Extension\Helper\ExcelHelper;
use Application\Service\Extension\Laminas;
use Application\Service\Extension\Queue\jobs\SyncPatientFormJob;
use Application\Service\Extension\Queue\QueueApplication;
use Application\Service\Extension\Xml\LaboratoryXmlGenerator;
use Laminas\ApiTools\Admin\Module as AdminModule;
use Laminas\Http\Response;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;
use function class_exists;
/**
*
* @package Application\Controller
*
* @method RenderApiJson RenderApiJson()
* @method Container LocalService()
*/
class IndexController extends AbstractActionController
{
const Genercsetinfotype='Genercsetinfotype';//字典项分类-1
const Genercsetinfo='Genercsetinfo';//字典项通用名
/**
* @return Response|ViewModel
*/
public static function yieldFuc($num)
{
$oper_type = [0,1,2];
$log_type = [0,1,3];
$formData = include $_SERVER['DOCUMENT_ROOT'].'/../formData/formMap.php';
for($i = 0; $i < $num; $i++){
$logData = [
'user_id' => 1,
'event_from' => array_rand($formData),
'event_id' => $i,
'create_time' => time(),
'log_ip' => '127.0.0.1',
'oper_type' => array_rand($oper_type),
'log_type' => array_rand($log_type),
'change_data' => '测试'
];
yield $logData;
}
}
public function indexAction()
{
set_time_limit(0);
$datas = self::yieldFuc(10000);
foreach($datas as $data){
$this->LocalService()->adminLog->save($data);
}
exit('finish');
echo "<pre>";print_r($this->LocalService()->identity->getIdentityData());exit;
for($i = 19728; $i <= 19830; $i++){
echo $i.' ';
}
exit;
$formFieldData = $this->Introduce(self::Genercsetinfotype);
$formFieldData = empty($formFieldData) ? [] : array_values($formFieldData);
$formValData = 1 ? $this->LocalService()->dictionaryGenercsetinfotype->fetchOne(['where' => 'id = 1']) : [];
return $this->RenderApiJson()->Success($formValData, '', ['formFieldData' => $formFieldData]);
$maxId = $this->LocalService()->adminUser->getOneFieldVal('id', 'status = 1', 'id desc');
$maxOrder = $this->LocalService()->adminUser->getMaxOrder('id', 'status = 1');
echo 'maxId'.$maxId.' </br>';
echo 'maxOrder'.$maxOrder.' </br>';exit;
$this->LocalService()->adminUser->check_field_repeat('mobile', '15001062410', ['field' => 'is_del', 'value' => 1]);
// 操作前数据
$oprt_pre = [
'id' => 1,
'name' => '张三',
'status' => 0,
'mobile' => '12345678901',
'role_id' => 1
];
// 操作后数据
$oprt_last = [
'id' => 1,
'name' => '张山',
'status' => 0,
'mobile' => '01234567890',
'role_id' => '1,2,3,4,5'
];
//日志文件数据
$logData = [
'event' => 'AdminUser',
'ip' => '127.0.0.1',
'user_id' => 1,
'user_name' => '超级管理员',
'time' => time(),
'oprt_pre' => $oprt_pre,
'oprt_last' => $oprt_last
];
// 获取修改的字段
$changeData = array_diff_assoc($logData['oprt_last'], $logData['oprt_pre']);
if(!empty($changeData)){
$formMapData = include $_SERVER['DOCUMENT_ROOT'].'/../data/FormData/formMap.php';
$form_col_desc_data = include $_SERVER['DOCUMENT_ROOT'].'/../data/FormData/'.$logData['event'].'Data.php';
$event_name = $formMapData[$logData['event']];
foreach($changeData as $changeKey => &$changeVal){
if(isset($form_col_desc_data[$changeKey]['val_source']) and is_callable($form_col_desc_data[$changeKey]['val_source'])){
$changeVal = $form_col_desc_data[$changeKey]['val_source']($this->LocalService(), $changeVal);
}
$desc_data[] = $form_col_desc_data[$changeKey]['title'].''.$changeVal;
}
}
echo "<pre>";print_r($changeData);
echo $logData['user_name'].' 修改了:</br></br>'.implode('</br>', $desc_data);
echo "<pre>";print_r($logData);exit;
if (class_exists(AdminModule::class, false)) {
return $this->redirect()->toRoute('api-tools/ui');
}
return new ViewModel();
}
protected int $contentId = 0;
protected string $prop = '';
public function testAction()
{
$model = new ExportModel();
// $model->exportLogicError();
//2267; // pumch - 1101
ExcelHelper::exportExcel($model->exportLogicError(1101), [
[
['项目ID', 'item_id', 'text'],
['中心编号', 'sign_id', 'text'],
['筛选号', 'patient_id', 'text'],
['访视名称', 'checktime_id', 'text'],
['表单名称', 'form_id', 'text'],
['字段名称', 'prop', 'text'],
['原来值', 'origin_value', 'text'],
['更正值', 'value', 'text'],
// ['更正原因', 'note', 'text'],
['质疑内容', 'expression_note', 'text'],
['质疑时间', 'create_time', 'text'],
['质疑发出人员/角色', 'create_user_id', 'text'],
['质疑回复内容', 'reply_content', 'text'],
['质疑回复时间', 'replay_time', 'text'],
['质疑回复人员/角色', 'replay_user_id', 'text'],
['质疑关闭时间', 'is_closed', 'text'],
['质疑关闭人员/角色', 'closed_user_id', 'text'],
]
], time(), 'xlsx', '', ['质疑数据']);
die;
// $a = new App();
// $a->itemId = 1084;
// $a->signId = 1248;
// $a->menuId = App::MODULE_CS;
// $a->push([37]);
// die('123123');
// var_dump(Laminas::$serviceManager->itemForm->getPreviewConfig(518, true));die;
// $model = new SyncPatientFormJob();
// $model = new FormContentXmlGenerator();
// $model->patientId = 4134;
// $model->itemSignId = 272;
// $model->itemId = 101;
// $model->formId = 947; // 3917 //747 717;
// $model->checkTimeId = 566; //747 717;
// $xmlModel = new XmlBuilder();
// $data = $xmlModel->build($model->generate());
// echo $data;die;
//// echo json_encode($data, JSON_UNESCAPED_SLASHES);die;
////// $model->run();
// echo QueueApplication::push($model);die;
// die;
$model = new LaboratoryXmlGenerator();
// $model->setHeader([
// [
// 'key' => 'TEST',
// 'value' => '是',
// 'transactionType' => 'Insert',
// ],
// [
// 'key' => 'DATE',
// 'value' => '2022-1-1',
// 'transactionType' => 'Update',
// ]
// ]);
// $model->setContent(
// [
// [
// ['itemOID' => 'INDICATORS', 'transactionType' => 'Insert', 'value' => '白细胞'], // 指标
// ['itemOID' => 'UNIT', 'transactionType' => 'Insert', 'value' => '10^9/L'], // 单位
// ],
// [
// ['itemOID' => 'INDICATORS', 'transactionType' => 'Insert', 'value' => '中性粒细胞绝对值'], // 指标
// ['itemOID' => 'UNIT', 'transactionType' => 'Insert', 'value' => '10^9/L'], // 单位
//// ['itemOID' => 'RESULT', 'transactionType' => 'Insert', 'value' => '4.05'], // 结果
//// ['itemOID' => 'RANGE', 'transactionType' => 'Insert', 'value' => '1.8-6.3'], // 范围
//// ['itemOID' => 'NORMAL', 'transactionType' => 'Insert', 'value' => 'true'], // 正常
// ]
// ]
// );
// $model->setFormId(3946);
// $model->setPatientId(1992);
// $model->generate();
// $builder = new XmlBuilder();
//
// echo $builder->build($model->generate());die;
$query = Laminas::$serviceManager->patient->fetchAll([
// 'where' => ['item_id' => 1084, 'itemsig_id' => 1344, 'is_del' => 0]
'where' =>
[
// 'id' => [2032, 2069, 2640, 4134, 4557, 5015, 5358, 5488, 5531, 5599, 5659, 5769, 6083]
// 'id' => [4814, 4813, 2032, 2069, 2640, 4134, 4557, 5015, 5358, 5488, 5531, 5599, 5659, 5769, 6083]//[2032, 2069, 2640, 4134, 4557, 5015, 5358, 5488, 5531, 5599, 5659, 5769, 6083],
// 'id' => [2069, 2640, 4134, 4557, 5015, 5358, 5488, 5531, 5599, 5659, 5769, 6083],
'id' => [5651, 5652, 5878, 6127, 6146],
// 'id' => [2367, 2368, 2369, 2370, 2539, 2540, 2541, 4813, 2863, 2864, 2865, 2866, 4814, 4584, 4585, 5651, 5652, 5669, 5670, 5878, 5879, 5941, 6127, 6146]
] // 1043
// 'where' => ['id' => [2367, 2368, 2369, 2370, 2539, 2540, 2541, 2863, 2864, 2865, 2866, 4584, 4585]] // 2368, 2369, 2370, 2539, 2540, 2541, 2863, 2864, 2865, 2866, 4584, 4585
// 'where' => ['id' => 2069] // 1043
]);
//
// $model = new SyncPatientFormJob();
//// $model = new FormContentXmlGenerator();
// $model->patientId = intval($query[0]['id']);
// $model->itemSignId = $query[0]['itemsig_id'];
// $model->itemId = intval($query[0]['item_id']);
// $model->formId = 3921; //747 717;
// $model->checkTimeId = intval(563); //747 717;
//// $xmlModel = new XmlBuilder();
//// $data = $xmlModel->build($model->generate());
//// echo $data;die;
// $model->run();
// die;
////// 新增 一个受试者
// die;
// var_dump($query);die;
// 处理 ae
foreach ($query as $item) {
// $model = new SyncPatientJob();
////// $model = new PatientXmlGenerator();
// $model->patientId = intval($item['id']); // 受试者id
// $model->itemSignId = $item['itemsig_id']; // 中心id
//// $xmlModel = new XmlBuilder();
//// $data = $xmlModel->build($model->generate());
//// echo $data;die;
//// $model->run();
// echo QueueApplication::push($model);
// // 1406, 1407, 1409, 1410, 1411, 1412, 1408, 1413, 1414, 99
//
//// foreach ([560, 561, 562, 575, 563, 564, 565, 566, 570, 567, 571, 569, 572, 573, 99] as $v) {
// foreach ([1409] as $v) {
// $model = new SyncPatientFormJob();
//// $model = new FormContentXmlGenerator();
// $model->patientId = intval($item['id']);
// $model->itemSignId = 1344; //$item['itemsig_id'];
// $model->itemId = 1084; // intval($item['item_id']);
// $model->formId = 4602; //82841, 2841;
// $model->checkTimeId = intval($v); //747 717;
//// $model->isSync = true;
//// $xmlModel = new XmlBuilder();
//// $data = $xmlModel->build($model->generate());
//// echo json_encode($data, JSON_UNESCAPED_SLASHES);die;
// echo QueueApplication::push($model);
//// $model->isSync = false;
//// echo QueueApplication::push($model);
// }
//die;
// $model = new SyncPatientFormJob();
// $model = new FormContentXmlGenerator();
// $model->patientId = intval($item['id']);
// $model->itemSignId = 272; //$item['itemsig_id'];
// $model->itemId = 101; // intval($item['item_id']);
// $model->formId = 3918; //747 717;
// $model->checkTimeId = intval(1412); //747 717;
//// $model->isDeleteItemData = true;
//// echo QueueApplication::push($model);die;
// $xmlModel = new XmlBuilder();
// $data = $xmlModel->build($model->generate());
// echo json_encode($data, JSON_UNESCAPED_SLASHES);die;
$this->syncPatientForm($item);
}
die;
}
private function syncPatientForm(array $query)
{
$allCheckTime = Laminas::$serviceManager->itemPatientchecktime->fetchAll([
'columns' => ['checktime_id'],
'where' => [
'patient_id' => $query['id']
]
]);
$allCheckTime[] = [
'checktime_id' => 99
];
foreach ($allCheckTime as $checkTime) {
if ($checkTime['checktime_id'] == 99) {
$allFormId = Laminas::$serviceManager->itemForm->fetchCol('id', [
'item_id' => $query['item_id'],
'group_id' => [FormGroup::SAE, FormGroup::AE, FormGroup::THROUGH_PROCESS, FormGroup::TEST_SUMMARY],
'is_del' => 0
]);
} else {
$allFormId = Laminas::$serviceManager->patientForm->fetchCol('form_id', ['patient_id' => $query['id'], 'is_del' => 0, 'checktime_id' => $checkTime['checktime_id']]);
}
$allFormId = array_unique(array_values($allFormId));
foreach ($allFormId as $formId) {
// var_dump($formId);
// $formId = intval($formId['form_id']);
$form = Laminas::$serviceManager->itemForm->fetchOne([
'where' => ['id' => $formId]
]);
if ($form['group_id'] != FormGroup::CHECK_OCR) {
continue;
}
if ($checkTime['checktime_id'] != 99) {
if (in_array($form['group_id'], [FormGroup::SAE, FormGroup::AE, FormGroup::THROUGH_PROCESS, FormGroup::TEST_SUMMARY])) {
continue;
}
}
$model = new SyncPatientFormJob();
// $model = new FormContentXmlGenerator();
$model->patientId = intval($query['id']);
$model->itemSignId = $query['itemsig_id'];
$model->itemId = intval($query['item_id']);
$model->formId = $formId; //747 717;
$model->checkTimeId = intval($checkTime['checktime_id']); //747 717;
// 有数据说明写了
// if ($model->isSync() === false || $model->getFormContent('fetchOne', false) === false || $model->getIsProcessSync() === true) {
// continue;
// }
// $model->formContent = [];
// $xmlModel = new XmlBuilder();
// $data = $xmlModel->build($model->generate());
// echo $data;
// $model->run();
echo "受试者: [{$query['id']}]. 检查点: [{$checkTime['checktime_id']}]. 表单 [{$formId}]. " . PHP_EOL;
QueueApplication::push($model);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,699 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/4 13:42
* @Description登录
*
*/
namespace Application\Controller;
use Application\Common\Container;
use Application\Common\RedisEnum;
use Application\Common\StatusCode;
use Application\Form\LoginForm;
use Application\Mvc\Controller\Plugins\RenderApiJson;
use Application\Service\Extension\Helper\StringHelper;
use Application\Service\Extension\Identity\Identity;
use Application\Service\Extension\Laminas;
use Application\Service\Extension\Sms\SmsRateLimitException;
use Application\Service\Extension\Validator\ValidatorApplication;
use EasyWeChat\Kernel\Exceptions\InvalidConfigException;
use Exception;
use GuzzleHttp\Exception\GuzzleException;
use Laminas\Db\Sql\Where;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Mvc\Exception\InvalidArgumentException;
use Laminas\View\Model\JsonModel;
use Laminas\View\Model\ViewModel;
use Overtrue\Socialite\Exceptions\AuthorizeFailedException;
use Overtrue\Socialite\User;
/**
* Class LoginController
* @package Application\Controller
* @method Container LocalService()
* @method RenderApiJson RenderApiJson()
*/
class LoginController extends AbstractActionController
{
/**
* @note 账户密码登录
* @return JsonModel
*/
public function accountPwdAction() : JsonModel
{
return $this->RenderApiJson()->Success($this->LocalService()->loginClient->accoutPwd->login());
}
/**
* 获取扫码登陆登录二维码地址
* @doc https://www.showdoc.com.cn/1936668638131821/8824484392761392
* @url GET http://xx.com/login-code
* @return JsonModel
*/
public function loginCodeAction(): JsonModel
{
$model = new LoginForm();
// 获取登录网址
$wechatConfig = $this->getEvent()->getApplication()->getConfig()['wechat'];
$code = StringHelper::generateHashValue();
$info = $model->getLoginInfo($code);
$this->LocalService()->redisExtend->getRedisInstance()->setex(RedisEnum::TMP_CODE . $code, 180, $info);
return $this->RenderApiJson()->Success([
'url' => strtr(
$wechatConfig['forward_code_url'],
['{auk}' => $wechatConfig['forward_auk'], '{state}' => $code]
),
'code' => $code
]);
}
/**
* v2版本获取扫码登陆二维码
* @url GET http://xx.com/v2/login-code
* @return JsonModel
*/
public function loginCodeV2Action(): JsonModel
{
$model = new LoginForm();
$code = StringHelper::generateHashValue();
$info = $model->getLoginInfo($code);
$this->LocalService()->redisExtend->getRedisInstance()->setex(RedisEnum::TMP_CODE . $code, 180, $info);
$host = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['HTTP_HOST']}";
if ($_SERVER['HTTP_HOST'] === 'local.kingdone.com') {
$host = 'https://esm.kingdone.com';
}
return $this->RenderApiJson()->Success([
'url' => "{$host}/oauth?code={$code}",
'code' => $code
]);
}
public function oAuthAction(): ViewModel
{
// 获取登录网址
$wechatConfig = $this->getEvent()->getApplication()->getConfig()['wechat'];
$code = $_GET['code'];
if (!$code) {
return $this->RenderApiJson()->Error(StatusCode::E_LOGIN_CODE_EXPIRE, '无效的二维码');
}
$view = new ViewModel();
$view->setTemplate('application/login/auth');
$view->setTerminal(true);
$view->setVariables([
'authUrl' => strtr(
$wechatConfig['forward_code_url'],
['{auk}' => $wechatConfig['forward_auk'], '{state}' => $code]
)
]);
return $view;
}
/**
* 用户是否已经扫码登录
* @doc https://www.showdoc.com.cn/p/7b784fee3c5be975d574144dc02836fc
* @url POST http://xx.com/is-scan
* @return JsonModel
*/
public function isScanAction(): JsonModel
{
// 验证是否登录成功
$code = $this->getRequest()->getPost()->get('code');
$redis = $this->LocalService()->redisExtend->getRedisInstance();
// 判断code 是否过期
if (!$redis->get(RedisEnum::TMP_CODE . $code)) {
return $this->RenderApiJson()->Error(StatusCode::E_LOGIN_CODE_EXPIRE, '二维码已过期,请刷新后重试');
}
// 检查用户状态, 是否绑定微信
$statusKey = RedisEnum::USER_STATUS . $code;
$info = $redis->get($statusKey);
if (!$info) {
return $this->RenderApiJson()->Error(StatusCode::E_RUNTIME, '未发现用户扫码');
}
$info = json_decode($info, true);
if (!isset($info['bind_status'])) {
return $this->RenderApiJson()->Error(StatusCode::E_RUNTIME, '获取用户信息失败');
}
// 未绑定和已绑定的用户返回信息做一下处理
if ($info['bind_status'] == -1) {
return $this->RenderApiJson()->Success([
'bind_status' => -1,
'bind_code' => $code
]);
} else {
$redis->del($statusKey);
if (isset($info['group']) && $info['group'] == 2) {
return $this->RenderApiJson()->Success($info, 'OK', [
'auth' => $this->LocalService()->identity->generateTokenByUserId($info['id'], Identity::PLATFORM_REAL)
]);
}
return $this->RenderApiJson()->Success($info);
}
}
/**
* @return \Laminas\Http\Response
*/
public function forwardAction(): \Laminas\Http\Response
{
$auk = $this->params()->fromQuery('auk', '');
$scan_code = $this->params()->fromQuery('state');
$wechatConfig = $this->LocalService()->config['wechat'];
$callBackUrl = "{$wechatConfig['forward_callback_url']}?auk={$auk}&scan_code={$scan_code}";
$redirectUrl = $this->LocalService()->wechat->getApp()
->oauth
->scopes(['snsapi_userinfo'])->with(['forceSnapShot' => true])
->redirect($callBackUrl);
return $this->redirect()->toUrl($redirectUrl);
// die;
}
/**
* 微信扫码回调
* @throws GuzzleException
* @throws AuthorizeFailedException
*/
public function callbackAction()
{
$auk = $this->params()->fromQuery('auk', '');
$code = $this->params()->fromQuery('code', '');
$scan_code = $this->params()->fromQuery('scan_code', '');
if($auk !== ''){
$callBackUrl = $this->LocalService()->config['wechatRedirectUrlConfig'][$auk];
return $this->redirect()->toUrl($callBackUrl.'?code='.$code.'&scan_code='.$scan_code);
}else{
// 微信配置信息
$wechatConfig = $this->LocalService()->config['wechat'];
if($wechatConfig['open_forward']){
// 获取微信用户信息
$user = $this->LocalService()->httpSv->post($wechatConfig['forward_user_url'], ['code'=>$code]);
$user = new User($user);
}else{
$user = $this->LocalService()->wechat->getApp()->oauth->userFromCode($code);
}
$model = new LoginForm();
$model->code = $scan_code;
$status = $model->setCallback($user);
if ($status['bind_status'] == -1) {
include __DIR__ . '/../../view/application/login/bind.phtml';
}else{
include __DIR__ . '/../../view/application/login/success.phtml';
}
die;
}
}
/**
* Notes: 通过code值获取wechat用户信息
* User: llbjj
* DateTime: 2022/7/26 13:46
*
*/
public function wechatuserAction(): JsonModel
{
$code = $this->params()->fromPost('code');
$scopes = $this->params()->fromPost('scopes', 'snsapi_userinfo');
$user = $this->LocalService()->wechat->getApp()->oauth->scopes([$scopes])->userFromCode($code);
$userData = [
'id' => $user->getId(),
'nickname' => $user->getNickname(),
'avatar' => $user->getAvatar(),
'openid' => $user->getId(),
];
return $this->RenderApiJson()->Success($userData);
}
/**
* 发送短信
* @doc https://www.showdoc.com.cn/p/020e03537a97fb3c19c8871d60a2427a
* @url POST http://xx.com/send-sms
* @return JsonModel
* @throws Exception
*/
public function sendSmsAction(): JsonModel
{
$mobile = $this->params()->fromPost('mobile');
if (!Laminas::$serviceManager->adminUser->fetchOne(['where' => ['mobile' => $this->params()->fromPost('mobile'), 'is_del' => 0]])) {
throw new InvalidArgumentException("没有匹配的账户信息,请联系客服后重试!", StatusCode::E_FIELD_VALIDATOR['code']);
}
$redis = Laminas::$serviceManager->redisExtend->getRedisInstance();
$limitKey = RedisEnum::SMS_LIMIT . $mobile;
// 验证发送速率
if ($redis->get($limitKey)) {
throw new SmsRateLimitException("短信发送频繁, 60秒内只能发送一次。");
}
$response = $this->LocalService()->sms->send($mobile);
if ($response['error'] != 0) {
throw new InvalidArgumentException("验证码发送失败", StatusCode::E_FIELD_VALIDATOR['code']);
}
$this->LocalService()->redisExtend->getRedisInstance()->setex(RedisEnum::SMS . $mobile, 60 * 5, $response['code']);
// 设置请求速率key
$redis->setex(RedisEnum::SMS_LIMIT . $mobile, 60, 1);
return $this->RenderApiJson()->Success();
}
public function h5SendSmsAction(): JsonModel
{
$mobile = $this->params()->fromPost('mobile');
$redis = Laminas::$serviceManager->redisExtend->getRedisInstance();
$limitKey = RedisEnum::SMS_LIMIT . $mobile;
// 验证发送速率
if ($redis->get($limitKey)) {
throw new SmsRateLimitException("短信发送频繁, 60秒内只能发送一次。");
}
// 验证手机号是否是受试者用户
$adminUser = $this->LocalService()->adminUser->fetchOne([
'where' => ['is_del' => 0, 'mobile' => $mobile, 'patient_status' => 0],
'columns' => ['id', 'patient_openid']
]);
if(empty($adminUser)) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '用户不存在,请联系相关客服!');
if(!empty($adminUser['patient_openid'])) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '请勿重复绑定!');
$response = $this->LocalService()->sms->send($mobile);
if ($response['error'] != 0) {
throw new InvalidArgumentException("验证码发送失败", StatusCode::E_FIELD_VALIDATOR['code']);
}
$this->LocalService()->redisExtend->getRedisInstance()->setex(RedisEnum::SMS . $mobile, 60 * 5, $response['code']);
// 设置请求速率key
$redis->setex(RedisEnum::SMS_LIMIT . $mobile, 60, 1);
return $this->RenderApiJson()->Success();
}
/**
* @note 发送登录验证码(账户登录使用)
* @return JsonModel
* @throws \RedisException
*/
public function sendLoginSmsAction(): JsonModel
{
$mobile = $this->params()->fromPost('mobile');
if(empty($mobile)) {
throw new InvalidArgumentException("手机号不能为空!");
}
$redis = Laminas::$serviceManager->redisExtend->getRedisInstance();
$limitKey = RedisEnum::SMS_LIMIT . $mobile;
// 验证发送速率
if ($redis->get($limitKey)) {
throw new SmsRateLimitException("短信发送频繁, 60秒内只能发送一次。");
}
// 验证手机号是否是受试者用户
$adminUser = $this->LocalService()->adminUser->fetchOne([
'where' => [
'is_del' => 0,
'mobile' => $mobile,
'or' => [
'real_status' => 0,
'status' => 0,
],
],
'columns' => ['id']
]);
if(empty($adminUser)) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '用户不存在,请联系相关客服!');
$response = $this->LocalService()->sms->send($mobile);
if ($response['error'] != 0) {
throw new InvalidArgumentException("验证码发送失败", StatusCode::E_FIELD_VALIDATOR['code']);
}
$this->LocalService()->redisExtend->setDatabase(6)->getRedisInstance()->setex(RedisEnum::SMS_LOGIN . $mobile, 60 * 5, $response['code']);
// 设置请求速率key
$redis->setex(RedisEnum::SMS_LIMIT . $mobile, 60, 1);
return $this->RenderApiJson()->Success();
}
/**
* 绑定用户
* @doc https://www.showdoc.com.cn/p/9bdf32451aed20b9120fbe047427691b
* @url POST http://xx.com/bind
* @throws Exception
*/
public function bindAction(): JsonModel
{
$validator = new ValidatorApplication();
$mobile = $this->params()->fromPost('mobile');
// 验证短信验证码
$code = $this->LocalService()->redisExtend->getRedisInstance()->get(RedisEnum::SMS . $validator->attributes['mobile']);
if (!$code || $code != $this->params()->fromPost('checkcode')) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "验证码有误");
}
$callbackInfo = $this->LocalService()->redisExtend->getRedisInstance()->get(RedisEnum::USER_STATUS . $validator->attributes['bind_code']);
// 如果扫完码超过了一个小时还没进行绑定操作, key已经过期了
if (!$callbackInfo) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "已绑定或绑定超时。");
}
$callbackInfo = json_decode($callbackInfo, true);
// 更新对应用户的信息
$this->LocalService()->adminUser->update([
'avatar' => $callbackInfo['avatar'],
'nickname' => $callbackInfo['nickname'],
'openid' => $callbackInfo['openid'],
], ['mobile' => $validator->attributes['mobile']]);
// 获取用户信息
$user = $this->LocalService()->adminUser->fetchOne([
'where' => ['mobile' => $validator->attributes['mobile'], 'is_del' => 0]
]);
$this->LocalService()->redisExtend->getRedisInstance()->del(RedisEnum::USER_STATUS . $validator->attributes['bind_code']);
return $this->RenderApiJson()->Success($this->LocalService()->identity->getLoginInfo($user['id']));
}
/**
* 登出
* @doc https://www.showdoc.com.cn/p/fdd7b478543cdbcd19c64f9443dd2a73
* @url GET http://xx.com/logout
* @return JsonModel
*/
public function logoutAction(): JsonModel
{
$this->LocalService()->identity->disCard();
return $this->RenderApiJson()->Success();
}
/**
* 小程序登录
* @doc https://www.showdoc.com.cn/p/b89babadc4ef3ebc46910f8605355ef8
* @url GET http://xx.com/mini-login
* @return JsonModel
* @throws GuzzleException|InvalidConfigException|Exception
*/
public function miniLoginAction(): JsonModel
{
// 获取手机号code
$code = $this->params()->fromPost('code');
// 获取openid code, 目前没用了
$sessionCode = $this->params()->fromPost('session_code');
$platform = $this->params()->fromPost('platform');
$phoneResponse = $this->LocalService()->wechat->getMiniApp($platform)->phone_number->getUserPhoneNumber($code);
if ($phoneResponse['errmsg'] != 'ok') {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '微信授权失败');
}
if (!isset($phoneResponse['phone_info']['purePhoneNumber'])) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '获取手机号失败!');
}
$data = $this->LocalService()->identity->generateTokenByMobile(
$phoneResponse['phone_info']['purePhoneNumber'],
Identity::PLATFORM_MINI_PROGRAM
);
if (count($data) !== count($data, COUNT_RECURSIVE) && count($data) > 1) {
return $this->RenderApiJson()->Success([], 'OK', ['auth' => $data]);
} else {
return $this->RenderApiJson()->Success(
current($data)
);
}
}
public function patientH5OauthAction() {
$code = $this->params()->fromPost('code', ''); // 微信Code值用于获取openid
$type = $this->params()->fromPost('type', 'default');
if( empty($code) ) return $this->RenderApiJson($type)->Success([
'status' => 1,
'msg' => '非法登录!'
]);
// 获取微信公众号用户信息
$wechatUserInfo = $this->LocalService()->wechat->getPatientH5App($type)->oauth->scopes(['snsapi_base'])->userFromCode($code);
if( empty($wechatUserInfo->getId()) ) return $this->RenderApiJson()->Success([
'status' => 1,
'msg' => '公众号授权失败!'
]);
// 查询微信公众号openid对应的用户信息
$adminUser = $this->LocalService()->adminUser->fetchOne([
'where' => [
'is_del' => 0,
'patient_openid' => $wechatUserInfo->getId()
],
'columns' => [ 'id', 'mobile', 'patient_status']
]);
if( empty($adminUser) ) return $this->RenderApiJson()->Success([
'status' => 2,
'msg' => '账户未绑定!',
'openid' => $wechatUserInfo->getId()
]);
if( !empty($adminUser['patient_status']) ) return $this->RenderApiJson()->Success([
'status' => 1,
'msg' => '账户已禁用,请联系相关客服人员!'
]);
// 受试者登录
$authData = $this->LocalService()->identity->generateTokenByUserId($adminUser['id'], Identity::PLATFORM_H5_PROGRAM_PATIENT);
return $this->RenderApiJson()->Success([
'token' => $authData['token'],
'status' => 0
]);
}
public function h5BindAction()
{
$openid = $_POST['openid'];
$smsCode = $_POST['sms_code'];
$mobile = $_POST['mobile'];
$type = $_POST['type'];
// 验证短信验证码
$smsCodeVal = $this->LocalService()->redisExtend->setDatabase(6)->getRedisInstance()->get(RedisEnum::SMS . $mobile);
if (!$smsCodeVal || $smsCodeVal != $smsCode) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "验证码有误");
}
$adminUser = $this->LocalService()->adminUser->fetchOne([
'where' => ['is_del' => 0, 'mobile' => $mobile, 'patient_status' => 0],
'columns' => ['id', 'patient_openid']
]);
if(empty($adminUser)) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '用户不存在,请联系相关客服人员!');
if (!empty($adminUser['patient_openid'])) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "请勿重复绑定。");
}
$wechatUserInfo = $this->LocalService()->wechat->getPatientH5App($type)->user->get($openid);
if (empty($wechatUserInfo['openid'] ?? '')) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "获取用户信息失败,请重试。");
}
// 更新受试者用户的openid
Laminas::$serviceManager->adminUser->updateField($adminUser['id'], 'patient_openid', $openid);
// 授权登录
$authData = $this->LocalService()->identity->generateTokenByUserId($adminUser['id'], Identity::PLATFORM_H5_PROGRAM_PATIENT);
return $this->RenderApiJson()->Success(['token' => $authData['token']]);
}
public function getwebsitefilingAction(): JsonModel
{
return $this->RenderApiJson()->Success($this->LocalService()->adminWebsitefiling->getCurrentWebsiteFiling());
}
public function indexAction(){
$viewModel = new ViewModel();
$viewModel->setTerminal(true);
return $viewModel;
}
public function patientH5Action() {
$time = $this->params()->fromQuery('date', '');
$type = $this->params()->fromQuery('type', 'default');
$sendUrl = $this->LocalService()->config['sendUrl'];
$sendUrl .= '/#/patientH5?type='.$type;
if($time) $sendUrl .= '&date=' . $time;
$redirectUrl = rawurlencode($sendUrl);
$appid = $this->LocalService()->wechat->getPatientH5App($type)->getConfig()['app_id'];
return $this->redirect()->toUrl("https://open.weixin.qq.com/connect/oauth2/authorize?appid={$appid}&redirect_uri={$redirectUrl}&response_type=code&scope=snsapi_base&state=STATE&connect_redirect=1#wechat_redirect");
}
/**
* @note webH5 静默授权登录
* @return \Laminas\Http\Response
*/
public function webH5Action(): \Laminas\Http\Response
{
$wechatH5Config = $this->LocalService()->config['wechat']['h5Proxy'];
// 开启代理
if($wechatH5Config['open_forward']) {
return $this->redirect()->toUrl(strtr(
$wechatH5Config['forward_code_url'],
['{auk}' => $wechatH5Config['forward_auk']]
));
}
$sendUrl = $this->LocalService()->config['sendUrl'];
$sendUrl .= '/#/webH5';
if(!empty($this->params()->fromQuery())) $sendUrl .= "?" . http_build_query($this->params()->fromQuery());
return $this->redirect()->toUrl(
$this->LocalService()->wechat->getApp()
->oauth
->scopes(['snsapi_base'])
->with(['forceSnapShot' => true])
->redirect($sendUrl)
);
}
/**
* @note webH5 代理
* @return \Laminas\Http\Response
*/
public function webH5ForwardAction(): \Laminas\Http\Response
{
$wechatH5Config = $this->LocalService()->config['wechat']['h5Proxy'];
return $this->redirect()->toUrl(
$this->LocalService()->wechat->getApp()
->oauth
->scopes(['snsapi_base'])
->with(['forceSnapShot' => true])
->redirect(
$wechatH5Config['forward_callback_url'] . "?". http_build_query($this->params()->fromQuery())
)
);
}
/**
* @note webH5 代理回调
* @return \Laminas\Http\Response
*/
public function webH5CallbackAction(): \Laminas\Http\Response
{
$auk = $this->params()->fromQuery('auk', '');
$code = $this->params()->fromQuery('code', '');
return $this->redirect()->toUrl(
$this->LocalService()->config['wechatH5RedirectUrlConfig'][$auk] . "?code=" . $code
);
}
public function webH5OauthAction() {
$code = $this->params()->fromPost('code', ''); // 微信Code值用于获取openid
if( empty($code) ) return $this->RenderApiJson()->Success([
'status' => 1,
'msg' => '非法登录!'
]);
// 获取微信公众号用户信息
$wechatH5Config = $this->LocalService()->config['wechat']['h5Proxy'];
// 开启代理
if($wechatH5Config['open_forward']) {
// 获取微信用户信息
$wechatUserInfo = $this->LocalService()->httpSv->post(
$this->LocalService()->config['wechat']['forward_user_url'],
[
'code'=>$code,
'scopes' => 'snsapi_base'
]
);
$wechatUserInfo = new User($wechatUserInfo);
}else {
$wechatUserInfo = $this->LocalService()->wechat->getApp()->oauth->scopes(['snsapi_base'])->userFromCode($code);
}
if( empty($wechatUserInfo->getId()) ) return $this->RenderApiJson()->Success([
'status' => 1,
'msg' => '公众号授权失败!'
]);
// 查询微信公众号openid对应的用户信息
$adminUser = $this->LocalService()->adminUser->fetchOne([
'where' => [
'is_del' => 0,
'openid' => $wechatUserInfo->getId()
],
'columns' => [ 'id', 'mobile', 'status', 'real_status']
]);
if( empty($adminUser) ) {
// 插入用户状态, 3600秒生存时间, 防止扫完码不取数据一直占用内存
Laminas::$serviceManager->redisExtend->getRedisInstance()->setex(RedisEnum::USER_STATUS . $code, 60 * 60 , json_encode([
'bind_status' => -1,
'nickname' => $wechatUserInfo->getNickname(),
'avatar' => $wechatUserInfo->getAvatar(),
'openid' => $wechatUserInfo->getId(),
]));
return $this->RenderApiJson()->Success([
'status' => 2,
'msg' => '账户未绑定!',
'openid' => $wechatUserInfo->getId()
]);
}
if( !empty($adminUser['status']) && !empty($adminUser['real_status']) ) return $this->RenderApiJson()->Success([
'status' => 1,
'msg' => '账户已禁用,请联系相关客服人员!'
]);
// 受试者登录
$authData = $this->LocalService()->identity->generateTokenByUserId($adminUser['id'], Identity::PLATFORM_H5_WEB);
return $this->RenderApiJson()->Success([
'token' => $authData['token'],
'status' => 0
]);
}
}

View File

@ -0,0 +1,260 @@
<?php
/**
*
* @authorllbjj
* @DateTime2024/7/31 20:39
* @Description
*
*/
namespace Application\Controller;
use Application\Common\Com;
use Application\Common\StatusCode;
use Application\Mvc\Controller\BasicController;
use Application\Service\Exceptions\InvalidArgumentException;
use Application\Service\Extension\Helper\StringHelper;
use Exception;
use Laminas\Cache\Exception\ExceptionInterface;
use Laminas\Db\Sql\Predicate\Expression;
use Laminas\Mvc\MvcEvent;
use Laminas\View\Model\JsonModel;
class PatientH5Controller extends BasicController
{
protected ?array $patientData;
public function attachDefaultListeners()
{
parent::attachDefaultListeners(); // TODO: Change the autogenerated stub
$event = $this->getEventManager();
$event->attach(MvcEvent::EVENT_DISPATCH, [$this, 'checkPatientStatus'], 100);
}
/**
* Notes: 检测当前登录账户对应的受试者的状态
* User: llbjj
* DateTime: 2024/8/1 9:26
*
* @throws ExceptionInterface
*/
public function checkPatientStatus() {
// 检测当前用户的状态
$adminUser = $this->LocalService()->adminUser->fetchOne([
'where' => ['id' => $this->LocalService()->identity->getId(), 'is_del' => 0],
'columns' => ['patient_status', 'id', 'patient_openid']
]);
if(empty($adminUser)) throw new InvalidArgumentException('账户不存在!');
if($adminUser['patient_status']) throw new InvalidArgumentException('账户已禁用!');
// 检测用户是否关注
if(( $this->LocalService()->toolSys->getWechatUserStatus($adminUser['patient_openid'], 'patient')['userStatus'] ?? 'unsubscribe' ) === 'unsubscribe') {
throw new InvalidArgumentException('尚未关注公众号!');
}
// 获取对应的受试者信息
$patientData = $this->LocalService()->patient->fetchOne([
'where' => ['patient_tel' => $this->LocalService()->identity->getMobile(), 'is_del' => 0],
'columns' => [ 'id', 'item_id', 'itemsig_id', 'patient_name', 'patient_number' ]
]);
if(empty($patientData)) throw new InvalidArgumentException('受试者不存在!');
$this->patientData = $patientData;
}
public function editSendAction(): JsonModel
{
$date = $this->params()->fromPost('date', time());
$date = $date ?: time();
$itemMessageSendContent = $this->LocalService()->itemMessageSend->getOneFieldVal('content', ['is_del' => 0, 'item_id' => $this->patientData['item_id'] ]);
if (empty($itemMessageSendContent)) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '后台推送新增表单还未设置');
$itemMessageSendPatientWhere = [
'where' => 'is_del=0 and item_id='.$this->patientData['item_id'].' and patient_id='.$this->patientData['id'].' and FROM_UNIXTIME(create_time ,"%Y-%m-%d")="'.date('Y-m-d', $date).'"',
'columns'=>['item_id','content','itemsig_id','patient_id','id', 'is_write'],
];
$itemMessageSendInfo = $this->LocalService()->itemMessageSendPatient->fetchOne($itemMessageSendPatientWhere);
if (!empty($itemMessageSendInfo) && $itemMessageSendInfo['is_write'] == 1){
return $this->RenderApiJson()->Success([
'itemMessageSendInfo' => [
'is_write' => 1
]
]);
}
$com = new Com();
$itemMessageSendInfo['itemInfoName'] = $this->LocalService()->itemInfo->getOneFieldVal('name','id='.$this->patientData['item_id'])?:'';
$itemMessageSendInfo['patient_name'] = $this->patientData['patient_name'] ?: '';
if($this->patientData['patient_number']) $itemMessageSendInfo['patient_name'] .= "{$this->patientData['patient_number']}";
if (!empty($itemMessageSendInfo['content'])){
$itemMessageSendInfo['content'] = json_decode($itemMessageSendInfo['content'],true);
}else{
$itemMessageSendInfo['content'] = [];
}
$itemMessageFieldWhere = [
'is_del' => 0,
'item_id' => $this->patientData['item_id'],
];
$itemMessageFieldData = $this->LocalService()->itemMessageField->fetchAll([
'where' => $itemMessageFieldWhere,
'order' => ['mess_order']
]);
$relation = [];
if(!empty($itemMessageFieldData)){
$relationFieldData = [];
$relationIdArr = [];
$relationId = array_filter(array_column($itemMessageFieldData,'relation_id'));
if (!empty($relationId)){
$relationIds = implode(',',$relationId);
$relationFieldData = $this->LocalService()->itemMessageField->fetchAll(['where' => [
'is_del' => 0,
'item_id' => $this->patientData['item_id'],
[
'or' => [
'id' => StringHelper::toArray($relationIds),
'parent' => StringHelper::toArray($relationIds)
]
]
],'order' => ['mess_order']]);
}
if(!empty($relationFieldData)){
$relationFieldData = $com->getTree($relationFieldData,0,0,2,'parent');
$relationIdArr = array_column($relationFieldData,'id');
}
$relationFieldDatas = $this->LocalService()->itemMessageSend->getPatientattrTemplate($relationFieldData);
if(!empty($relationFieldDatas)) {
foreach ($itemMessageFieldData as $itemMessageFieldDataK => $itemMessageFieldDataV){
if (!empty($itemMessageFieldDataV['relation_id'])){
$relationIdData = explode(',',$itemMessageFieldDataV['relation_id']);
foreach ($relationFieldDatas as $relationFieldDatasK=>$relationFieldDatasV) {
if (in_array($relationFieldDatasV['id'],$relationIdData)){
$relationFieldDatasV['prop'] = $relationFieldDatasV['id'];
$relation[$itemMessageFieldDataV['parent']][$itemMessageFieldDataV['id']][] = $relationFieldDatasV;
}
}
}
if (in_array($itemMessageFieldDataV['id'],$relationIdArr)){
unset($itemMessageFieldData[$itemMessageFieldDataK]);
}
}
}
}
!empty($itemMessageFieldData) && $itemMessageFieldData = $com->getTree($itemMessageFieldData,0,0,2,'parent');
$FormFileDatas = $this->LocalService()->itemMessageSend->getPatientattrTemplate($itemMessageFieldData);
$FormFileData =array_values($this->Introduce('MessageSend',['item_id'=>$this->patientData['item_id'],'messageSend'=>$FormFileDatas,'MINI_PATIENT'=>1]));
$data['itemMessageSendInfo'] = $itemMessageSendInfo;
$data['FormFileData'] =$FormFileData;
$data['relation'] =$relation;
return $this->RenderApiJson()->Success($data);
}
/**
* @throws Exception
*/
public function savePatientSendAction(): JsonModel
{
$newData['item_id'] = $this->patientData['item_id'] ?: 0;
$newData['patient_id'] = $this->patientData['id'] ?: 0;
$newData['itemsig_id'] = $this->patientData['itemsig_id'] ?: 0;
$newData['id'] = $this->params()->fromPost('id', 0);
$newData['content'] = $this->params()->fromPost('content', '');
$date = $this->params()->fromPost('date', 0);
$date = $date ?: time();
$com = new Com();
if (empty($newData['item_id']) || empty($newData['content']) || empty($newData['patient_id'])){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '参数不正确');
}
//验证链接
if((strtotime(date('Y-m-d',$date)) != strtotime(date('Y-m-d'))) || empty($date)){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '信息已过期');
}
$itemMessageSendInfo = $this->LocalService()->itemMessageSend->fetchOne(['where'=> [
'is_del' => 0,
'item_id' => $newData['item_id'],
]]);
if (empty($itemMessageSendInfo)){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '信息已过期');
}
//没有填写数据
$itemMessageSendPatientWhere = [
'where' => [
'is_del' => 0,
'item_id' => $newData['item_id'],
'patient_id' => $this->patientData['patient_id'],
new Expression('FROM_UNIXTIME(create_time ,"%Y-%m-%d")=?', date('Y-m-d'))
],
'columns'=>['item_id','content','itemsig_id','patient_id','id'],
];
$itemMessageSendPatientInfo = $this->LocalService()->itemMessageSendPatient->fetchOne($itemMessageSendPatientWhere);
if(!empty($itemMessageSendPatientInfo['is_write'])) return $this->RenderApiJson()->Success();
$itemMessageFieldData = $this->LocalService()->itemMessageField->fetchAll(['where' => [
'is_del' => 0,
'item_id' => $newData['item_id'],
],'order' => ['mess_order']]);
$itemMsgParent = [];
$itemMsgParents = [];
if (!empty($itemMessageFieldData)){
$itemMsgParents = array_column($itemMessageFieldData,null,'id');
foreach ($itemMessageFieldData as $itemMessageFieldDataK=>$itemMessageFieldDataV){
if (empty($itemMessageFieldDataV['parent']) && $itemMessageFieldDataV['is_required'] == 1){
$itemMsgParent[] = $itemMessageFieldDataV['id'];
}
}
$itemMessageFieldData = $com->getTree($itemMessageFieldData,0,0,2,'parent');
}
$FormFileDatas = $this->LocalService()->itemMessageSend->getPatientattrTemplate($itemMessageFieldData);
$contentField = $newData;
if (!empty($newData['content'])){
$newContentData = json_decode($newData['content'],true);
foreach ($newContentData as $newContentDataK=>$newContentDataV){
$var_name = isset($itemMsgParents[$newContentDataV['id']]['var_name'])?$itemMsgParents[$newContentDataV['id']]['var_name']:'';
$names = isset($itemMsgParents[$newContentDataV['id']]['name'])?$itemMsgParents[$newContentDataV['id']]['name']:'';
if (in_array($newContentDataV['id'],$itemMsgParent) && empty($newContentDataV['value'])){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '【'.$names.'】:不能为空');
}
$contentField[$var_name] = $newContentDataV['value'];
}
//必填写都填写则为已完成
$newData['is_write'] = 1;
unset($contentField['content']);
}
$FormFileData =$this->Introduce('MessageSendPatient',['item_id'=>$newData['item_id'],'messageSend'=>$FormFileDatas]);
empty($newData['id']) && $newData['id'] = $itemMessageSendPatientInfo['id'];
$newData['write_time'] = time();
$result = $this->LocalService()->itemMessageSendPatient->save($newData);
unset($newData['write_time']);
unset($newData['update_user_id']);
$contentField['realname'] = $this->patientData['patient_name'];
$contentField['data_type_flag'] = 1;
if (!empty($result)) $this->LocalService()->log->saveFileLog($newData['id'],'MessageSendPatient',$contentField,0,'暂无说明',$newData['item_id'],'',['item_id'=>$newData['item_id'],'messageSend'=>$FormFileData]);
return $this->RenderApiJson()->Success();
}
}

View File

@ -0,0 +1,191 @@
<?php
/**
*
* @authorllbjj
* @DateTime2024/4/8 16:28
* @Description
*
*/
namespace Application\Controller;
use Application\Common\StatusCode;
use Application\Mvc\Controller\BasicController;
use Application\Mvc\Controller\ThirdToolController;
use Application\Service\Exceptions\InvalidArgumentException;
use Application\Service\Extension\Helper\ArrayHelper;
use Application\Service\Extension\Helper\DateHelper;
use Laminas\Cache\Exception\ExceptionInterface;
use Laminas\Stdlib\ArrayUtils;
use Laminas\View\Model\JsonModel;
class SasController extends BasicController
{
/**
* @throws ExceptionInterface
*/
public function exportAction() : JsonModel
{
$exportResult = $this->LocalService()->toolSys->exportSas($this->params()->fromPost());
$extendData = [];
if (!$exportResult['isValid']) {
// 获取错误提示信息的表格结构
$extendData = [
'FormFileData' => $this->Introduce('ExportSasErr', ['item_id' => $this->params()->fromPost('item_id')])
];
}
return $this->RenderApiJson()->Success($exportResult, '', $extendData);
}
public function editAction(): JsonModel
{
$id = $this->params()->fromPost('id', 0);
$item_id = $this->params()->fromPost('item_id', 0);
$category = $this->params()->fromPost('category', 0);
if(empty($item_id)) throw new InvalidArgumentException('请选择项目!');
$where = ['item_id' => $item_id, 'category' => $category, 'is_del' => 0, 'id' => $id];
$exportSas = $this->LocalService()->exportSas->fetchOne([
'where' => $where,
'columns' => ['item_id', 'itemsig_id', 'export_form_id', 'mode', 'path', 'category', 'status', 'type', 'create_user_id', 'create_time', 'update_user_id', 'update_time', 'date_ym', 'export_create_user_id']
]);
if(empty($exportSas)) {
$exportSas = [ 'mode' => '0', 'item_id' => $item_id, 'type' => '0', 'category' => $category, 'itemsig_id' => '', 'date_ym' => $date_ym, 'export_form_id' => 'null' ];
}else {
$exportSas['applyUserName/dateTime'] = $this->LocalService()->adminUser->getOneFieldVal('realname', ['id' => $exportSas['update_user_id'] ?: $exportSas['create_user_id']]) . '/' . date('Y-m-d H:i:s', $exportSas['update_time'] ?: $exportSas['create_time']);
$exportSas['itemsig_id'] = !empty($exportSas['itemsig_id']) ? explode(',', $exportSas['itemsig_id']) : [];
$exportSas['export_form_id'] = !empty($exportSas['export_form_id']) ? explode(',', $exportSas['export_form_id']) : [];
unset($exportSas['create_user_id']);
unset($exportSas['create_time']);
unset($exportSas['update_user_id']);
unset($exportSas['update_time']);
}
$FormFileData = $this->Introduce('ExportSas', ['item_id' => $item_id, 'category' => $category]);
return $this->RenderApiJson()->Success($exportSas, '', [
'FormFileData' => array_values($FormFileData)
]);
}
public function listAction(): JsonModel
{
$item_id = $this->params()->fromPost('item_id', 0);
$category = $this->params()->fromPost('category', 0);
if(empty($item_id)) throw new InvalidArgumentException('请选择项目!');
$limit = $this->params()->fromPost('limit', 10);
$page = $this->params()->fromPost('page', 1);
$formFileData = $this->Introduce('ExportSas', ['item_id' => $item_id, 'category' => $category]);
$listWhere = [
'category' => $category,
'item_id' => $item_id,
'is_del' => 0,
];
$exportSasList = $this->LocalService()->exportSas->fetchAll([
'where' => $listWhere,
'limit' => $limit,
'offset' => ($page - 1) * $limit,
'order' => 'update_time desc'
]);
$formFieldOptions = [];
array_walk($formFileData, function ($item, $key) use (&$formFieldOptions) {
if ( in_array ( $item['type'], [ 'Radio', 'SelectUser' ])) {
$optionsKey = $item['type'] == 'Radio' ? 'radios' : 'options';
$formFieldOptions[$key] = ArrayHelper::index($item[$optionsKey], 'value');
}
});
$adminUserNameList = $this->LocalService()->adminUser->fetchCol('realname', 'id > 0');
$result = [];
array_walk($exportSasList, function (&$item, $index) use($adminUserNameList, $formFileData, &$result, $formFieldOptions) {
if($item['update_time'] != 0) {
$oprtUserAndTime = sprintf('%s / %s', $adminUserNameList[$item['update_user_id']], DateHelper::formatTimestamp($item['update_time']));
}else {
$oprtUserAndTime = sprintf('%s / %s', $adminUserNameList[$item['create_user_id']], DateHelper::formatTimestamp($item['create_time']));
}
$result[$index] = array_fill_keys(array_keys($formFileData), '') ;
foreach($result[$index] as $k => &$v) {
$v = $item[$k] == 'null' ? '' : $item[$k];
if(isset($formFieldOptions[$k])) {
if($v !== '') {
$v = implode(',', array_column(
array_intersect_key($formFieldOptions[$k], array_flip(explode(',', $v))),
'label'
)
);
}else {
$v = '全部';
}
}
if($k == 'date_ym' && !$v) {
$v = '全量';
}
}
$result[$index] = ArrayUtils::merge($result[$index], [
'id' => $item['id'],
'path' => $item['path'],
'status' => $item['status'],
'applyUserName/dateTime' => $oprtUserAndTime
]);
});
return $this->RenderApiJson()->Success(
$result,
'',
[
'FormFileData' => array_values($formFileData),
'total' => $this->LocalService()->exportSas->getCount($listWhere)
]
);
}
/**
* Notes:删除导出受试者进度信息
* @param
* @return
* @author haojinhua
* @date 2025-08-29
*/
public function deleteAction(){
$id = $this->params()->fromPost('id',0);//信息ID
if (empty($id)) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '参数不正确');
$exportData = $this->LocalService()->exportSas->fetchOne([
'where' => [
'id' => $id,
'is_del' => 0
],
'columns' => ['id', 'category']
]);
if (empty($exportData)) return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '信息不存在!');
$save_data = [
'id'=>$id,
'is_del'=>1
];
$result = $this->LocalService()->exportSas->save($save_data);
if($result){
//日志
$log_type = 2;
$log_remark = sprintf("(新版) %s - 删除申请导出信息", $this->LocalService()->exportSas->getCategoryText((int) $exportData['category']));;
$this->LocalService()->log->saveFileLog($id,'ExportSas',$save_data,$log_type,$log_remark,'',' ',[]);
}
return $this->RenderApiJson()->success();
}
}

View File

@ -0,0 +1,251 @@
<?php
/**
*
* @authorllbjj
* @DateTime2024/6/27 11:19
* @Description
*
*/
namespace Application\Controller\Temple;
use Application\Mvc\Controller\BasicController;
use Application\Service\Exceptions\InvalidArgumentException;
use Laminas\Db\Sql\Predicate\NotIn;
use Laminas\Db\Sql\Predicate\Operator;
use Laminas\Mvc\Controller\AbstractActionController;
use Zend\Stdlib\ArrayUtils;
class ChecklistController extends BasicController
{
public function siglistAction() {
$type = $this->params()->fromPost('type', 0);
$sigList = $this->LocalService()->ocrSigpatient->fetchAll([
'where' => "pid = 0 and is_del = 0",
'columns' => ['id', 'name'],
'order' => ['number']
]);
$patientList = $this->LocalService()->ocrSigpatient->fetchCol('pid', "is_del = 0 and have_status < 2 and pid > 0");
$patientCountData = [];
if(!empty($patientList)) {
foreach($patientList as $pid) {
$patientCountData[$pid]++;
}
}
$checklistList = $this->LocalService()->templeChecklist->fetchAll([
'where' => 'is_del = 0',
'columns' => ['id', 'sig_id', 'patient_id', 'is_lock']
]);
$checklistPatientCountData = [];
$checklistNoLockPatientCountData = [];
if(!empty($checklistList) ) {
foreach($checklistList as &$checklist) {
$checklistPatientCountData[$checklist['sig_id']][$checklist['patient_id']] = $checklist['patient_id'];
if(!$checklist['is_lock'] && !$type ) $checklistNoLockPatientCountData[$checklist['sig_id']][$checklist['patient_id']] = $checklist['patient_id'];
}
}
$result = [];
if(!empty($sigList)) {
foreach ($sigList as &$sig) {
if(!$type) {
if( ! count( $checklistPatientCountData[$sig['id']] ?? [] ) ) continue;
$sig['patientCount'] = count( $checklistNoLockPatientCountData[$sig['id']] ?? [] ) . ' / ' . count( $checklistPatientCountData[$sig['id']] ?? [] ) . ' / ' . ( $patientCountData[$sig['id']] ?? 0 );
$result[] = &$sig;
}else if($type == 1) {
if(! ($patientCountData[$sig['id']] ?? 0)) continue;
$sig['patientCount'] = ( $patientCountData[$sig['id']] - count( $checklistPatientCountData[$sig['id']] ?? [] ) ) . ' / ' . $patientCountData[$sig['id']];
$result[] = &$sig;
}
}
}
return $this->RenderApiJson()->Success(array_values($result));
}
public function patientlistAction() {
$type = $this->params()->fromPost('type', 0);
$sig_id = $this->params()->fromPost('sig_id', 0);
$patientDatas = $this->LocalService()->ocrSigpatient->fetchAll([
'where' => [
'pid' => $sig_id,
'is_del' => 0,
new Operator('have_status', Operator::OP_LT, 2),
],
'columns' => ['id', 'name', 'pid', 'number'],
'order' => ['number']
]);
$result = [];
$annexCount = [];
if(!empty($patientDatas)) {
$templeChecklistList = $this->LocalService()->templeChecklist->fetchAll([
'where' => [
'is_del' => 0,
'sig_id' => $sig_id,
],
'columns' => ['id', 'annex_id', 'patient_id', 'is_lock']
]);
$checklistData = [];
if(!empty($templeChecklistList)) {
foreach($templeChecklistList as $key => &$templeChecklist) {
$checklistData[$templeChecklist['patient_id']]['count'] ++;
if($templeChecklist['is_lock']) $checklistData[$templeChecklist['patient_id']]['lock_count'] ++;
else $checklistData[$templeChecklist['patient_id']]['nolock_count'] ++;
}
}
if($type == 1) {
$annexList = $this->LocalService()->templeAnnex->fetchAll([
'where' => "is_del = 0",
'columns' => ['id', 'patient_id']
]);
if(!empty($annexList)) {
foreach($annexList as $annex) {
$annexCount[$annex['patient_id']]['annexCount'] ++;
}
}
}
foreach($patientDatas as &$patientData) {
$key = $patientData['number'];
for ($i = 0; $i < 8 - strlen($patientData['number']); $i++ ) {
$key = '0' . $key;
}
$patientData = ArrayUtils::merge($patientData, $checklistData[$patientData['id']] ?? []);
if( !$type ) {
if($patientData['nolock_count']) $result["0.{$key}"] = &$patientData;
else if($patientData['lock_count']) $result["1.{$key}"] = &$patientData;
}else {
$patientData = ArrayUtils::merge($patientData, $annexCount[$patientData['id']] ?? []);
if( !$patientData['count'] ) {
if(!$patientData['annexCount']) $result["3.{$key}"] = &$patientData;
else $result["2.{$key}"] = &$patientData;
}
}
}
ksort($result, SORT_NUMERIC );
}
return $this->RenderApiJson()->Success(array_values($result));
}
public function annexlistAction() {
$patient_id = $this->params()->fromPost('patient_id', 0);
if(empty($patient_id)) return $this->RenderApiJson()->Success();
$patientSex = $this->LocalService()->ocrSigpatient->getOneFieldVal('sex', ['id' => $patient_id]);
$sex_code = $patientSex == 1 ? 'boy' : 'girl';
$checklistAnnexIdArr = array_unique($this->LocalService()->templeChecklist->fetchCol('annex_id', ['patient_id' => $patient_id, 'is_del' => 0]));
$annexWhere = ['patient_id' => $patient_id];
if(!empty($checklistAnnexIdArr)) $annexWhere[] = new NotIn('id', $checklistAnnexIdArr);
$annexList = $this->LocalService()->templeAnnex->fetchAll([
'where' => $annexWhere,
'columns' => [ 'id', 'annex_path', 'annex_name' ]
]);
$keywordList = $this->LocalService()->ocrKeyword->fetchAll([
'where' => "is_del = 0 and keyword_code in ('CRP', 'hscrp')",
'columns' => [ 'category_name', 'keyword_code', 'keyword_name', 'keyword_unit', 'min' => "{$sex_code}_min", 'max' => "{$sex_code}_max"]
]);
$keywordData = [];
foreach($keywordList as &$keyword) {
$keywordData[$keyword['keyword_code']] = &$keyword;
}
return $this->RenderApiJson()->Success([
'annexlist' => $annexList,
'keywordData' => $keywordData
]);
}
public function listAction() {
$patient_id = $this->params()->fromPost('patient_id', 0);
$patientSex = $this->LocalService()->ocrSigpatient->getOneFieldVal('sex', ['id' => $patient_id]);
$sex_code = $patientSex == 1 ? 'boy' : 'girl';
$keywordList = $this->LocalService()->ocrKeyword->fetchAll([
'where' => "is_del = 0 and keyword_code in ('CRP', 'hscrp')",
'columns' => [ 'category_name', 'keyword_code', 'keyword_name', 'keyword_unit', 'min' => "{$sex_code}_min", 'max' => "{$sex_code}_max"]
]);
$keywordData = [];
foreach($keywordList as &$keyword) {
$keywordData[$keyword['keyword_code']] = &$keyword;
}
$result = $this->LocalService()->templeChecklist->fetchAll([
'where' => ['is_del' => 0, 'patient_id' => $patient_id],
'columns' => [ 'id', 'patient_id', 'sig_id', 'annex_id', 'raw_date', 'raw_code', 'raw_name', 'raw_result','raw_range','raw_unit', 'is_lock'],
'order' => ['raw_date']
]);
if(!empty($result)) {
$templeAnnexIdData = array_column($result, 'annex_id');
$annexNameData = $this->LocalService()->templeAnnex->fetchCol('annex_path', 'id in (' . implode(',', $templeAnnexIdData) . ')');
foreach($result as &$checklist) {
$checklist['annex_path'] = $annexNameData[$checklist['annex_id']] ?? '';
if($checklist['is_lock'] != 1){
$checklist['raw_unit'] = $keywordData[$checklist['raw_code']]['keyword_unit'];
$checklist['raw_range'] = implode(' - ', array_filter([
$keywordData[$checklist['raw_code']]['min'],
$keywordData[$checklist['raw_code']]['max']
], function($val) {
return strlen($val);
}));
}
}
}
return $this->RenderApiJson()->Success([
'checklist' => $result,
'keywordData' => $keywordData
]);
}
public function saveAction() {
$checklistData = $this->params()->fromPost();
$checklistData['is_lock'] = 1; // 默认提交就锁定
$this->LocalService()->templeChecklist->save($checklistData);
return $this->RenderApiJson()->Success();
}
public function lockAction() {
$id = $this->params()->fromPost('id', 0);
$is_lock = $this->params()->fromPost('is_lock', 1);
if(!$id) throw new InvalidArgumentException('无效的操作信息!');
$this->LocalService()->templeChecklist->updateField($id, 'is_lock', $is_lock);
return $this->RenderApiJson()->Success();
}
public function deleteAction() {
$id = $this->params()->fromPost('id', 0);
if(!$id) throw new InvalidArgumentException('无效的操作信息!');
$this->LocalService()->templeChecklist->upDelState("id = " . $id);
return $this->RenderApiJson()->Success();
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Application\Controller;
use Application\Mvc\Controller\ThirdToolController;
use Laminas\Cache\Exception\ExceptionInterface;
use Laminas\View\Model\JsonModel;
class ThirdController extends ThirdToolController
{
/**
* @throws ExceptionInterface
*/
public function sourceAction(): JsonModel
{
$sv = $this->params()->fromPost('sv');
$method = $this->params()->fromPost('method');
$params = $this->params()->fromPost('params');
$sourceData = $this->LocalService()->toolSys->sasSourceData($sv, $method, $params);
return $this->RenderApiJson()->Success([], '', ['data' => $sourceData]);
}
}

View File

@ -0,0 +1,222 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/4 13:42
* @Description登录
*
*/
namespace Application\Controller;
use Application\Common\Container;
use Application\Common\Crypt;
use Application\Common\RedisEnum;
use Application\Form\FieldForm;
use Application\Mvc\Controller\Plugins\RenderApiJson;
use Application\Service\Extension\ErrorHandler;
use Application\Service\Extension\Helper\ValidatorHelper;
use Application\Service\Extension\Identity\Identity;
use Application\Service\Extension\Laminas;
use Application\Form\LoginForm;
use Application\Common\StatusCode;
use Application\Service\Extension\Helper\StringHelper;
//use Application\Service\Extension\Model\XmlModel;
use Application\Service\Extension\Queue\jobs\SyncPatientFormJob;
use Application\Service\Extension\Queue\jobs\SyncPatientJob;
use Application\Service\Extension\Queue\QueueApplication;
//use Application\Service\Extension\Queue\QueueMessage;
//use Application\Service\Extension\Queue\job\TestQueue;
use Application\Service\Extension\Sms\SmsRateLimitException;
use Application\Service\Extension\Validator\ValidatorApplication;
use Application\Service\Extension\ValidatorV2\Validator;
use Application\Service\Extension\Xml\FormContentXmlGenerator;
use Application\Service\Extension\Xml\PatientXmlGenerator;
use Application\Service\Extension\Xml\XmlBuilder;
//use Application\Service\Extension\XmlGenerate;
use EasyWeChat\Kernel\Exceptions\InvalidConfigException;
use EasyWeChat\Kernel\Messages\Text;
use Exception;
use GuzzleHttp\Exception\GuzzleException;
use Laminas\Db\Sql\Where;
use Laminas\Http\Client;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Mvc\Exception\InvalidArgumentException;
use Laminas\View\Model\JsonModel;
use Laminas\View\Model\ViewModel;
use Overtrue\Socialite\Exceptions\AuthorizeFailedException;
use Overtrue\Socialite\User;
use Swoole\Coroutine\Http\Server;
use function Swoole\Coroutine\run;
/**
* Class LoginController
* @package Application\Controller
* @method Container LocalService()
* @method RenderApiJson RenderApiJson()
*/
class WechatController extends AbstractActionController
{
/**
* 微信回调入口
* @url xxx.com/wechat/entry
* @throws InvalidConfigException
* @throws \EasyWeChat\Kernel\Exceptions\BadRequestException
* @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
* @throws \ReflectionException
*/
public function entryAction()
{
if (isset($_GET["echostr"])) {
$echoStr = $_GET["echostr"];//从微信用户端获取一个随机字符赋予变量echostr
//valid signature , option访问地61行的checkSignature签名验证方法如果签名一致输出变量 echostr完整验证配置接口的操作
if($this->checkSignature()){
echo $echoStr;
exit;
}
} else {
$app = Laminas::$serviceManager->wechat->getApp();
$app->server->push(function($message) {
return $this->LocalService()->wechat->getMessage()->handle($message);
});
$response = $app->server->serve();
$response->send();
die;
}
}
/**
* 微信验签
* @return bool
*/
private function checkSignature()
{
$signature = $_GET["signature"];
$timestamp = $_GET["timestamp"];
$nonce = $_GET["nonce"];
$token = '66668888';
$tmpArr = array($token, $timestamp, $nonce);
sort($tmpArr, SORT_STRING);
$tmpStr = implode( $tmpArr );
$tmpStr = sha1( $tmpStr );
if( $tmpStr == $signature ){
return true;
}else{
return false;
}
}
/**
* 受试者绑定界面
* @url xxx.com/wechat/bind
* @return \Laminas\Http\Response|ViewModel
*/
public function bindAction()
{
if (!$_GET['code']) {
$redirectUrl = $this->LocalService()->wechat->getApp()
->oauth
->scopes(['snsapi_base'])->with(['forceSnapShot' => true])
->redirect("{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['HTTP_HOST']}/wechat/bind");
return $this->redirect()->toUrl($redirectUrl);
}
$view = new ViewModel();
$view->setTemplate('application/wechat/bind');
$this->layout('layout/wechat');
$view->setVariables([
'code' => $_GET['code'],
'host' => "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['HTTP_HOST']}"
]);
return $view;
}
/**
* 获取绑定微信短信验证码
* @url xxx.com/wechat/bind-captcha
* @return JsonModel
* @throws GuzzleException
*/
public function bindCaptchaAction(): JsonModel
{
$mobile = $this->params()->fromPost('mobile');
$code = $this->params()->fromPost('code');
$api = [
// 'http://lzy.kingdone.com/common/patient-mobile',
'https://www.5-mc.cn/common/patient-mobile',
'https://www.scitrials.cn/common/patient-mobile',
];
$hasMobile = false;
$arr = [];
foreach ($api as $item) {
$sign = md5($mobile . CommonController::SECRET_KEY);
$client = new \GuzzleHttp\Client();
$content = $client->get("{$item}?sign={$sign}&mobile={$mobile}")->getBody()->getContents();
if ($content === '1') {
$hasMobile = true;
$arr[$code][] = $item;
} elseif ($content === '-1') { // 已经绑定
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "当前手机号码无法绑定。请先解绑关联关系。");
}
}
if (!$hasMobile) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "当前手机号码无法绑定。请确定手机号是否正确。");
}
$captcha = mt_rand(1000, 9999);
Laminas::$serviceManager->redisExtend->getRedisInstance()->setex("bind:{$mobile}:{$captcha}:{$code}", 3600, json_encode($arr));
$this->LocalService()->sms->send($mobile, $captcha);
return $this->RenderApiJson()->Success();
}
/**
* 绑定
* @return JsonModel
* @throws GuzzleException
* @throws InvalidConfigException
* @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
* @throws \EasyWeChat\Kernel\Exceptions\RuntimeException
*/
public function bindSubmitAction(): JsonModel
{
$mobile = $this->params()->fromPost('mobile');
$captcha = $this->params()->fromPost('captcha');
$code = $this->params()->fromPost('code', '');
$captchaKey = "bind:{$mobile}:{$captcha}:{$code}";
$captchaCache = Laminas::$serviceManager->redisExtend->getRedisInstance()->get("bind:{$mobile}:{$captcha}:{$code}");
$openid = Laminas::$serviceManager->wechat->getApp()->oauth->userFromCode($code)->getId();
$user = $this->LocalService()->wechat->getApp()->user->get($openid);
if ($user && isset($user['errmsg'])) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "绑定失败。请重进页面重新进行绑定。");
}
if ($user['subscribe'] != 1) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "请关注公众号。");
}
if (!$captchaCache) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "验证码有误。");
}
foreach (StringHelper::jsonDecode($captchaCache) as $code => $urlArr) {
foreach ($urlArr as $item) {
$sign = md5($mobile . CommonController::SECRET_KEY);
$client = new \GuzzleHttp\Client();
$client->get("{$item}?sign={$sign}&mobile={$mobile}&openid={$openid}")->getBody()->getContents();
}
}
$this->LocalService()->wechat->getApp()->customer_service->message(new Text("您在" . date('Y-m-d H:i:s') . '绑定成功。'))->to($openid)->send();
Laminas::$serviceManager->redisExtend->getRedisInstance()->del($captchaKey);
return $this->RenderApiJson()->Success();
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,258 @@
<?php
namespace Application\Controller\item;
use Application\Common\StatusCode;
use Application\Form\item\patient\PatientFormModel;
use Application\Mvc\Controller\BasicController;
use Application\Service\DB\Db;
use Application\Service\DB\Dictionary\Form;
use Application\Service\DB\Dictionary\FormGroup;
use Application\Service\Exceptions\InvalidArgumentException;
use Application\Service\Extension\Formatter\Formatter;
use Application\Service\Extension\Formatter\QuestionFormatter;
use Application\Service\Extension\Helper\DataHelper;
use Application\Service\Extension\Helper\SDMHelper;
use Application\Service\Extension\Helper\StringHelper;
use Application\Service\Extension\Laminas;
use Exception;
use Laminas\View\Model\JsonModel;
class QuestionController extends BasicController
{
/**
* @actionUrl /question/view
* @return JsonModel
* @throws Exception
*/
public function questionViewAction(): JsonModel
{
$this->validator->attach(
[['patient_id', 'form_id', 'checktime_id'], 'required']
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
// 一对多 表单 图片质疑,常规识别 的图片 独立入口不在表单中所以id = 0
if (SDMHelper::app()->form->getGroupId($this->validator->attributes['form_id']) == FormGroup::NORMAL_OCR && SDMHelper::app()->form->getType($this->validator->attributes['form_id']) == Form::FORM_TYPE_MULTI) {
$formId = 0;
}else {
$formId = Laminas::$serviceManager->patientFormContent->fetchOne(['where' => ['form_id' => $this->validator->attributes['form_id'], 'patient_id' => $this->validator->attributes['patient_id'], 'checktime_id' => $this->validator->attributes['checktime_id'], 'is_del' => 0]])['id'] ?? 0;
}
// if (SDMHelper::app()->form->getGroupId($this->validator->attributes['form_id']) == FormGroup::NORMAL_OCR && SDMHelper::app()->form->getType($this->validator->attributes['form_id']) == Form::FORM_TYPE_MULTI) {
return $this->RenderApiJson()->Success([
'id' => $formId,
SDMHelper::app()->form->getShareFormField($this->validator->attributes['form_id'])['id'] => SDMHelper::app()->form->getShareFormImages($this->validator->attributes['form_id'], $this->validator->attributes['patient_id'], $this->validator->attributes['checktime_id'])
// 'shareFormImages' => SDMHelper::app()->form->getShareFormImages($this->validator->attributes['form_id'], $this->validator->attributes['patient_id'], $this->validator->attributes['checktime_id'])
]);
// return $this->RenderApiJson()->Success([
// 'id' => 0,
//// SDMHelper::app()->form->getShareFormField($this->validator->attributes['form_id'])['id'] => SDMHelper::app()->form->getShareFormImages($this->validator->attributes['form_id'], $this->validator->attributes['patient_id'], $this->validator->attributes['checktime_id'])
// 'shareFormImages' => SDMHelper::app()->form->getShareFormImages($this->validator->attributes['form_id'], $this->validator->attributes['patient_id'], $this->validator->attributes['checktime_id'])
// ]);
// }
throw new InvalidArgumentException('表单类型有误。');
}
/**
* 回复表单质疑
* @url http://xxx.com/v1/item/question/replyQuestion
* @return JsonModel
* @throws Exception
*/
public function replyQuestionAction(): JsonModel
{
// 改版了 `content` 现在没用了
$this->validator->attach(
[['question_id', 'content'], 'required']
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
Db::beginTransaction();
$questionData = $this->LocalService()->itemQuestion->fetchOne([
'where' => ['id' => $this->validator->attributes['question_id']]
]);
// 新增回复历史
$this->LocalService()->itemReply->insert([
'question_id' => $this->validator->attributes['question_id'],
'reply_status' => 0,
'remarks' => json_encode([
// 表单数据
'formData' => call_user_func(function () use ($questionData) {
// 获取表单原始数据
if($questionData['content_id']) {
$model = new PatientFormModel();
$originData = $this->handleFormData($model->viewById($questionData['content_id']));
}else {
// 常规识别且一对多表单,只提取共享图片
$originData = [
SDMHelper::app()->form->getShareFormField($questionData['form_id'])['id'] => SDMHelper::app()->form->getShareFormImages($questionData['form_id'], $questionData['patient_id'], $questionData['checktime_id'])
];
}
$postData = DataHelper::handleFormData($this->params()->fromPost(), $questionData['form_id']);
foreach ($postData as $postKey => &$postDatum) {
if ($postDatum === '[]') {
$postDatum = [];
}
if (is_numeric($postKey)) {
$originData[$postKey] = $postDatum;
}
}
return $originData;
}),
// 表单结构
'form' => call_user_func(function () use ($questionData) {
return $this->getQuestionTypeId(
$questionData['content_id'],
$questionData['form_id'],
$questionData['question_type_id']
);
}),
'remarks' => $this->validator->attributes['reply']
]),
'annex_aligned' => '',
'completed_id' => $this->LocalService()->identity->getId(),
'completed_time' => time(),
'completed_type' => 1,
'is_del' => 0,
]);
// 修改疑问状态
// 提出疑问的content要变成上一次回复的数据
$this->LocalService()->itemQuestion->update([
// 'content' => json_encode($this->formData), // $this->validator->attributes['content'],
'question_status' => 1
], [
'id' => $this->validator->attributes['question_id']
]);
Db::commit();
//异步处理访视进度情况信息
$form_content_arr = !empty($questionData['content_id']) ? [$questionData['content_id']] : [];
Laminas::$serviceManager->swTaskClient->send([
'svName' => 'projectPatientworkbatch',
'methodName' => 'multipleUpdateData',
'params' => [
'item_id' => $questionData['item_id'],
'itemsig_id' => $questionData['item_sign_id'],
'patient_id' => $questionData['patient_id'],
'checktime_id' => $questionData['checktime_id'],
'form_id' => $questionData['form_id'],
'operate_type'=>11,
'content_id'=>!empty($form_content_arr) ? $form_content_arr : [],
'user_id' => Laminas::$serviceManager->identity->getId()
]
]);
unset($form_content_arr);
return $this->RenderApiJson()->Success();
}
private function handleFormData(array $formData): array
{
foreach ($formData as $k => $item) {
if (stripos($k, '-') !== false) {
$key = (explode('-', $k)[0]);
$formData[$key] = $item;
unset($formData[$k]);
}
}
return $formData;
}
/**
* @param int $contentId
* @param int $formId
* @param string $questionTypeId
* @param string $originFormData
* @return array
*/
private function getQuestionTypeId(int $contentId, int $formId, string $questionTypeId): array
{
if (!$questionTypeId || !$formId) {
return [];
}
$form = SDMHelper::app()->setAttributes([
'formId' => $formId,
])->form;
$isValidContentId = ! ( $form->getType() == Form::FORM_TYPE_MULTI && $form->getGroupId() == FormGroup::NORMAL_OCR );
if($isValidContentId && !$contentId) {
return [];
}
$data = explode(',', $questionTypeId);
foreach ($data as $datum) {
$formData = $this->LocalService()->itemFormVersion->getField(['form_id' => $formId], true);
if (isset($formData[$datum])) {
$res[] = $this->LocalService()->itemForm->buildConfig($formData[$datum]);
}
}
return $res ?? [];
}
/**
* @url http://xxx.com/v1/item/question/historyReply
* @return JsonModel
* @throws Exception
*/
public function historyReplyAction(): JsonModel
{
$this->validator->attach(
[['question_id', 'reply_id'], 'required']
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
$query = $this->LocalService()->itemReply->fetchOne([
'where' => ['id' => $this->validator->attributes['reply_id']]
]) ?? [];
Formatter::format($query, new QuestionFormatter());
if (is_array($query['remarks']['formData'])) {
foreach ($query['remarks']['formData'] as &$remark) {
// ErrorHandler::log2txt($remark);
if (is_numeric($remark)) {
continue;
}
$d = StringHelper::jsonDecode($remark, false);
if ($d !== false) {
$remark = $d;
}
}
}
if (isset($query['remarks']['remarks'])) {
array_unshift($query['remarks']['form'], [
'label' => '回复内容',
'prop' => 'reply',
'type' => 'Text',
'disabled' => true
]);
$query['remarks']['formData']['reply'] = $query['remarks']['remarks'];
}
return $this->RenderApiJson()->Success($query);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,406 @@
<?php
namespace Application\Controller\project;
use Application\Common\Ocr;
use Application\Common\StatusCode;
use Application\Form\item\patient\PatientFormModel;
use Application\Mvc\Controller\BasicController;
use Application\Service\DB\Dictionary\Form;
use Application\Service\DB\Dictionary\FormGroup;
use Application\Service\Exceptions\InvalidArgumentException;
use Application\Service\Extension\Helper\ArrayHelper;
use Application\Service\Extension\Helper\DataHelper;
use Application\Service\Extension\Helper\SDMHelper;
use Application\Service\Extension\Laminas;
use Laminas\Db\Sql\Predicate\IsNotNull;
use Laminas\Db\Sql\Predicate\Like;
use Laminas\Db\Sql\Predicate\Operator;
use Laminas\View\Model\JsonModel;
use Laminas\View\Model\ViewModel;
class SaeController extends BasicController
{
/**
* @return JsonModel|ViewModel
*/
public function indexAction(): JsonModel
{
$MINI = $this->LocalService()->identity->getPlatform();
$user_id = $this->LocalService()->identity->getId();
$flag = 0;
if (stripos($MINI, 'MINI') !== false) {
$flag = 1;
}
$itemId = $this->params()->fromPost('item_id', 0);
// 0为小项目, 1为大项目
$type = $this->params()->fromPost('type', 0);
$search =$_POST['search']?:'';
$condition = ['id' => $itemId];
$query = $this->LocalService()->itemInfo->fetchOne(['columns' => ['id', 'name', 'fid'], 'where' => $condition]);
if (!isset($query['fid'])) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR,'参数不太对呀');
}
if (!empty($flag)) {
$user_id = $this->LocalService()->signatoryUser->findsignatoryUser($user_id);
$res = $this->LocalService()->itemSignatory->userRoleSignInfo($itemId, $user_id, $search,0,1) ?: [];
foreach ($res as &$item) {
$item['name'] = $item['info_name'];
$item['signatory_id'] = $item['id'];
unset($item['info_name']);
}
} else {
$allSignatoryId = $this->LocalService()->itemSignatory->fetchAll([
'order' => ['order ASC'],
'columns' => ['id', 'signatory_id', 'number'],
'where' => ['item_id' => $query['fid']]]
);
$res = [];
foreach ($allSignatoryId as $item) {
if (
$childData = $this->LocalService()->signatoryInfo->fetchOne([
'columns' => ['info_name AS name'],
'where' => ['id' => $item['signatory_id']]
])
) {
$childData['id'] = $itemId;
$childData['signatory_id'] = $item['id'];
$childData['name'] = "{$item['number']}{$childData['name']}";
$res[] = $childData;
}
}
}
return $this->RenderApiJson()->Success($res);
}
/**
* @url xxx.com/v1/item/sae/patient
* @return JsonModel
*/
public function patientAction(): JsonModel
{
$itemsig_id = $this->params()->fromPost('itemsig_id');
if($itemsig_id == 'undefined'){
$itemsig_id = 0;
}
$item_id = $this->params()->fromPost('item_id');
if($item_id == 'undefined'){
$item_id = 0;
}
$search_keyword = $this->params()->fromPost('search_keyword'); //受试者关键字 可以是编号 或者名称 或者缩写
if(empty($itemsig_id) || empty($item_id)){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '项目或中心参数有误!');
}
$patient_where = [
'is_del' => 0,
'itemsig_id' => $itemsig_id,
'item_id' => $item_id,
];
if(!empty($search_keyword)){
$patient_where[] = [
'or' => [
new Like('patient_number', "%{$search_keyword}%"),
new Like('patient_name', "%{$search_keyword}%"),
new Like('patient_name_easy', "%{$search_keyword}%"),
]
];
}
$query = $this->LocalService()->patient->fetchAll([
'where' =>$patient_where,
'columns' => ['patient_name', 'id', 'patient_number'],
'order' => ['patient_order','id']
]);
//总sea数据量
$total = 0;
$no_sae_arr = [];
if(!empty($query)){
$form_id = $this->LocalService()->itemForm->getOneFieldVal('id',[
'item_id' => $item_id,
'group_id' => FormGroup::SAE,
'is_del' => 0,
]);
if(empty($form_id)){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '请先设置该项目的SAE表单信息');
}
$all_total = $this->LocalService()->patientFormContent->getsaeNum([
'item_id' => $item_id,
'itemsig_id' => $itemsig_id,
'form_id' => $form_id,
'is_del' => 0,
]);
$all_total = !empty($all_total) ? $all_total : [];
$total = !empty($all_total[$item_id][$itemsig_id][$form_id]['allnum']) ? $all_total[$item_id][$itemsig_id][$form_id]['allnum'] : 0;
foreach ($query as $queryKey=>&$item) {
$patient_saenum = !empty($all_total[$item_id][$itemsig_id][$form_id][$item['id']]['patientnum']) ? $all_total[$item_id][$itemsig_id][$form_id][$item['id']]['patientnum']: 0;
if($item['patient_number'] != ''){
$item['patient_name'] = "".$item['patient_number']."".$item['patient_name'];
}
$item = [
'id' => $item['id'],
'patient_name' => $item['patient_name']."(".$patient_saenum.")",
];
$item['patient_saenum'] = $patient_saenum;
if(empty($patient_saenum)){
$no_sae_arr[] = $item;
unset($query[$queryKey]);
}
unset($item['patient_number']);
}
}
$query = array_values($query);
if(!empty($no_sae_arr)){
$query = !empty($query) ? array_merge($query,$no_sae_arr) : $no_sae_arr;
}
unset($no_sae_arr);
//搜索表结构
$serchFormFileData[] = [
"type" => "Input",
"label" => "关键字",
"placeholder" => "请输入关键字",
"prop" => "search_keyword",
];
return $this->RenderApiJson()->Success($query,'',['total'=>$total,'SerchFormFileData'=>$serchFormFileData]);
}
/**
* Notes: 获取SAE数量
* @param
* @return
* @author haojinhua
* @date 2024-09-06
*/
public function saecountAction(){
$itemsig_id = $this->params()->fromPost('itemsig_id');
$item_id = $this->params()->fromPost('item_id');
if(empty($itemsig_id || empty($item_id))){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, '项目或中心参数有误!');
}
//总sea数据量
$total = 0;
$form_id = $this->LocalService()->itemForm->getOneFieldVal('id',[
'item_id' => $item_id,
'group_id' => FormGroup::SAE,
'is_del' => 0,
]);
if(!empty($form_id)){
$all_total = $this->LocalService()->patientFormContent->getsaeNum([
'item_id' => $item_id,
'itemsig_id' => $itemsig_id,
'form_id' => $form_id,
'is_del' => 0,
]);
$all_total = !empty($all_total) ? $all_total : [];
$total = !empty($all_total[$item_id][$itemsig_id][$form_id]['allnum']) ? $all_total[$item_id][$itemsig_id][$form_id]['allnum'] : 0;
}
//获取cm的数据量
$cm_total = call_user_func(fn() => $this->LocalService()->patientFormContentCm->getCount(['status' => 0, 'is_del' => 0, 'sign_id' => $itemsig_id, 'item_id' => $item_id]));
//获取待判断AE的数据量
$ae_total = $this->LocalService()->itemCsae->getCount([
'is_del' => 0,
'item_id' => $item_id,
'itemsig_id' => $itemsig_id,
'is_ae_sure' => 0,
'is_normal_type' => 2,
]);
return $this->RenderApiJson()->Success(['sae_total'=>$total,'cm_total'=>$cm_total,'ae_total'=>$ae_total]);
}
/**
* @url http://xx.com/v1/item/sae/form
* @return JsonModel
* @throws \Exception
*/
public function formAction(): JsonModel
{
$itemId = $this->params()->fromPost('item_id', 0);
$saeForm = $this->LocalService()->itemForm->fetchOne([
'columns' => ['id', 'type', 'show_type'],
'where' => ['item_id' => $itemId, 'group_id' => FormGroup::SAE, 'is_del' => 0]
]);
if (!$saeForm) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "未发现SAE表单呢 /(ㄒoㄒ)/~~");
}
return $this->RenderApiJson()->Success(ArrayHelper::merge($this->LocalService()->itemForm->getPreviewConfig($saeForm['id']), [
'type' => $saeForm['type'],
'show_type' => $saeForm['show_type'] ?: 'right',
'form_id' => $saeForm['id']
]));
}
public function generateFormData(array $postData)
{
foreach ($postData as $key => $datum) {
if (stripos($datum, ',') !== false && stripos($datum, '[{') === false) {
$postData[$key] = explode(',', $datum);
}
}
return json_encode($postData);
}
public function oldcreateAction()
{
$request = $this->params();
$postData = $this->generateFormData($this->params()->fromPost());
if ($request->fromPost('id')) {
Laminas::$serviceManager->patientFormContent->save([
'id' => $request->fromPost('id'),
'patient_id' => $this->validator->attributes['patient_id'],
'form_id' => $this->validator->attributes['form_id'],
'data' => $postData,
'item_id' => $this->validator->attributes['item_id'],
'itemsig_id' => $this->validator->attributes['itemsig_id'],
]);
} else {
Laminas::$serviceManager->patientFormContent->save([
'patient_id' => $this->validator->attributes['patient_id'],
'form_id' => $this->validator->attributes['form_id'],
'data' => $postData,
'item_id' => $this->validator->attributes['item_id'],
'checktime_id' => 0,
'itemsig_id' => $this->validator->attributes['itemsig_id'],
]);
}
return $this->RenderApiJson()->Success();
}
/**
* Notes: SAE保存
* User: lltyy
* DateTime: 2025/3/25 10:06
*
* @return JsonModel
* @throws \Exception
*/
public function createAction(): JsonModel
{
$this->validator->attributes['checktime_id'] = 0;
$this->validator->attach(
[['patient_id', 'form_id', 'item_id', 'itemsig_id'], 'required'],
[['patient_id', 'form_id', 'item_id', 'itemsig_id'], 'integer'],
[[Form::ATTACH_SDTX], 'default', 'value' => '[]']
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, $this->validator->getFirstErrorToString());
}
$model = new PatientFormModel($this->validator);
$postData = DataHelper::handleFormData($this->validator->attributes, $this->params()->fromPost('form_id'));
if (SDMHelper::app()->setAttributes(['form_id' => $this->params()->fromPost('form_id')])->form->getIsUsingScore() == 1) {
throw new InvalidArgumentException('评分类表单不允许操作。');
}
$reason = $this->validator->attributes['reason'];
if(!empty($reason)){
$reason_res = [];
$reason_datas = json_decode($reason,true);
foreach ($reason_datas as $reason_data){
$reason_res[] = [
'filed_id'=>$reason_data['filed_id'],
'modify_reason'=>$reason_data['modify_reason'],
];
}
unset($reason_datas);
$reason = json_encode($reason_res,true);
}
unset($this->validator->attributes['reason']);
$postData['note'] = $reason;
if ($this->validator->attributes['id']) {
$model->editForm($postData);
} else {
$insertId = $model->createForm($postData);
return $this->RenderApiJson()->Success([
'id' => $insertId
]);
}
return $this->RenderApiJson()->Success();
}
public function viewAction(): JsonModel
{
if($this->request->isPost()){
$patient_id = $this->params()->fromPost('patient_id');
$form_id = $this->params()->fromPost('form_id',0);
//获取表单类型
$addFalseMes = '';
$formGroup = 0;
if(!empty($form_id)){
$formGroup = Laminas::$serviceManager->itemForm->getOneFieldVal('group_id',[
'id' => $this->validator->attributes['form_id'],
]);
}
//判断SAE表单操作时该患者是否已经开始访视【即判断是否存在有基点日期的访视期数据】
if(!empty($patient_id) && $formGroup == FormGroup::SAE){
$patientChecktimeCount = $this->LocalService()->itemPatientchecktime->getCount([
'is_del' => 0,
'patient_id' => $this->validator->attributes['patient_id'],
new Operator('anchor_date', Operator::OP_GT, 0),
NEW IsNotNull('anchor_date')
]);
if(empty($patientChecktimeCount)){
$addFalseMes = '该患者的访视还未开始不可增加SAE数据';
}
unset($patientChecktimeCount);
}
unset($formGroup);
$this->validator->setAttributes([
'patient_id' => $patient_id,
'form_id' => $form_id,
]);
$model = new PatientFormModel($this->validator);
$form_count = $this->LocalService()->itemForm->getCount([
'is_del' => 0,
'id' => $form_id
]);
if(empty($form_count)){
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR, "无此表单信息!");
}
return $this->RenderApiJson()->Success($model->setDataHaveDel(true)->view(), 'OK', [
'total' => $model->getFormMultiTotalCount(),
'addFalseMes'=>$addFalseMes
]);
}else{
return $this->RenderApiJson()->Error(StatusCode::E_FIELD_VALIDATOR,'非法请求');
}
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace Application\Controller\project\ae;
use Application\Common\StatusCode;
use Application\Form\project\AeForm;
use Application\Mvc\Controller\BasicController;
use Application\Service\DB\Dictionary\FormGroup;
use Application\Service\Extension\Formatter\Formatter;
use Application\Service\Extension\Formatter\FormFormatter;
use Application\Service\Extension\Helper\ArrayHelper;
use Laminas\View\Model\JsonModel;
class AeController extends BasicController
{
/**
* 渲染表格内容
* @return JsonModel
* @throws \Exception
*/
public function indexAction(): JsonModel
{
$this->validator->attach(
[['item_id', 'ae_type'], 'required']
);
if (!$this->validator->isValid()) {
return $this->RenderApiJson()->Error(
StatusCode::E_FIELD_VALIDATOR,
$this->validator->getFirstErrorToString()
);
}
$model = new AeForm($this->validator);
$data = [];
// 属于新增AE表单, 属于已有AE
if (in_array($this->validator->attributes['ae_type'], [5, 6])) {
$data = $model->renderNewAeTable();
}
return $this->RenderApiJson()->Success($data);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Application\Controller\v2;
use Application\Models\logic\patientForm\PatientFormLogic;
use Application\Mvc\Controller\BasicController;
use Application\Service\Extension\Logger\BasicLogger;
use Laminas\View\Model\JsonModel;
class PatientFormController extends BasicController
{
/**
* 受试者表单激活/失活
* @return JsonModel
*/
public function inactiveAction(): JsonModel
{
$logicModel = new PatientFormLogic();
$logicModel->setLogger(new BasicLogger());
$logicModel->executeWithTransaction('inactive');
return $this->RenderApiJson()->Success();
}
}

View File

@ -0,0 +1,24 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/7 21:30
* @Description
*
*/
namespace Application\Factory;
use Psr\Container\ContainerInterface;
class ChainFactory implements \Laminas\ServiceManager\Factory\FactoryInterface
{
/**
* @inheritDoc
*/
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
$defaultDbAdapter = $container->get('dbAdapter');
return new $requestedName($defaultDbAdapter, $container, $options);
}
}

View File

@ -0,0 +1,23 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/4 20:02
* @Description
*
*/
namespace Application\Factory;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
class DbFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
// TODO: Implement __invoke() method.
$defaultDbAdapter = $container->get('dbAdapter');
return new $requestedName($defaultDbAdapter, $container);
}
}

View File

@ -0,0 +1,27 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/4 20:17
* @Description
*
*/
namespace Application\Factory;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
class EdcDbFactory implements FactoryInterface
{
/**
* @inheritDoc
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
// TODO: Implement __invoke() method.
$defaultDbAdapter = $container->get('edcDbAdapter');
return new $requestedName($defaultDbAdapter, $container);
}
}

View File

@ -0,0 +1,27 @@
<?php
/**
*
* @authorllbjj
* @DateTime2024/5/28 23:06
* @Description
*
*/
namespace Application\Factory;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Psr\Container\ContainerInterface;
class ListenerFactory implements FactoryInterface
{
/**
* @inheritDoc
*/
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
// TODO: Implement __invoke() method.
return new $requestedName($container);
}
}

View File

@ -0,0 +1,29 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/7 21:30
* @Description
*
*/
namespace Application\Factory;
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
class LogDbFactory implements \Laminas\ServiceManager\Factory\FactoryInterface
{
/**
* @inheritDoc
*/
public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
{
// TODO: Implement __invoke() method.
$defaultDbAdapter = $container->get('logDbAdapter');
return new $requestedName($defaultDbAdapter, $container);
}
}

View File

@ -0,0 +1,23 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/4 20:02
* @Description
*
*/
namespace Application\Factory;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
class QueryFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
// TODO: Implement __invoke() method.
$defaultDbAdapter = $container->get('queryDbAdapter');
return new $requestedName($defaultDbAdapter, $container);
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Application\Factory;
use Application\Service\Redis\RedisExtend;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
class RedisExtendFactory implements FactoryInterface
{
private static ?RedisExtend $instance = null;
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$redisConfig = $container->get('config')['caches']['Redis']['adapter']['options'];
if (self::$instance !== null) {
return self::$instance->setDatabase($redisConfig['database']);
}
// TODO: Implement __invoke() method.
self::$instance = new $requestedName($redisConfig);
return self::$instance;
}
}

View File

@ -0,0 +1,28 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/4 21:28
* @Description
*
*/
namespace Application\Factory;
use Interop\Container\ContainerInterface;
use Interop\Container\Exception\ContainerException;
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
class ServiceFactory implements \Laminas\ServiceManager\Factory\FactoryInterface
{
/**
* @inheritDoc
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
// TODO: Implement __invoke() method.
return (null === $options) ? new $requestedName($container) : new $requestedName($container, $options);
}
}

View File

@ -0,0 +1,27 @@
<?php
/**
*
* @authorllbjj
* @DateTime2022/5/4 20:17
* @Description
*
*/
namespace Application\Factory;
use Interop\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
class ShareDbFactory implements FactoryInterface
{
/**
* @inheritDoc
*/
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
// TODO: Implement __invoke() method.
$defaultDbAdapter = $container->get('shareDbAdapter');
return new $requestedName($defaultDbAdapter, $container);
}
}

View File

@ -0,0 +1,188 @@
<?php
namespace Application\Form;
use Application\Common\EventEnum;
use Application\Form\item\patient\PatientFormModel;
use Application\Form\project\AeForm;
use Application\Service\DB\Db;
use Application\Service\Extension\Helper\DataHelper;
use Application\Service\Extension\Helper\LogHelper;
use Application\Service\Extension\Helper\SDMHelper;
use Application\Service\Extension\Helper\StringHelper;
use Application\Service\Extension\Laminas;
use Laminas\Json\Json;
use Laminas\Stdlib\ArrayUtils;
/**
* @property-read int $cmContentId
* @property-read string $note
*/
class CmAEModel extends PatientFormModel
{
/**
* 受试者新增AE
* @return void
* @throws \Exception
*/
public function createNewPatientAE()
{
$aeFormId = SDMHelper::app()->form->getAeForm($this->validator->attributes['item_id'])['id'];
$this->setPostValues(ArrayUtils::merge(Json::decode($this->validator->attributes['ae'], Json::TYPE_ARRAY), [
'form_id' => $aeFormId,
'cm_content_id' => $this->validator->attributes['id'] // 用药ID
]));
Db::beginTransaction();
// 清理表单的attach
LogHelper::$attach = [];
$this->event = EventEnum::EVENT_CM_AE_FORM_CONTENT_CREATE;
$this->initLoggerData();
$AeModel = new \Application\Form\project\AeForm();
$branchHashString = StringHelper::generateHashValue();
$contentId = Laminas::$serviceManager->itemPatientAeContent->save([
'patient_id' => $this->patientId,
'item_id' => $this->itemId,
'itemsig_id' => $this->itemsigId,
'data' => json_encode($this->postData),
'is_del' => 0,
'csae_id' => 0,
'new_ae_list' => 0,
'ae_type' => 6, // 受试者新增AE
'branch' => $branchHashString,
'form_id' => $aeFormId,
'is_skip' => 0,
'is_complete' => $AeModel->getIsComplete($this->validator->attributes,$aeFormId)
]);
Laminas::$serviceManager->itemCsaeRelation->insert([
'csae_id' => 0,
'new_ae_list_id' => 0,
'content_id' => $contentId,
'patient_id' => $this->patientId,
'branch' => $branchHashString,
'cm_content_id' => $this->cmContentId
]);
$this->h()->log->setTraceAttach('在CM判断中新增了受试者AE表单数据。');
$this->logger->setContentId($contentId)->flush([
'item_id' => $this->itemId,
'patient_id' => $this->patientId,
'form_id' => $aeFormId,
'checktime_id' => $this->checktimeId ?: 0,
]);
Db::commit();
//异步处理访视进度情况信息
Laminas::$serviceManager->swTaskClient->send([
'svName' => 'projectPatientworkbatch',
'methodName' => 'multipleUpdateData',
'params' => [
'item_id' => $this->itemId,
'itemsig_id' => $this->itemsigId,
'patient_id' => $this->patientId,
'checktime_id' => -1,
'form_id' => $aeFormId,
'operate_type'=>10,
'content_id'=>!empty($contentId) ? [$contentId] : [],
'user_id' => Laminas::$serviceManager->identity->getId()
]
]);
}
public function createAlreadyHaveAE()
{
Db::beginTransaction();
// 清理表单的attach
LogHelper::$attach = [];
$relationData = Laminas::$serviceManager->itemCsaeRelation->fetchOne([
'where' => ['content_id' => $this->validator->attributes['checked_content_id']]
]);
Laminas::$serviceManager->itemCsaeChecked->update([
'is_del' => 1,
], ['cm_content_id' => $this->cmContentId, 'content_id' => StringHelper::jsonDecode($this->validator->attributes['ae'])['id']]);
Laminas::$serviceManager->itemCsaeChecked->insert([
'csae_id' => 0,
'new_id' => 0,
'content_id' => StringHelper::jsonDecode($this->validator->attributes['ae'])['id'],
'branch' => $relationData['branch'],
'cm_content_id' => $this->cmContentId
]);
Db::commit();
}
public function updateNote()
{
Laminas::$serviceManager->patientFormContentCm->update(['note' => $this->note], ['content_id' => $this->cmContentId]);
}
public function getNewAEList()
{
$model = new AeForm($this->validator);
$data = [];
return $model->renderNewAeTable();
}
public function getAlreadyHaveAE()
{
$model = new AeForm($this->validator);
$data = [];
return $model->renderNewAeTable();
}
public function editAEForm()
{
$aeFormId = SDMHelper::app()->form->getAeForm($this->validator->attributes['item_id'])['id'];
$this->setPostValues(ArrayUtils::merge($this->validator->attributes, [
'form_id' => $aeFormId
]));
$this->event = EventEnum::EVENT_CM_AE_FORM_CONTENT_EDIT;
$this->initLoggerData();
Laminas::$serviceManager->itemPatientAeContent->update([
'data' => json_encode(DataHelper::handleFormData($this->validator->attributes, $aeFormId)),
], ['id' => $this->id]);
$this->logger->setContentId($this->id)->flush([
'item_id' => $this->itemId,
'patient_id' => $this->patientId,
'form_id' => $aeFormId,
'checktime_id' => $this->checktimeId ?: 0,
]);
//异步处理访视进度情况信息
Laminas::$serviceManager->swTaskClient->send([
'svName' => 'projectPatientworkbatch',
'methodName' => 'multipleUpdateData',
'params' => [
'item_id' => $this->itemId,
'itemsig_id' => $this->itemsigId,
'patient_id' => $this->patientId,
'checktime_id' => -1,
'form_id' => $aeFormId,
'operate_type'=>11,
'content_id'=>!empty($this->id) ? [$this->id] : [],
'user_id' => Laminas::$serviceManager->identity->getId()
]
]);
}
}

Some files were not shown because too many files have changed in this diff Show More