eight
2024-11-20 b8846be759b62473850fe09b284d440ce3cd1cce
打印预约小票
已修改3个文件
81 ■■■■ 文件已修改
src/utils/index.ts 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/ecg/appointment/CheckItemPanel.vue 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/ecg/doctor/components/DevReadyPanel.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/index.ts
@@ -1,4 +1,5 @@
import { toNumber } from 'lodash-es'
import {PrefixInteger} from "@/utils/formatter";
/**
 *
@@ -449,3 +450,16 @@
    return ''
  }
}
export const calGender = (_gender: number): string => {
  if (1 === _gender)
    return "男"
  else
    return "女"
}
export const getBookBeginTime = (bookTimeslot: number): string => {
  const hour = parseInt( bookTimeslot/1000000 );
  const minute = parseInt( bookTimeslot/10000 ) % 100;
  return PrefixInteger(hour,2) + ":" + PrefixInteger(minute, 2);
}
src/views/ecg/appointment/CheckItemPanel.vue
@@ -3,16 +3,18 @@
import {useCheckTypeStore} from "@/store/modules/checkType";
import {AppointmentApi, AppointmentVO} from "@/api/ecg/appointment";
import {formatTimeslot} from "@/utils/formatter";
import {isCurrentDay} from "@/utils/dateUtil";
import {calculateAge, formatTimestamp, isCurrentDay} from "@/utils/dateUtil";
import {QueueSequenceApi, QueueSequenceVO} from "@/api/ecg/queuesequence";
import {formatDate} from "../../../utils/formatTime";
import { cloneDeep } from 'lodash-es'
import {hiprint} from "vue-plugin-hiprint";
import {calGender, getBookBeginTime} from "@/utils";
defineComponent({
  name: 'CheckItemPanel'
})
const  props = defineProps({
const props = defineProps({
  appointment: {
    type: Object as PropType<AppointmentVO>,
    required: true
@@ -23,6 +25,8 @@
const checkTypeTimeslotList = ref<QueueSequenceVO>()
const bookTimeSlotVip = ref<number>()
const bookSeqNum = ref<number>()
const _confirmAppointment = async () => {
  if (!isCurrentDay(props.appointment.bookDate)) {
@@ -41,6 +45,8 @@
            tempAppointment.bookTimeslot = bookTimeSlotVip.value
          }
          const data = await AppointmentApi.confirmAppointmentVip(tempAppointment)
          bookSeqNum.value = data
          _printNote()
          ElNotification({
            title: '温馨提示',
            message: data,
@@ -56,12 +62,48 @@
        })
  } else {
    const data = await AppointmentApi.confirmAppointment(props.appointment)
    bookSeqNum.value = data
    _printNote()
    ElNotification({
      title: '温馨提示',
      message: data,
      type: 'warning'
    })
  }
}
const _printNote = async (printMode?: number) => {
  console.info( props.appointment )
// 引入后使用示例
  hiprint.init({
    //    host: 'http://192.168.2.100:17521',
    token: '111111'
  });
// 下列方法都是没有拖拽设计页面的, 相当于代码模式, 使用代码设计页面
// 想要实现拖拽设计页面,请往下看 '自定义设计'
  var hiprintTemplate = new hiprint.PrintTemplate();  // 可传参数
  //var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 }); 导致走三页
  var panel = hiprintTemplate.addPrintPanel({ width: 140, height: 130, paperNumberDisabled:true});
//文本
  const checkTypeName = checkTypeStore.getCheckTypeName(props.appointment.bookCheckType)
  panel.addPrintText({ options: { width: 140, height: 12, top: 2, left: 20, title: checkTypeName, textAlign: 'center', fontSize: 8, fontFamily: '微软雅黑',  fontWeight: '700', } });
  const patientBaisc = props.appointment.patName + "  " + calGender(props.appointment.patGender) + "  " + calculateAge(props.appointment.patBirthday) + "岁"
  panel.addPrintText({ options: { width: 140, height: 12, top: 16, left: 20, title: patientBaisc, textAlign: 'center' , fontSize: 8, fontWeight: '700', } });
  const ward_bed = props.appointment.patWardDesc + "-" + props.appointment.patBedNo
  panel.addPrintText({ options: { width: 140, height: 12, top: 30, left: 20, title: ward_bed, textAlign: 'center', fontSize: 8, fontFamily: '黑体', } });
  const bookTime = formatTimestamp(props.appointment.bookDate) + " " + getBookBeginTime(props.appointment.bookTimeslot)
  panel.addPrintText({ options: { width: 140, height: 12, top: 44, left: 20, title: bookTime, textAlign: 'center', fontSize: 8 } });
  //panel.addPrintText({ options: { width: 140, height: 12, top: 58, left: 20, title: props.appointment.patId, textAlign: 'center', fontSize: 8 } });
  //panel.addPrintText({ options: { width: 140, height: 12, top: 72, left: 20, title: props.appointment.patMobile, textAlign: 'center', fontSize: 8, fontFamily: '微软雅黑',  fontWeight: '700', } });
  const _bookSeqNum = bookSeqNum.value + ''  // !!需要字符串
  panel.addPrintText({ options: { width: 140, height: 12, top: 62, left: 20, title: _bookSeqNum, textAlign: 'center', fontSize: 16, fontFamily: '微软雅黑',  fontWeight: '900' } });
//打印
  if (undefined === printMode)
    hiprintTemplate.print2([{},{},{}]); // 可以传 [定位参数]  http://https://ccsimple.github.io/sv-print-docs/config/template.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%AE%BE%E8%AE%A1%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B
  else
    hiprintTemplate.print([{},{},{}]);
}
onMounted( async () => {
@@ -87,9 +129,10 @@
          :disabled="item.queueVipNo === item.queueVipFull"
      />
    </el-select>
    {{bookSeqNum}}
    <el-divider/>
    <el-button :type="isCurrentDay(appointment.bookDate)?'primary':'warning'" @click="_confirmAppointment"><Icon icon="ep:refresh" class="mr-5px" /> 排队 </el-button>
    <el-button @click="_confirmAppointment" :type="isCurrentDay(appointment.bookDate)?'primary':'warning'"><Icon icon="ep:list" class="mr-5px" /> 排队 </el-button>
    <el-button @click="_printNote(8)"><Icon icon="ep:printer" class="mr-5px" /> 打印号 </el-button>
  </el-card>
</template>
src/views/ecg/doctor/components/DevReadyPanel.vue
@@ -138,6 +138,7 @@
import {AppointmentApi, AppointmentVO} from "@/api/ecg/appointment";
import { useCheckTypeStoreWithOut } from '@/store/modules/checkType'
import {PrefixInteger} from "@/utils/formatter";
import {calGender, getBookBeginTime} from "@/utils";
/** 设备领用 表单 */
defineComponent({ name: 'DevReadyPanel' })
@@ -370,7 +371,7 @@
// 想要实现拖拽设计页面,请往下看 '自定义设计'
  var hiprintTemplate = new hiprint.PrintTemplate();  // 可传参数
  //var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 }); 导致走三页
  var panel = hiprintTemplate.addPrintPanel({ width: 140, height: 130});
  var panel = hiprintTemplate.addPrintPanel({ width: 140, height: 130, paperNumberDisabled:true});
//文本
  const checkTypeName = checkTypeStore.getCheckTypeName(curAppointment.bookCheckType)
  panel.addPrintText({ options: { width: 140, height: 12, top: 2, left: 20, title: checkTypeName, textAlign: 'center', fontSize: 8, fontFamily: '微软雅黑',  fontWeight: '700', } });
@@ -428,19 +429,6 @@
  ]
});
*/
const getBookBeginTime = (bookTimeslot: number): string => {
  const hour = parseInt( bookTimeslot/1000000 );
  const minute = parseInt( bookTimeslot/10000 ) % 100;
  return PrefixInteger(hour,2) + ":" + PrefixInteger(minute, 2);
}
const calGender = (_gender: number): string => {
  if (1 === _gender)
    return "男"
  else
    return "女"
}
const getDevInfo = async () => {
  deviceInfo.value.category = ''