跟踪备注
This commit is contained in:
@@ -19,6 +19,19 @@ export function diagnosisTrackingWindow(params: {
|
||||
return request.get({ url: '/tcm.diagnosis/trackingWindow', params })
|
||||
}
|
||||
|
||||
/** 新增跟踪备注(按天合并追加,仅文字) */
|
||||
export function diagnosisAddTrackingNote(params: {
|
||||
diagnosis_id: number
|
||||
tracking_content: string
|
||||
}) {
|
||||
return request.post({ url: '/tcm.diagnosis/addTrackingNote', params })
|
||||
}
|
||||
|
||||
/** 拉取跟踪备注列表(note_date DESC) */
|
||||
export function diagnosisTrackingNotes(params: { diagnosis_id: number }) {
|
||||
return request.get({ url: '/tcm.diagnosis/trackingNotes', params })
|
||||
}
|
||||
|
||||
// 医助理诊单统计(按部门、按人)
|
||||
export function assistantDiagnosisStats(params?: {
|
||||
start_time?: string
|
||||
|
||||
@@ -126,6 +126,12 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- 跟踪备注(只读时间轴;新增入口在「编辑诊单」内) -->
|
||||
<div class="card tracking-note-card">
|
||||
<div class="card-title">跟踪备注</div>
|
||||
<TrackingNoteTimeline :notes="trackingNotes" readonly />
|
||||
</div>
|
||||
|
||||
<!-- 跟踪信息(与只读病例页同口径,自治 lazy load) -->
|
||||
<div class="card metric-card">
|
||||
<div class="card-title">跟踪信息</div>
|
||||
@@ -191,6 +197,7 @@ import NoteTimeline from './components/NoteTimeline.vue'
|
||||
import PatientInfoCard from '@/views/tcm/diagnosis/components/PatientInfoCard.vue'
|
||||
import PatientCaseCard from '@/views/tcm/diagnosis/components/PatientCaseCard.vue'
|
||||
import TrackingMatrix from '@/views/tcm/diagnosis/components/TrackingMatrix.vue'
|
||||
import TrackingNoteTimeline from '@/views/tcm/diagnosis/components/TrackingNoteTimeline.vue'
|
||||
import { completeAppointment } from '@/api/doctor'
|
||||
import { getCallSignature } from '@/api/tcm'
|
||||
import feedback from '@/utils/feedback'
|
||||
@@ -266,6 +273,7 @@ const noteSaving = ref(false)
|
||||
const apt = computed<any>(() => detail.value?.appointment || {})
|
||||
const diag = computed<any>(() => detail.value?.diagnosis || {})
|
||||
const doctorNotes = computed<any[]>(() => detail.value?.doctor_notes || [])
|
||||
const trackingNotes = computed<any[]>(() => detail.value?.tracking_notes || [])
|
||||
|
||||
const todayMeta = computed(() => {
|
||||
const d = new Date()
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
<template>
|
||||
<div class="tracking-timeline-wrap">
|
||||
<!-- 编辑模式:输入新备注 -->
|
||||
<div v-if="!readonly && diagnosisId" class="timeline-input">
|
||||
<el-input
|
||||
v-model="draft"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
placeholder="输入跟踪备注,回车换行;保存后将以「[HH:MM] 内容」追加到当天记录"
|
||||
maxlength="1000"
|
||||
show-word-limit
|
||||
resize="none"
|
||||
:disabled="saving"
|
||||
/>
|
||||
<div class="input-actions">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
:loading="saving"
|
||||
:disabled="!draft.trim()"
|
||||
@click="handleSave"
|
||||
>
|
||||
添加
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 时间轴 -->
|
||||
<div v-if="notes.length" class="tracking-timeline">
|
||||
<div v-for="note in notes" :key="note.id" class="timeline-node">
|
||||
<div class="timeline-dot"></div>
|
||||
<div class="timeline-date">{{ note.note_date }}</div>
|
||||
<div class="timeline-body">
|
||||
<div v-if="note.content" class="timeline-content">
|
||||
<div
|
||||
v-for="(line, idx) in splitLines(note.content)"
|
||||
:key="idx"
|
||||
class="content-line"
|
||||
>
|
||||
{{ line }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-empty v-if="!notes.length && readonly" description="暂无跟踪备注" :image-size="48" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { diagnosisAddTrackingNote } from '@/api/tcm'
|
||||
import feedback from '@/utils/feedback'
|
||||
|
||||
export interface TrackingNoteItem {
|
||||
id: number
|
||||
note_date: string
|
||||
content: string | null
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
notes: TrackingNoteItem[]
|
||||
diagnosisId?: number
|
||||
readonly?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{ refresh: [] }>()
|
||||
|
||||
const draft = ref('')
|
||||
const saving = ref(false)
|
||||
|
||||
const splitLines = (content: string | null): string[] => {
|
||||
if (!content) return []
|
||||
return content.split('\n').filter(Boolean)
|
||||
}
|
||||
|
||||
const handleSave = async () => {
|
||||
if (!props.diagnosisId) return
|
||||
const content = draft.value.trim()
|
||||
if (!content) return
|
||||
saving.value = true
|
||||
try {
|
||||
await diagnosisAddTrackingNote({
|
||||
diagnosis_id: props.diagnosisId,
|
||||
tracking_content: content,
|
||||
})
|
||||
feedback.msgSuccess('已添加')
|
||||
draft.value = ''
|
||||
emit('refresh')
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.tracking-timeline-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.timeline-input {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px dashed #ebeef5;
|
||||
}
|
||||
|
||||
.input-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.tracking-timeline {
|
||||
position: relative;
|
||||
padding-left: 22px;
|
||||
}
|
||||
|
||||
.tracking-timeline::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 6px;
|
||||
top: 4px;
|
||||
bottom: 4px;
|
||||
width: 2px;
|
||||
background: #ebeef5;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
.timeline-node {
|
||||
position: relative;
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
|
||||
.timeline-node:last-child {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.timeline-dot {
|
||||
position: absolute;
|
||||
left: -19px;
|
||||
top: 5px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
background: #16a34a;
|
||||
border: 2px solid #dcfce7;
|
||||
}
|
||||
|
||||
.timeline-date {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 6px;
|
||||
font-family: 'IBM Plex Mono', Consolas, monospace;
|
||||
}
|
||||
|
||||
.timeline-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.timeline-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.content-line {
|
||||
font-size: 12.5px;
|
||||
color: #606266;
|
||||
line-height: 1.6;
|
||||
word-break: break-word;
|
||||
}
|
||||
</style>
|
||||
@@ -562,6 +562,17 @@
|
||||
</div>
|
||||
<el-empty v-else description="请先保存诊单后查看" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="跟踪备注" name="trackingNote" :disabled="!formData.id" lazy>
|
||||
<div v-if="formData.id" class="p-4">
|
||||
<TrackingNoteTimeline
|
||||
:notes="trackingNotes"
|
||||
:diagnosis-id="Number(formData.id)"
|
||||
:readonly="viewOnly"
|
||||
@refresh="fetchTrackingNotes"
|
||||
/>
|
||||
</div>
|
||||
<el-empty v-else description="请先保存诊单后查看" />
|
||||
</el-tab-pane>
|
||||
<!-- 血糖血压记录标签页 -->
|
||||
<el-tab-pane label="血糖血压记录" name="blood" :disabled="!formData.id">
|
||||
<blood-record-list
|
||||
@@ -711,7 +722,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { tcmDiagnosisAdd, tcmDiagnosisEdit, tcmDiagnosisDetail, checkPhone, checkIdCard } from '@/api/tcm'
|
||||
import { tcmDiagnosisAdd, tcmDiagnosisEdit, tcmDiagnosisDetail, checkPhone, checkIdCard, diagnosisTrackingNotes } from '@/api/tcm'
|
||||
import { getDictData } from '@/api/app'
|
||||
import feedback from '@/utils/feedback'
|
||||
import { hasPermission } from '@/utils/perm'
|
||||
@@ -729,6 +740,7 @@ import ImChatRecordPanel from './components/ImChatRecordPanel.vue'
|
||||
import AssignLogPanel from './components/AssignLogPanel.vue'
|
||||
import AppointmentRecordPanel from './components/AppointmentRecordPanel.vue'
|
||||
import NoteTimeline from '@/views/patient/reception/components/NoteTimeline.vue'
|
||||
import TrackingNoteTimeline from './components/TrackingNoteTimeline.vue'
|
||||
import TcmPrescription from '@/components/tcm-prescription/index.vue'
|
||||
import { getDoctorNotes } from '@/api/patient'
|
||||
|
||||
@@ -766,10 +778,22 @@ const fetchDiagNotes = async () => {
|
||||
} catch { diagNotes.value = [] }
|
||||
}
|
||||
|
||||
const trackingNotes = ref<any[]>([])
|
||||
|
||||
const fetchTrackingNotes = async () => {
|
||||
if (!formData.value.id) return
|
||||
try {
|
||||
trackingNotes.value = await diagnosisTrackingNotes({ diagnosis_id: Number(formData.value.id) }) || []
|
||||
} catch { trackingNotes.value = [] }
|
||||
}
|
||||
|
||||
watch(() => activeTab.value, async (tab) => {
|
||||
if (tab === 'doctorNote' && formData.value.id) {
|
||||
await fetchDiagNotes()
|
||||
}
|
||||
if (tab === 'trackingNote' && formData.value.id) {
|
||||
await fetchTrackingNotes()
|
||||
}
|
||||
})
|
||||
|
||||
watch([visible, activeTab], () => {
|
||||
|
||||
@@ -53,6 +53,12 @@
|
||||
<div class="card-title">医生备注 & 舌苔照片 & 检查报告</div>
|
||||
<NoteTimeline :notes="doctorNotes" :diagnosis-id="diag?.id" />
|
||||
</div>
|
||||
|
||||
<!-- 跟踪备注(只读时间轴) -->
|
||||
<div class="card tracking-note-card">
|
||||
<div class="card-title">跟踪备注</div>
|
||||
<TrackingNoteTimeline :notes="trackingNotes" readonly />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -66,6 +72,7 @@ import { formatGender } from '@/utils/diag-display'
|
||||
import PatientInfoCard from './components/PatientInfoCard.vue'
|
||||
import PatientCaseCard from './components/PatientCaseCard.vue'
|
||||
import TrackingMatrix from './components/TrackingMatrix.vue'
|
||||
import TrackingNoteTimeline from './components/TrackingNoteTimeline.vue'
|
||||
import NoteTimeline from '@/views/patient/reception/components/NoteTimeline.vue'
|
||||
|
||||
const route = useRoute()
|
||||
@@ -80,6 +87,7 @@ const detail = ref<any>(null)
|
||||
const apt = computed<any>(() => detail.value?.appointment || {})
|
||||
const diag = computed<any>(() => detail.value?.diagnosis || {})
|
||||
const doctorNotes = computed<any[]>(() => detail.value?.doctor_notes || [])
|
||||
const trackingNotes = computed<any[]>(() => detail.value?.tracking_notes || [])
|
||||
const unservedDays = computed<number | null>(() => {
|
||||
const v = detail.value?.unserved_days
|
||||
return v === null || v === undefined ? null : Number(v)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -18,6 +18,7 @@ use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\tcm\DiagnosisLists;
|
||||
use app\adminapi\logic\order\OrderActionLogLogic;
|
||||
use app\adminapi\logic\tcm\DiagnosisLogic;
|
||||
use app\adminapi\logic\tcm\TrackingNoteLogic;
|
||||
use app\adminapi\validate\tcm\DiagnosisValidate;
|
||||
use app\common\model\Order;
|
||||
use app\common\model\WechatChatRecord;
|
||||
@@ -157,6 +158,42 @@ class DiagnosisController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 新增跟踪备注(按天合并追加,仅文字)
|
||||
*
|
||||
* 路由:POST /tcm.diagnosis/addTrackingNote
|
||||
* 权限:tcm.diagnosis/addTrackingNote
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function addTrackingNote()
|
||||
{
|
||||
$params = (new DiagnosisValidate())->post()->goCheck('addTrackingNote');
|
||||
$ok = TrackingNoteLogic::addOrAppend([
|
||||
'diagnosis_id' => (int) $params['diagnosis_id'],
|
||||
'admin_id' => (int) $this->adminId,
|
||||
'content' => (string) $params['tracking_content'],
|
||||
]);
|
||||
if ($ok === false) {
|
||||
return $this->fail(TrackingNoteLogic::getError() ?: '保存失败');
|
||||
}
|
||||
return $this->success('保存成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 拉取跟踪备注列表(note_date DESC)
|
||||
*
|
||||
* 路由:GET /tcm.diagnosis/trackingNotes?diagnosis_id=:diagnosisId
|
||||
* 权限:tcm.diagnosis/trackingNotes
|
||||
*
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
public function trackingNotes()
|
||||
{
|
||||
$params = (new DiagnosisValidate())->goCheck('trackingNotes');
|
||||
return $this->data(TrackingNoteLogic::getByDiagnosis((int) $params['diagnosis_id']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 诊单挂号 / 取消挂号 操作日志(谁在何时操作)
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,7 @@ use app\api\logic\ChatNotifyLogic;
|
||||
use app\adminapi\logic\tcm\PrescriptionLogic;
|
||||
use app\adminapi\logic\tcm\DiagnosisLogic;
|
||||
use app\adminapi\logic\tcm\BloodRecordLogic;
|
||||
use app\adminapi\logic\tcm\TrackingNoteLogic;
|
||||
use app\adminapi\logic\doctor\DoctorNoteLogic;
|
||||
use app\common\model\tcm\Prescription;
|
||||
use app\common\service\wechat\WechatWorkAppMessageService;
|
||||
@@ -549,10 +550,16 @@ class AppointmentLogic extends BaseLogic
|
||||
? DoctorNoteLogic::getByDiagnosis($diagnosisId)
|
||||
: [];
|
||||
|
||||
// 7.1) 跟踪备注
|
||||
$trackingNotes = $diagnosisId > 0
|
||||
? TrackingNoteLogic::getByDiagnosis($diagnosisId)
|
||||
: [];
|
||||
|
||||
return [
|
||||
'appointment' => $appointment,
|
||||
'diagnosis' => $diagnosis,
|
||||
'doctor_notes' => $doctorNotes,
|
||||
'appointment' => $appointment,
|
||||
'diagnosis' => $diagnosis,
|
||||
'doctor_notes' => $doctorNotes,
|
||||
'tracking_notes' => $trackingNotes,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ use app\common\model\auth\Admin;
|
||||
use app\common\model\auth\AdminRole;
|
||||
use app\adminapi\logic\doctor\DoctorNoteLogic;
|
||||
use app\adminapi\logic\doctor\AppointmentLogic;
|
||||
use app\adminapi\logic\tcm\TrackingNoteLogic;
|
||||
use app\common\service\FileService;
|
||||
use app\common\service\DataScope\DataScopeService;
|
||||
use think\facade\Db;
|
||||
@@ -3403,6 +3404,9 @@ class DiagnosisLogic extends BaseLogic
|
||||
// 5) 医生备注
|
||||
$doctorNotes = DoctorNoteLogic::getByDiagnosis($diagnosisId);
|
||||
|
||||
// 5.1) 跟踪备注(只读展示,按 note_date DESC)
|
||||
$trackingNotes = TrackingNoteLogic::getByDiagnosis($diagnosisId);
|
||||
|
||||
// 6) 未服务天数(与 T3 列同口径)
|
||||
$maxBloodTs = BloodRecord::where('diagnosis_id', $diagnosisId)
|
||||
->max('record_date');
|
||||
@@ -3414,6 +3418,7 @@ class DiagnosisLogic extends BaseLogic
|
||||
'appointment' => $appointment,
|
||||
'diagnosis' => $diagnosis,
|
||||
'doctor_notes' => $doctorNotes,
|
||||
'tracking_notes' => $trackingNotes,
|
||||
'unserved_days' => $unservedDays,
|
||||
'last_blood_record_at' => $lastBloodRecordAt,
|
||||
];
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\logic\tcm;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\tcm\TrackingNote;
|
||||
|
||||
/**
|
||||
* 诊单跟踪备注 Logic
|
||||
*
|
||||
* - 按 diagnosis_id + 当天 find-or-create
|
||||
* - 多次追加 content(换行分隔,带 [HH:MM] 前缀)
|
||||
* - 不涉及附件(与医生备注 DoctorNoteLogic 不同)
|
||||
*/
|
||||
class TrackingNoteLogic extends BaseLogic
|
||||
{
|
||||
/**
|
||||
* 追加跟踪备注(按天合并)
|
||||
*
|
||||
* @param array $params diagnosis_id (int)、admin_id (int)、content (string)
|
||||
* @return bool
|
||||
*/
|
||||
public static function addOrAppend(array $params): bool
|
||||
{
|
||||
try {
|
||||
$diagnosisId = (int) ($params['diagnosis_id'] ?? 0);
|
||||
$adminId = (int) ($params['admin_id'] ?? 0);
|
||||
$newContent = trim((string) ($params['content'] ?? ''));
|
||||
|
||||
if ($diagnosisId <= 0) {
|
||||
self::setError('诊单ID缺失');
|
||||
return false;
|
||||
}
|
||||
if ($newContent === '') {
|
||||
self::setError('备注内容不能为空');
|
||||
return false;
|
||||
}
|
||||
|
||||
$today = date('Y-m-d');
|
||||
$time = date('H:i');
|
||||
$line = "[{$time}] {$newContent}";
|
||||
|
||||
$existing = TrackingNote::where('diagnosis_id', $diagnosisId)
|
||||
->where('note_date', $today)
|
||||
->whereNull('delete_time')
|
||||
->find();
|
||||
|
||||
if ($existing) {
|
||||
$prev = trim((string) ($existing->content ?? ''));
|
||||
$existing->content = $prev !== '' ? ($prev . "\n" . $line) : $line;
|
||||
$existing->save();
|
||||
} else {
|
||||
TrackingNote::create([
|
||||
'diagnosis_id' => $diagnosisId,
|
||||
'admin_id' => $adminId,
|
||||
'note_date' => $today,
|
||||
'content' => $line,
|
||||
]);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按 diagnosis_id 获取跟踪备注列表(note_date DESC)
|
||||
*
|
||||
* @param int $diagnosisId
|
||||
* @param int $limit 最近 N 天
|
||||
* @return array
|
||||
*/
|
||||
public static function getByDiagnosis(int $diagnosisId, int $limit = 60): array
|
||||
{
|
||||
try {
|
||||
if ($diagnosisId <= 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$records = TrackingNote::where('diagnosis_id', $diagnosisId)
|
||||
->whereNull('delete_time')
|
||||
->order('note_date', 'desc')
|
||||
->limit($limit)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
return $records;
|
||||
} catch (\Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,8 @@ class DiagnosisValidate extends BaseValidate
|
||||
'diabetes_discovery_year' => 'max:50',
|
||||
'start_date' => 'date',
|
||||
'end_date' => 'date|checkDateRange',
|
||||
'diagnosis_id' => 'require|integer|checkDiagnosisId',
|
||||
'tracking_content' => 'require|length:1,1000',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
@@ -59,6 +61,9 @@ class DiagnosisValidate extends BaseValidate
|
||||
'diabetes_discovery_year.max' => '发现糖尿病患病史最多50个字符',
|
||||
'start_date.date' => '开始日期格式不正确',
|
||||
'end_date.date' => '结束日期格式不正确',
|
||||
'diagnosis_id.require' => '诊单ID不能为空',
|
||||
'tracking_content.require' => '跟踪备注内容不能为空',
|
||||
'tracking_content.length' => '跟踪备注最多1000个字符',
|
||||
];
|
||||
|
||||
public function sceneAdd()
|
||||
@@ -86,6 +91,18 @@ class DiagnosisValidate extends BaseValidate
|
||||
return $this->only(['id', 'start_date', 'end_date']);
|
||||
}
|
||||
|
||||
/** 新增跟踪备注:诊单ID + 备注内容 */
|
||||
public function sceneAddTrackingNote()
|
||||
{
|
||||
return $this->only(['diagnosis_id', 'tracking_content']);
|
||||
}
|
||||
|
||||
/** 拉取跟踪备注列表:诊单ID */
|
||||
public function sceneTrackingNotes()
|
||||
{
|
||||
return $this->only(['diagnosis_id']);
|
||||
}
|
||||
|
||||
public function sceneGenerateQrcode()
|
||||
{
|
||||
return $this->only(['diagnosis_id', 'doctor_id', 'patient_id', 'share_user_id', 'mini_program_path'])
|
||||
@@ -121,6 +138,16 @@ class DiagnosisValidate extends BaseValidate
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 校验 diagnosis_id 字段(addTrackingNote 等场景使用,避开 id 字段) */
|
||||
protected function checkDiagnosisId($value)
|
||||
{
|
||||
$diagnosis = Diagnosis::findOrEmpty($value);
|
||||
if ($diagnosis->isEmpty()) {
|
||||
return '诊单不存在';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** end_date 不能早于 start_date */
|
||||
protected function checkDateRange($value, $rule, $data = [])
|
||||
{
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\tcm;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
/**
|
||||
* 诊单跟踪备注模型
|
||||
* 表 zyt_tracking_note:按天一条,多次追加更新;只存文字。
|
||||
*/
|
||||
class TrackingNote extends BaseModel
|
||||
{
|
||||
protected $name = 'tracking_note';
|
||||
|
||||
protected $autoWriteTimestamp = true;
|
||||
protected $createTime = 'create_time';
|
||||
protected $updateTime = 'update_time';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
protected $dateFormat = false;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
# 诊单跟踪备注接口权限注册(2026-05-05)
|
||||
# 挂在「中医诊单」(perms=tcm.diagnosis/lists) 菜单下
|
||||
# tcm.diagnosis/addTrackingNote 新增跟踪备注
|
||||
# tcm.diagnosis/trackingNotes 拉取跟踪备注列表
|
||||
|
||||
SET @diag_menu_id := (SELECT id FROM zyt_system_menu WHERE perms = 'tcm.diagnosis/lists' LIMIT 1);
|
||||
|
||||
INSERT INTO zyt_system_menu (
|
||||
pid, type, name, icon, sort, perms, paths, component,
|
||||
selected, params, is_cache, is_show, is_disable, create_time, update_time
|
||||
)
|
||||
SELECT
|
||||
@diag_menu_id, 'A', '新增跟踪备注', '', 80,
|
||||
'tcm.diagnosis/addTrackingNote', '', '',
|
||||
'', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
|
||||
FROM DUAL
|
||||
WHERE @diag_menu_id IS NOT NULL
|
||||
AND NOT EXISTS (SELECT 1 FROM zyt_system_menu WHERE perms = 'tcm.diagnosis/addTrackingNote');
|
||||
|
||||
INSERT INTO zyt_system_menu (
|
||||
pid, type, name, icon, sort, perms, paths, component,
|
||||
selected, params, is_cache, is_show, is_disable, create_time, update_time
|
||||
)
|
||||
SELECT
|
||||
@diag_menu_id, 'A', '跟踪备注列表', '', 81,
|
||||
'tcm.diagnosis/trackingNotes', '', '',
|
||||
'', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
|
||||
FROM DUAL
|
||||
WHERE @diag_menu_id IS NOT NULL
|
||||
AND NOT EXISTS (SELECT 1 FROM zyt_system_menu WHERE perms = 'tcm.diagnosis/trackingNotes');
|
||||
@@ -0,0 +1,16 @@
|
||||
-- 诊单跟踪备注表(按天一条,多次追加更新;只存文字,不含附件)
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `zyt_tracking_note` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`diagnosis_id` int(11) unsigned NOT NULL COMMENT '诊单ID (tcm_diagnosis.id)',
|
||||
`admin_id` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '记录人ID (system_admin.id)',
|
||||
`note_date` date NOT NULL COMMENT '记录日期',
|
||||
`content` text DEFAULT NULL COMMENT '跟踪备注文字(多次追加以换行分隔,带 [HH:MM] 前缀)',
|
||||
`create_time` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`update_time` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`delete_time` int(10) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_diagnosis_date` (`diagnosis_id`, `note_date`),
|
||||
KEY `idx_admin` (`admin_id`),
|
||||
KEY `idx_diagnosis_date` (`diagnosis_id`, `note_date`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='诊单跟踪备注';
|
||||
Reference in New Issue
Block a user