|
@@ -108,56 +108,121 @@
|
|
|
placeholder="请描述指标数据来源条件,比如:诊断包含xxx, 诊断编码是xxx等等" />
|
|
|
</el-form-item>
|
|
|
<el-divider />
|
|
|
- <el-form ref="ruleFormRef" label-width="120px" :model="sqlForm" class="demo-ruleForm"
|
|
|
+ <el-form ref="upFormRef" label-width="180px" :model="sqlForm" class="demo-ruleForm"
|
|
|
:size="formSize">
|
|
|
<el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="开始时间">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="开始年份">
|
|
|
<el-form-item prop="startTime">
|
|
|
- <el-date-picker v-model="sqlForm.startTime" type="date" label="选择时间"
|
|
|
- placeholder="选择时间" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
|
|
|
+ <el-date-picker v-model="sqlForm.startTime" type="year" label="选择年份"
|
|
|
+ placeholder="选择年份" format="YYYY" value-format="YYYY" :disabled="false" />
|
|
|
</el-form-item>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="结束时间">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="结束年份">
|
|
|
<el-form-item prop="endTime">
|
|
|
- <el-date-picker v-model="sqlForm.endTime" type="date" label="选择时间"
|
|
|
- placeholder="选择时间" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
|
|
|
+ <el-date-picker v-model="sqlForm.endTime" type="year" label="选择年份"
|
|
|
+ placeholder="选择年份" format="YYYY" value-format="YYYY" :disabled="false" />
|
|
|
</el-form-item>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="sqlEdit(ruleFormRef)"> 指标sql编辑 </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="sqlExecute(ruleFormRef)"> 指标运行结果 </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="handWrite()"> 结果手动填写 </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="saveTargetDictResult()"> 指标结果保存 </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4">
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" @click="queryTargetReportResult()"> 指标结果查询 </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <el-form ref="upFormRef" label-width="180px" :model="sqlForm" class="demo-ruleForm" :size="formSize"
|
|
|
+ :disabled="isShowTargetResult" v-show="isShowTargetResult">
|
|
|
+ <el-row v-for="item in resultList">
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="公式-分子结果" prop="childResult">
|
|
|
- <el-input v-model="sqlForm.childResult" type="textarea" />
|
|
|
+ <el-form-item :label="item.childLabel" :prop="item.childLabel + item.index">
|
|
|
+ <el-input v-model="item.childResult" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="公式-分母结果" prop="momResult">
|
|
|
- <el-input v-model="sqlForm.momResult" type="textarea" />
|
|
|
+ <el-form-item :label="item.momLabel" :prop="item.momLabel + item.index">
|
|
|
+ <el-input v-model="item.momResult" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="分子/分母-结果" prop="calcResult">
|
|
|
- <el-input v-model="sqlForm.calcResult" type="textarea" />
|
|
|
+ <el-form-item :label="item.calcLabel" :prop="item.calcLabel + item.index">
|
|
|
+ <el-input v-model="item.calcResult" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" @click="sqlEdit(ruleFormRef)"> 指标sql编辑 </el-button>
|
|
|
+ </el-form>
|
|
|
+ <el-form ref="upFormRef" label-width="120px" :model="sqlForm" class="demo-ruleForm" :size="formSize"
|
|
|
+ v-show="isShowHandWrite">
|
|
|
+ <el-row v-for="e in 4">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item :label="'年份' + e" :prop="'year' + e" :rules="[
|
|
|
+ { type: 'number', message: '年份必须是数字' },
|
|
|
+ ]">
|
|
|
+ <el-input v-model.number="sqlForm['year' + e]" minlength="4" maxlength="4"
|
|
|
+ show-word-limit />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item>
|
|
|
- <el-button type="primary" @click="sqlExecute(ruleFormRef)"> 指标运行结果 </el-button>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item :label="'分子结果' + e" :prop="'childResult' + e">
|
|
|
+ <el-input v-model="sqlForm['childResult' + e]" minlength="1" maxlength="12"
|
|
|
+ show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item :label="'分母结果' + e" :prop="'momResult' + e">
|
|
|
+ <el-input v-model="sqlForm['momResult' + e]" minlength="1" maxlength="12"
|
|
|
+ show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item :label="'分子/分母-结果' + e" :prop="'calcResult' + e">
|
|
|
+ <el-input v-model="sqlForm['calcResult' + e]" minlength="1" maxlength="12"
|
|
|
+ show-word-limit />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
+ <el-row v-show="isShowQtResult">
|
|
|
+ <el-table :data="QtResultData" stripe border highlight-current-row row-key="childKey"
|
|
|
+ height="200" style="width: 100%">
|
|
|
+ <el-table-column prop="year" label="年份" header-align="center" />
|
|
|
+ <el-table-column prop="dataType" label="数据方式" header-align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.dataType == '1' ? 'sql统计' : '手动输入' }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="childResult" label="分子结果" header-align="center" />
|
|
|
+ <el-table-column prop="momResult" label="分母结果" header-align="center" />
|
|
|
+ <el-table-column prop="calcResult" label="计算结果" header-align="center" />
|
|
|
+ <el-table-column prop="op" label="统计人员" header-align="center" />
|
|
|
+ <el-table-column prop="opTime" label="统计时间" header-align="center" width="200" />
|
|
|
+ </el-table>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
</template>
|
|
|
</PageLayer>
|
|
@@ -172,14 +237,15 @@
|
|
|
import { ref, reactive, onMounted, nextTick } from 'vue'
|
|
|
import TargetTree from '../target-comm/targetTree.vue'
|
|
|
import SqlEditPage from '../target-comm/SqlEditPage.vue'
|
|
|
-import { ElMessage } from 'element-plus'
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import type { FormInstance, FormRules } from 'element-plus'
|
|
|
+import { clone } from '../../../utils/clone'
|
|
|
import { formatDate } from '../../../utils/date'
|
|
|
import PageLayer from '../../../layout/PageLayer.vue'
|
|
|
import { queryDept } from '../../../api/public-api'
|
|
|
import { selectTargetDictById, selectTargetDictTree, saveTargetDict } from '../../../api/target-management/target-dict'
|
|
|
import { employeeList } from "../../../api/zhu-yuan-yi-sheng/pat-info-query"
|
|
|
-import { targetSqlExecuteById } from '../../../api/target-management/target-sql'
|
|
|
+import { targetSqlExecuteById, saveTargetReportResult, selectTargetReportResult } from '../../../api/target-management/target-sql'
|
|
|
|
|
|
const targetTreeData = ref({
|
|
|
data: [{}],
|
|
@@ -188,6 +254,12 @@ const targetTreeData = ref({
|
|
|
|
|
|
const isShowTree = ref(false)
|
|
|
const isShowForm = ref(false)
|
|
|
+// 是否显示指标sql运行结果
|
|
|
+const isShowTargetResult = ref(false)
|
|
|
+// 是否显示指标手动输入结果
|
|
|
+const isShowHandWrite = ref(false)
|
|
|
+// 是否显示指标查询结果
|
|
|
+const isShowQtResult = ref(false)
|
|
|
const nowDay = new Date()
|
|
|
const ds = formatDate(nowDay)
|
|
|
const deptWardList = ref([])
|
|
@@ -285,13 +357,27 @@ let sqlForm = $ref({
|
|
|
calcMom: '', // 计算分母sql
|
|
|
startTime: '', // 计算开始时间
|
|
|
endTime: '', // 计算结束时间
|
|
|
- childResult: '', // 计算分子结果
|
|
|
- momResult: '', // 计算分母结果
|
|
|
- calcResult: '' // 计算结果
|
|
|
+ year1: '', // 计算年份1
|
|
|
+ childResult1: '', // 计算分子结果1
|
|
|
+ momResult1: '', // 计算分母结果1
|
|
|
+ calcResult1: '', // 计算结果1
|
|
|
+ year2: '', // 计算年份2
|
|
|
+ childResult2: '', // 计算分子结果2
|
|
|
+ momResult2: '', // 计算分母结果2
|
|
|
+ calcResult2: '', // 计算结果2
|
|
|
+ year3: '', // 计算年份3
|
|
|
+ childResult3: '', // 计算分子结果3
|
|
|
+ momResult3: '', // 计算分母结果3
|
|
|
+ calcResult3: '', // 计算结果3
|
|
|
+ year4: '', // 计算年份4
|
|
|
+ childResult4: '', // 计算分子结果4
|
|
|
+ momResult4: '', // 计算分母结果4
|
|
|
+ calcResult4: '', // 计算结果4
|
|
|
})
|
|
|
|
|
|
const formSize = ref('default')
|
|
|
const ruleFormRef = ref<FormInstance>()
|
|
|
+const upFormRef = ref<FormInstance>()
|
|
|
|
|
|
const rules = $ref<FormRules>({
|
|
|
name: [
|
|
@@ -413,14 +499,22 @@ const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
if (isShowForm.value) {
|
|
|
isShowForm.value = false
|
|
|
}
|
|
|
-
|
|
|
- formEl.resetFields()
|
|
|
+ if (isShowTargetResult.value) {
|
|
|
+ isShowTargetResult.value = false
|
|
|
+ }
|
|
|
+ if (isShowHandWrite.value) {
|
|
|
+ isShowHandWrite.value = false
|
|
|
+ }
|
|
|
+ if (isShowQtResult.value) {
|
|
|
+ isShowQtResult.value = false
|
|
|
+ }
|
|
|
|
|
|
sqlForm.startTime = ''
|
|
|
sqlForm.endTime = ''
|
|
|
- sqlForm.childResult = ''
|
|
|
- sqlForm.momResult = ''
|
|
|
- sqlForm.calcResult = ''
|
|
|
+ resultList = []
|
|
|
+
|
|
|
+ formEl.resetFields()
|
|
|
+ upFormRef.value?.resetFields()
|
|
|
}
|
|
|
|
|
|
const changeNode = async (formEl: FormInstance | undefined) => {
|
|
@@ -467,9 +561,11 @@ const treeNodeClick = (data: any, node: any, obj: any) => {
|
|
|
if (node.data) {
|
|
|
sqlForm.startTime = ''
|
|
|
sqlForm.endTime = ''
|
|
|
- sqlForm.childResult = ''
|
|
|
- sqlForm.momResult = ''
|
|
|
- sqlForm.calcResult = ''
|
|
|
+
|
|
|
+ resultList = []
|
|
|
+ if (isShowTargetResult.value === false) {
|
|
|
+ isShowTargetResult.value = true
|
|
|
+ }
|
|
|
|
|
|
queryParam.id = node.data.id
|
|
|
queryParam.pid = node.data.pid
|
|
@@ -484,11 +580,14 @@ const treeNodeClick = (data: any, node: any, obj: any) => {
|
|
|
ruleFormRef.value?.resetFields()
|
|
|
ruleFormRef.value?.clearValidate()
|
|
|
leafRulesChange(ruleFormRef.value)
|
|
|
+
|
|
|
+ upFormRef.value?.resetFields()
|
|
|
+ // 获取指标报表结果
|
|
|
+ queryTargetReportResult()
|
|
|
})
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -521,6 +620,22 @@ const sqlEdit = (formEl: FormInstance | undefined) => {
|
|
|
// --------------- sql编写结束 ------------
|
|
|
|
|
|
// --------------- sql运行 ----------------
|
|
|
+interface DataType {
|
|
|
+ id: string,
|
|
|
+ pid: string,
|
|
|
+ childLabel: string,
|
|
|
+ childResult: string,
|
|
|
+ momLabel: string,
|
|
|
+ momResult: string,
|
|
|
+ calcLabel: string,
|
|
|
+ calcResult: string,
|
|
|
+ index: number,
|
|
|
+ year: number,
|
|
|
+ dataType: string, // 数据统计类型:1 sql计算获得; 2 手动输入填写获得
|
|
|
+}
|
|
|
+
|
|
|
+let resultList = $ref(Array<DataType>)
|
|
|
+
|
|
|
const sqlExecute = (formEl: FormInstance | undefined) => {
|
|
|
if (!formEl) return
|
|
|
// 验证是否填写完整
|
|
@@ -563,19 +678,135 @@ const sqlExecute = (formEl: FormInstance | undefined) => {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ if (isShowHandWrite.value) {
|
|
|
+ isShowHandWrite.value = false
|
|
|
+ }
|
|
|
+ if (isShowTargetResult.value === false) {
|
|
|
+ isShowTargetResult.value = true
|
|
|
+ }
|
|
|
+
|
|
|
sqlForm.id = ruleForm.id
|
|
|
sqlForm.pid = ruleForm.pid
|
|
|
sqlForm.childId = ruleForm.childId
|
|
|
sqlForm.momId = ruleForm.momId
|
|
|
targetSqlExecuteById(sqlForm)
|
|
|
.then((res: any) => {
|
|
|
- let r = JSON.parse(JSON.stringify(res))
|
|
|
- sqlForm.childResult = r.r1
|
|
|
- sqlForm.momResult = r.r2
|
|
|
- sqlForm.calcResult = r.r3
|
|
|
+ resultList = res
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// ------------ 手动填值 ---------
|
|
|
+const handWrite = () => {
|
|
|
+ upFormRef.value?.resetFields()
|
|
|
+ if (isShowTargetResult.value) {
|
|
|
+ isShowTargetResult.value = false
|
|
|
+ }
|
|
|
+ resultList = []
|
|
|
+ isShowHandWrite.value = true
|
|
|
+}
|
|
|
+
|
|
|
+// ------------ 统计结果保存 --------------
|
|
|
+const saveTargetDictResult = () => {
|
|
|
+
|
|
|
+ if (ruleForm.id === '') {
|
|
|
+ ElMessage({
|
|
|
+ type: "info",
|
|
|
+ message: "指标信息不全,请确认!",
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (QtResultData) {
|
|
|
+ ElMessageBox.confirm('已存在统计结果,请确认是否继续保存统计结果?', {
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ let targetResultList = [] as any
|
|
|
+ if (resultList.length > 0) {
|
|
|
+ targetResultList = clone(resultList)
|
|
|
+ } else {
|
|
|
+ for (let i = 1; i <= 4; i++) {
|
|
|
+ if (sqlForm['year' + i] && sqlForm['calcResult' + i]) {
|
|
|
+ let handWriteData = {} as DataType
|
|
|
+ handWriteData.id = ruleForm.id
|
|
|
+ handWriteData.pid = ruleForm.pid
|
|
|
+ handWriteData.dataType = '2'
|
|
|
+ handWriteData.year = sqlForm['year' + i]
|
|
|
+ handWriteData.childResult = sqlForm['childResult' + i]
|
|
|
+ handWriteData.momResult = sqlForm['momResult' + i]
|
|
|
+ handWriteData.calcResult = sqlForm['calcResult' + i]
|
|
|
+ targetResultList.push(handWriteData)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (targetResultList.length > 0) {
|
|
|
+ saveTargetReportResult(targetResultList)
|
|
|
+ .then((res: any) => {
|
|
|
+ if (res) {
|
|
|
+ ElMessage({
|
|
|
+ type: "success",
|
|
|
+ message: "保存统计结果成功!",
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ } else {
|
|
|
+ ElMessage({
|
|
|
+ type: "info",
|
|
|
+ message: "保存统计结果为空,请确认!",
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// -------------------- 指标统计结果查询 --------------------
|
|
|
+let QtResultData = ref([])
|
|
|
+const queryTargetReportResult = () => {
|
|
|
|
|
|
+ if (ruleForm.id === '') {
|
|
|
+ ElMessage({
|
|
|
+ type: "info",
|
|
|
+ message: "指标信息不全,请确认!",
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
});
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if (isShowHandWrite.value) {
|
|
|
+ isShowHandWrite.value = false
|
|
|
+ }
|
|
|
+ if (isShowTargetResult.value) {
|
|
|
+ isShowTargetResult.value = false
|
|
|
+ }
|
|
|
|
|
|
+ let queryData = {
|
|
|
+ id: '',
|
|
|
+ pid: '',
|
|
|
+ startTime: '',
|
|
|
+ endTime: '',
|
|
|
+ }
|
|
|
+ queryData.id = ruleForm.id
|
|
|
+ queryData.pid = ruleForm.pid
|
|
|
+ selectTargetReportResult(queryData)
|
|
|
+ .then((res: any) => {
|
|
|
+ if (isShowQtResult.value === false) {
|
|
|
+ isShowQtResult.value = true
|
|
|
+ }
|
|
|
+ QtResultData.value = res
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
</script>
|