edit.vue 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  1. <script>
  2. import dayjs from 'dayjs';
  3. import {listMedicalMechanism} from '@/api/medical/mechanism';
  4. import {transformFlatObjectToNested, transformNestedObjectToFlat} from '@/tools/object';
  5. import {bignumber, chain, multiply} from 'mathjs';
  6. import {
  7. addPrescriptionCore2,
  8. check2,
  9. getPrescriptionCore2,
  10. getPrescriptionRS,
  11. } from '@/api/prescription/prescriptionCore';
  12. import {mapGetters} from 'vuex';
  13. import regionOptions from '@/utils/options';
  14. import {getSchemeList} from '@/api/decoct/scheme';
  15. export default {
  16. props: {
  17. id: {type: [String, Number]},
  18. mode: {type: String, default: 'edit'},
  19. },
  20. data() {
  21. const locationValidator = (message) => (rule, value, callback) => {
  22. if (this.model.expressExecutor === '顺丰') {
  23. if (!value.length || (typeof value === 'string' && !value.trim())) { return callback(new Error(message)); }
  24. }
  25. callback();
  26. };
  27. return {
  28. medicines: [],
  29. model: {},
  30. rules: {
  31. yljgId: [{required: true, message: '请选择医疗机构'}],
  32. yfId: [{required: true, message: '请选择药房'}],
  33. preNo: [{required: true, message: '请输入医院处方号'}],
  34. name: [{required: true, message: '请输入患者姓名'}],
  35. sex: [{required: true, message: '请选择性别'}],
  36. age: [{required: true, message: '请输入年龄'}],
  37. // recipientTel: [{required: true, message: '请输入联系电话'}],
  38. expressExecutor: [{required: true, message: '请选择配送方式'}],
  39. consignee: [{validator: locationValidator('请输入收件人')}],
  40. contactNumber: [{validator: locationValidator('请输入收件电话')}],
  41. // location: [{validator: locationValidator('请选择所属地域')}],
  42. address: [{validator: locationValidator('请输入详细地址')}],
  43. },
  44. ageOptions: [
  45. {label: '岁', value: '岁'},
  46. {label: '月', value: '月'},
  47. {label: '周', value: '周'},
  48. {label: '天', value: '天'},
  49. ],
  50. genderOptions: [
  51. {label: '男', value: '男'},
  52. {label: '女', value: '女'},
  53. ],
  54. recipeCategoryOptions: [
  55. {label: '门诊', value: '1'},
  56. {label: '住院', value: '2'},
  57. ],
  58. expressExecutorOptions: [
  59. {label: '送医院', value: '送医院'},
  60. {label: '顺丰', value: '顺丰'},
  61. {label: '其他', value: '其他'},
  62. ],
  63. whetherOptions: [
  64. {label: '是', value: '1'},
  65. {label: '否', value: '0'},
  66. ],
  67. communityOptions: [],
  68. mechanismOptions: [],
  69. dosageFormOptions: [],
  70. usageOptions: [],
  71. // 用法方式
  72. usageMethodOptions: [],
  73. concentrationOptions: [],
  74. frequencyOptions: [],
  75. medicationTimeOptions: [],
  76. expressDechOptions: [],
  77. expressPayTypeOptions: [],
  78. schemeOptions: [],
  79. patternOptions: [],
  80. regionOptions,
  81. // 药品标记
  82. drugMarkOptions: [],
  83. showPharmacy: false,
  84. searchTableForSystemColumns: [
  85. {title: '名称', data: 'drugsName'},
  86. // {title: '编码', data: 'drugsId'},
  87. // {title: '规格', data: 'drugsSpecsName'},
  88. // {title: '产地', data: 'placeName'},
  89. // {title: '零售价', data: 'retail'},
  90. ],
  91. loading: false,
  92. saving: false,
  93. tableHeight: 0,
  94. showRS: false,
  95. rsLoading: false,
  96. rs: [],
  97. };
  98. },
  99. computed: {
  100. ...mapGetters(['pharmacyList']),
  101. isCheck() { return this.$props.mode !== 'edit';},
  102. getEmptyMedicineRowIndex() {
  103. return this.medicines.findIndex(medicine => Object.keys(medicine).length === 0);
  104. },
  105. medicineTotal() {
  106. return this.medicines.filter(medicine => medicine && medicine.matCode).length;
  107. },
  108. medicineDosageTotal() {
  109. let total = chain(bignumber(0));
  110. for (const medicine of this.medicines) {
  111. if (medicine['matDose']) total = total.add(bignumber(medicine['matDose']));
  112. }
  113. return total.done().toFixed(2);
  114. },
  115. medicineWholesalePriceTotal() {
  116. let total = chain(bignumber(0));
  117. for (const medicine of this.medicines) {
  118. if (medicine['matDose'] && medicine['matPfj']) total = total.add(multiply(
  119. bignumber(medicine['matDose']),
  120. bignumber(medicine['matPfj']),
  121. ));
  122. }
  123. return total.done().toFixed(2);
  124. },
  125. medicinePriceTotal() {
  126. let total = chain(bignumber(0));
  127. for (const medicine of this.medicines) {
  128. if (medicine['matDose'] && medicine['matXsj']) total = total.add(multiply(
  129. bignumber(medicine['matDose']),
  130. bignumber(medicine['matXsj']),
  131. ));
  132. }
  133. return total.done().toFixed(2);
  134. },
  135. },
  136. created() {
  137. if (this.$props.id) this.load();
  138. else this.formReset();
  139. this.getMechanismList();
  140. this.getDicts('dosage_form').then((response) => {this.dosageFormOptions = response.data;});
  141. this.getDicts('pressure_pattern').then((response) => {this.patternOptions = response.data;});
  142. this.getDicts('prescription_usage').then((response) => {this.usageOptions = response.data;});
  143. this.getDicts('prescription.concentration').then((response) => {this.concentrationOptions = response.data;});
  144. this.getDicts('drug_frequency').then((response) => {this.frequencyOptions = response.data;});
  145. this.getDicts('medication_time').then((response) => {this.medicationTimeOptions = response.data;});
  146. this.getDicts('express_dech').then((response) => {this.expressDechOptions = response.data;});
  147. this.getDicts('express_pay_type').then((response) => {this.expressPayTypeOptions = response.data;});
  148. this.getDicts('usage_method').then((response) => {this.usageMethodOptions = response.data;});
  149. this.getDicts('drug_mark').then((response) => {this.drugMarkOptions = response.data;});
  150. getSchemeList().then((response) => {this.schemeOptions = response.rows;});
  151. },
  152. mounted() {
  153. setTimeout(() => {
  154. const rect = this.$el.getBoundingClientRect();
  155. this.tableHeight = rect.height - /* 内边距 */ 12 * 2 - /* 协定方 */ 32 - /* 表尾 */ (20 + 12 * 2) - /* 拒绝原因 */ (this.isCheck ? 54 + 12 : 0) - /* 底部按钮 */ (36 + 12);
  156. }, 200);
  157. },
  158. methods: {
  159. async load() {
  160. this.loading = true;
  161. try {
  162. const {medicines, ...model} = await getPrescriptionCore2(this.$props.id);
  163. this.medicines = medicines.map(medicine => Object.assign(medicine, {subtotalMoney: this.calculationMedicinePrice(medicine)}));
  164. this.model = transformNestedObjectToFlat(model);
  165. if (!this.isCheck) {
  166. this.model.id = null;
  167. this.model.tackleTime = '';
  168. delete this.model.checkState;
  169. }
  170. } catch (e) {
  171. this.cancel();
  172. }
  173. this.loading = false;
  174. this.appendMedicine();
  175. const pharmacies = Array.isArray(this.pharmacyList) ? this.pharmacyList : [];
  176. this.showPharmacy = pharmacies.length > 1 || !this.model.yfId;
  177. if (!this.model.tackleTime) this.model.tackleTime = dayjs().startOf('minute').format('YYYY-MM-DD HH:mm:ss');
  178. },
  179. async loadRS() {
  180. const medicines = this.medicines.filter(medicine => Object.keys(medicine).length);
  181. if (medicines.length === 0) return this.toggleShowRS(false);
  182. this.rsLoading = true;
  183. try {
  184. const id = this.model.id || this.$props.id;
  185. this.rs = await getPrescriptionRS(id, medicines, {hidePregnant: this.model.sex === '男' || this.model.age < 14});
  186. } catch (e) {
  187. if (e instanceof AggregateError) {
  188. this.$message.error(e.errors.map(e=>e.message).join('; '));
  189. } else {
  190. this.$message.error(e.message);
  191. }
  192. this.toggleShowRS(false);
  193. }
  194. this.rsLoading = false;
  195. },
  196. formReset() {
  197. const pharmacies = Array.isArray(this.pharmacyList) ? this.pharmacyList : [];
  198. this.model = {
  199. yfId: window.localStorage.getItem('pharmacyId') || (pharmacies.length ? pharmacies[0].id : ''),
  200. /* 01 受理时间 */ tackleTime: dayjs().startOf('minute').format('YYYY-MM-DD HH:mm:ss'),
  201. /* 02 处方序号 */ recipeSerial: '',
  202. /* 03 处方编号 */ recipeBh: '',
  203. /* 04 患者姓名 */ name: '',
  204. /* 05 患者年龄 */ // age: '',
  205. /* 07 患者性别 */ sex: '',
  206. /* 08 联系电话 */ recipientTel: '',
  207. /* 09 医院处方 */ preNo: '',
  208. /* 10 医疗机构 */ yljgId: '',
  209. /* 11 门诊住院 */ preMzZy: '',
  210. /* 12 就诊科室 */ department: '',
  211. /* 13 病区 */ inpatientArea: '',
  212. /* 14 病床 */ bedNo: '',
  213. /* 15 就诊医生 */ doctor: '',
  214. /* 16 临床诊断 */ disName: '',
  215. /* 17 剂数 */ // prescription_number: '',
  216. /* 18 剂型 */ prescription_dosageForm: '',
  217. /* 19 处方用法 */ prescription_prescriptionUsage: '',
  218. /* 20 浓煎量 */ prescription_concentration: '',
  219. /* 21 服药频次 */ prescription_frequency: '',
  220. /* 用法方式 */ prescription_usageMethod: '',
  221. /* 22 服药时间 */ prescription_medicationTime: '',
  222. /* 23 医嘱 */ prescription_entrust: '',
  223. /* 24 代煎 */ isBehalf: '',
  224. /* 24 配送 */ takingMethod: '',
  225. /* 26 配送方式 */ expressExecutor: '',
  226. /* 27 收件人名 */ consignee: '',
  227. /* 28 收件电话 */ contactNumber: '',
  228. location: [],
  229. /* 29 收件地址 */ address: '',
  230. /* 30 快递单号 */ expressCode: '',
  231. /* */ expressDech: '',
  232. /* */ expressPayType: '',
  233. /* 用药时间 */ expressTime: dayjs().startOf('minute').format('YYYY-MM-DD HH:mm'),
  234. /* 批发费用 */ // prescription_prescriptionPfSum: '',
  235. /* 含税金额 */ // prescription_prescriptionYsSum: '',
  236. /* 31 处方金额 */ // prescription_prescriptionSum: '',
  237. /* 32 代煎费用 */ // prescription_daijianCost: '',
  238. /* 33 配送费用 */ // prescription_distributionCost: '',
  239. /* 34 总金额 */ // prescription_prescriptionTotleSum: '',
  240. /* 浸泡水量 */ // steep_soakingWaterValue: '',
  241. /* 浸泡时间 */ // steep_soakingTime: '',
  242. /* 是否毒性 */ decoct_isPoison: '',
  243. /* 煎煮方案 */ decoct_schemeId: '',
  244. /* 煎煮剂型 */ decoct_dosageForm: '',
  245. /* 压力模式 */ decoct_pressurePattern: '',
  246. /* 煎煮时间 */ // decoct_decoctTime: '',
  247. /* 先煎时间 */ // decoct_preDecoctTime: '',
  248. /* 一煎时间 */ // decoct_firstDecoctTime: '',
  249. /* 二煎时间 */ // decoct_secondDecoctTime: '',
  250. /* 后下时间 */ // decoct_backDownTime: '',
  251. /* 包数 */ // pack_packageNumber: '',
  252. /* 包装量 */ // pack_packageDose: '',
  253. /* 审核理由 */
  254. remarks: '',
  255. thread: '',
  256. };
  257. this.appendMedicine();
  258. this.showPharmacy = pharmacies.length > 1 || !this.model.yfId;
  259. },
  260. /** 查询医疗机构列表 */
  261. async getMechanismList() {
  262. try {
  263. const {data: rows} = await listMedicalMechanism();
  264. this.mechanismOptions = rows.map(item => (item.disabled = item.state === '0', item));
  265. } catch (error) {
  266. this.mechanismOptions = [];
  267. this.model.yljgId = '';
  268. }
  269. },
  270. async handle() {
  271. try {
  272. await this.$refs.form.validate();
  273. const medicines = this.medicines.filter(medicine => Object.keys(medicine).length);
  274. if (medicines.length === 0) throw '请至少添加一味药品';
  275. if (medicines.find(medicine => !medicine.matDose)) throw '请补全药品剂量';
  276. const model = transformFlatObjectToNested(this.model);
  277. model['prescription'].drugs = medicines;
  278. model['prescription'].prescriptionPfSum = +this.medicineWholesalePriceTotal;
  279. model['prescription'].prescriptionYsSum = +this.medicineWholesalePriceTotal;
  280. // model['prescription'].prescriptionSum = +this.medicinePriceTotal;
  281. [model.province = '', model.city = '', model.region = ''] = this.model.location;
  282. delete model['location'];
  283. if (model.steep == null) model.steep = null;
  284. if (model.decoct == null) model.decoct = null;
  285. if (model.pack == null) model.pack = null;
  286. this.saving = true;
  287. if (this.isCheck) await check2(model);
  288. else await addPrescriptionCore2(model);
  289. this.$emit('close', true);
  290. } catch (e) {
  291. if (e === false) this.$message.warning('请补全表单数据');
  292. else if (typeof e === 'string') this.$message.warning(e);
  293. }
  294. this.saving = false;
  295. },
  296. async check(mode) {
  297. this.model.thread = mode;
  298. this.model.checkState = {110: '1', 120: '2'}[mode];
  299. await this.handle();
  300. },
  301. cancel() {
  302. this.$emit('close', false);
  303. },
  304. updateValidator(validators) {
  305. this.$refs.form.clearValidate(validators);
  306. this.$refs.form.validateField(validators);
  307. },
  308. updateJDModel(id) {
  309. const model = this.schemeOptions.find(scheme => scheme.id === id) || {};
  310. this.model.decoct_pressurePattern = model.pressurePattern;
  311. this.model.decoct_dosageForm = model.dosageForm;
  312. const keys = ['decoctTime', 'firstDecoctTime', 'secondDecoctTime', 'preDecoctTime', 'backDownTime'];
  313. for (const key of keys) {
  314. if (model[key]) this.model[`decoct_${key}`] = model[key];
  315. else delete model[`decoct_${key}`];
  316. }
  317. },
  318. searchMedicinesFormat(res) {
  319. try {
  320. if (res.rows) return {totalRow: res.total, list: res.rows};
  321. else return {totalRow: res.data.length, list: res.data};
  322. } catch (error) { return {totalRow: 0, list: []}; }
  323. },
  324. selectMedicine([value], row, index) {
  325. if (value) {
  326. row.matCode = value.drugsId;
  327. row.matName = value.drugsName;
  328. row.drugsSpecsName = value.drugsSpecsName;
  329. row.matUsageName = value.matUsageName;
  330. // row.matDose = '';
  331. row.matUnitName = value.dosageSizeUnit;
  332. row.matXsj = value.retail;
  333. row.matPfj = value.matPfj;
  334. row.subtotalMoney = this.calculationMedicinePrice(row);
  335. } else {
  336. delete row.matCode;
  337. delete row.matName;
  338. delete row.drugsSpecsName;
  339. delete row.matUsageName;
  340. delete row.matDose;
  341. delete row.matUnitName;
  342. delete row.matXsj;
  343. delete row.matPfj;
  344. delete row.drugMark;
  345. this.medicines.splice(index, 1, row);
  346. }
  347. if (this.getEmptyMedicineRowIndex === -1) this.appendMedicine({}, index + 1);
  348. if (this.showRS) this.loadRS();
  349. },
  350. appendMedicine(model, index = this.medicines.length) {
  351. this.medicines.splice(index, 0, model || {});
  352. },
  353. deleteMedicine(row, index) {
  354. this.medicines.splice(index, 1);
  355. if (this.showRS) this.loadRS();
  356. },
  357. updateMedicine(row, index) {
  358. this.medicines.splice(index, 1, {...row, subtotalMoney: this.calculationMedicinePrice(row)});
  359. if (this.showRS) this.loadRS();
  360. },
  361. calculationMedicinePrice(medicine) {
  362. let price = chain(bignumber(medicine.matXsj || 0));
  363. return price.multiply(bignumber(medicine.matDose || 0)).value.valueOf();
  364. },
  365. medicinesCellSpan({row, column, rowIndex, columnIndex}) {
  366. if (columnIndex >= 2 && !(row && row.matCode)) return {
  367. rowspan: 1,
  368. colspan: 8,
  369. };
  370. },
  371. toggleShowRS(show = true) {
  372. this.showRS = show && !this.showRS;
  373. if (this.showRS) this.loadRS();
  374. },
  375. },
  376. };
  377. </script>
  378. <template>
  379. <el-form v-loading="loading" class="wrapper" ref="form"
  380. :model="model" :rules="rules" label-position="right" label-width="auto"
  381. >
  382. <el-row :gutter="20">
  383. <el-col class="col-container" :span="12">
  384. <div class="row">
  385. <div class="title-container">医疗机构信息</div>
  386. <el-row class="form-container" :gutter="8">
  387. <el-col :span="8">
  388. <el-form-item label="医疗机构" prop="yljgId">
  389. <el-select v-model="model.yljgId" placeholder="请选择医疗机构" clearable>
  390. <el-option v-for="item in mechanismOptions" :key="item.code" :value="item.code" :label="item.name"
  391. :disabled="item.disabled"></el-option>
  392. </el-select>
  393. </el-form-item>
  394. </el-col>
  395. <el-col :span="8">
  396. <el-form-item label="门诊住院" prop="preMzZy">
  397. <el-select v-model="model.preMzZy" placeholder="请选择" clearable>
  398. <el-option v-for="item in recipeCategoryOptions" :key="item.label" :label="item.label"
  399. :value="item.value"></el-option>
  400. </el-select>
  401. </el-form-item>
  402. </el-col>
  403. <el-col :span="8">
  404. <el-form-item label="编号" prop="recipeBh">
  405. <el-input v-model="model.recipeBh" placeholder="请输入编号"/>
  406. </el-form-item>
  407. </el-col>
  408. <el-col :span="8">
  409. <el-form-item label="受理时间" prop="tackleTime">
  410. <el-date-picker v-model="model.tackleTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
  411. placeholder="请选择受理时间"></el-date-picker>
  412. </el-form-item>
  413. </el-col>
  414. <el-col :span="8">
  415. <el-form-item label="处方号" prop="preNo">
  416. <el-input v-model="model.preNo" placeholder="请输入处方号"/>
  417. </el-form-item>
  418. </el-col>
  419. <el-col :span="8">
  420. <el-form-item label="序号" prop="recipeSerial">
  421. <el-input v-model="model.recipeSerial" placeholder="请输入序号"/>
  422. </el-form-item>
  423. </el-col>
  424. </el-row>
  425. </div>
  426. <div class="row">
  427. <div class="title-container">就诊信息</div>
  428. <el-row class="form-container" :gutter="8">
  429. <el-col :span="8">
  430. <el-form-item label="患者姓名" prop="name">
  431. <el-input v-model="model.name" placeholder="请输入患者姓名"/>
  432. </el-form-item>
  433. </el-col>
  434. <el-col :span="8">
  435. <el-form-item label-width="4em" label="年龄" prop="age">
  436. <div style="display: flex">
  437. <el-input-number v-model="model.age" :controls="false" controls-position="right"
  438. :min="0" placeholder="请输入"
  439. ></el-input-number>
  440. </div>
  441. </el-form-item>
  442. <el-form-item label-width="4em" label="性别" prop="sex">
  443. <el-select v-model="model.sex" placeholder="请选择" clearable>
  444. <el-option v-for="item in genderOptions" :key="item.label" :label="item.label"
  445. :value="item.value"></el-option>
  446. </el-select>
  447. </el-form-item>
  448. </el-col>
  449. <el-col :span="8">
  450. <el-form-item label="电话" prop="recipientTel">
  451. <el-input type="tel" v-model="model.recipientTel" placeholder="请输入电话" minlength="11"
  452. maxlength="11"/>
  453. </el-form-item>
  454. </el-col>
  455. <el-col :span="8">
  456. <el-form-item label="就诊科室" prop="department">
  457. <el-input v-model="model.department" placeholder="请输入就诊科室"/>
  458. </el-form-item>
  459. </el-col>
  460. <el-col :span="8">
  461. <el-form-item label="病区" prop="inpatientArea">
  462. <el-input v-model="model.inpatientArea" placeholder="请输入病区"/>
  463. </el-form-item>
  464. </el-col>
  465. <el-col :span="8">
  466. <el-form-item label="病床" prop="bedNo">
  467. <el-input v-model="model.bedNo" placeholder="请输入病床"/>
  468. </el-form-item>
  469. </el-col>
  470. <el-col :span="16">
  471. <el-form-item label="临床诊断" prop="disName">
  472. <el-input v-model="model.disName" placeholder="请输入临床诊断"/>
  473. </el-form-item>
  474. </el-col>
  475. <el-col :span="8">
  476. <el-form-item label="医生" prop="doctor">
  477. <el-input v-model="model.doctor" placeholder="请输入医生"/>
  478. </el-form-item>
  479. </el-col>
  480. <el-col :span="8">
  481. <el-form-item label="医院金额" prop="prescription_prescriptionTotleSum">
  482. <el-input-number class="full" v-model="model.prescription_prescriptionTotleSum" :controls="false"
  483. :precision="2" :step="1" :min="0" placeholder="请输入"
  484. ></el-input-number>
  485. </el-form-item>
  486. </el-col>
  487. <el-col :span="8">
  488. <el-form-item label="代煎费" prop="prescription_daijianCost">
  489. <el-input-number class="full" v-model="model.prescription_daijianCost" :controls="false"
  490. :precision="2" :step="1" :min="0" placeholder="请输入"
  491. ></el-input-number>
  492. </el-form-item>
  493. </el-col>
  494. <el-col :span="8">
  495. <el-form-item label="配送费" prop="prescription_distributionCost">
  496. <el-input-number class="full" v-model="model.prescription_distributionCost" :controls="false"
  497. :precision="2" :step="1" :min="0" placeholder="请输入"
  498. ></el-input-number>
  499. </el-form-item>
  500. </el-col>
  501. </el-row>
  502. </div>
  503. <div class="row">
  504. <div class="title-container">处方信息</div>
  505. <el-row class="form-container" :gutter="8">
  506. <el-col :span="8">
  507. <el-form-item label-width="3em" label="剂型" prop="prescription_dosageForm">
  508. <el-select v-model="model.prescription_dosageForm" placeholder="请选择" clearable>
  509. <el-option v-for="item in dosageFormOptions" :key="item.dictValue"
  510. :label="item.dictLabel" :value="item.dictValue"
  511. ></el-option>
  512. </el-select>
  513. </el-form-item>
  514. <el-form-item label-width="3em" label="用法" prop="prescription_prescriptionUsage">
  515. <el-select v-model="model.prescription_prescriptionUsage" placeholder="请选择" clearable>
  516. <el-option v-for="item in usageOptions" :key="item.dictValue"
  517. :label="item.dictLabel" :value="item.dictValue"
  518. ></el-option>
  519. </el-select>
  520. </el-form-item>
  521. </el-col>
  522. <el-col :span="8">
  523. <el-form-item label-width="3em" label="剂数" prop="prescription_number">
  524. <el-input-number v-model="model.prescription_number" :controls="false" controls-position="right"
  525. :min="0" placeholder="请输入"
  526. ></el-input-number>
  527. </el-form-item>
  528. <el-form-item label-width="3em" label="包数" prop="pack_packageNumber">
  529. <el-input-number v-model="model.pack_packageNumber" :controls="false" controls-position="right"
  530. :min="0" placeholder="请输入"
  531. ></el-input-number>
  532. </el-form-item>
  533. </el-col>
  534. <el-col :span="8">
  535. <el-form-item label="包装量" prop="pack_packageDose">
  536. <div style="display: flex">
  537. <el-input-number class="full" v-model="model.pack_packageDose" :controls="false"
  538. :precision="2" :step="1" :min="0" placeholder="请输入"
  539. ></el-input-number>
  540. <span style="flex: none; margin-left: 4px;">ml</span>
  541. </div>
  542. </el-form-item>
  543. </el-col>
  544. <el-col :span="8">
  545. <el-form-item label-width="3em" label="代煎" prop="isBehalf">
  546. <el-select v-model="model.isBehalf" placeholder="是 / 否" clearable>
  547. <el-option v-for="item in whetherOptions" :key="item.value"
  548. :label="item.label" :value="item.value"
  549. ></el-option>
  550. </el-select>
  551. </el-form-item>
  552. <el-form-item label-width="3em" label="配送" prop="takingMethod">
  553. <el-select v-model="model.takingMethod" placeholder="是 / 否" clearable>
  554. <el-option label="是" :value="'配送'"></el-option>
  555. <el-option label="否" :value="'自提'"></el-option>
  556. </el-select>
  557. </el-form-item>
  558. </el-col>
  559. <el-col :span="16">
  560. <el-row>
  561. <el-col :span="8">
  562. <el-form-item label="服药频次" prop="prescription_frequency">
  563. <el-select v-model="model.prescription_frequency" placeholder="请选择服药频次" clearable>
  564. <el-option v-for="item in frequencyOptions" :key="item.dictValue"
  565. :label="item.dictLabel" :value="item.dictValue"
  566. ></el-option>
  567. </el-select>
  568. </el-form-item>
  569. </el-col>
  570. <el-col :span="8">
  571. <el-form-item label="用法方式" prop="prescription_usageMethod">
  572. <el-select v-model="model.prescription_usageMethod" placeholder="请选择用法方式" clearable>
  573. <el-option v-for="item in usageMethodOptions" :key="item.dictValue"
  574. :label="item.dictLabel" :value="item.dictValue"
  575. ></el-option>
  576. </el-select>
  577. </el-form-item>
  578. </el-col>
  579. <el-col :span="8">
  580. <el-form-item label="服药时间" prop="prescription_medicationTime">
  581. <el-select v-model="model.prescription_medicationTime" placeholder="请选择服药时间" clearable>
  582. <el-option v-for="item in medicationTimeOptions" :key="item.dictValue"
  583. :label="item.dictLabel" :value="item.dictValue"
  584. ></el-option>
  585. </el-select>
  586. </el-form-item>
  587. </el-col>
  588. </el-row>
  589. </el-col>
  590. <el-col v-if="showPharmacy" :span="8">
  591. <el-form-item label="药房" prop="yfId">
  592. <el-select v-model="model.yfId" placeholder="请选择药房" clearable>
  593. <el-option v-for="item in pharmacyList" :key="item.id" :label="item.name" :value="item.id"
  594. :disabled="item.disabled"></el-option>
  595. </el-select>
  596. </el-form-item>
  597. </el-col>
  598. <el-col :span="showPharmacy ? 16 : 24">
  599. <el-form-item label-width="3em" label="医嘱" prop="prescription_entrust">
  600. <el-input v-model="model.prescription_entrust" placeholder="请输入医嘱"/>
  601. </el-form-item>
  602. </el-col>
  603. </el-row>
  604. </div>
  605. <div class="row">
  606. <div class="title-container">配送信息</div>
  607. <el-row class="form-container" :gutter="8">
  608. <el-col :span="8">
  609. <el-form-item label="配送方式" prop="expressExecutor">
  610. <el-select v-model="model.expressExecutor" placeholder="请选择配送方式" clearable
  611. @change="updateValidator(['consignee', 'contactNumber', 'location', 'address'])">
  612. <el-option v-for="item in expressExecutorOptions" :key="item.label" :label="item.label"
  613. :value="item.value"></el-option>
  614. </el-select>
  615. </el-form-item>
  616. </el-col>
  617. <el-col :span="8">
  618. <el-form-item label="收件人" prop="consignee">
  619. <el-input v-model="model.consignee" placeholder="请输入收件人"/>
  620. </el-form-item>
  621. </el-col>
  622. <el-col :span="8">
  623. <el-form-item label="收件电话" prop="contactNumber">
  624. <el-input type="tel" v-model="model.contactNumber" placeholder="请输入收件电话" minlength="11"
  625. maxlength="11"/>
  626. </el-form-item>
  627. </el-col>
  628. <el-col :span="24">
  629. <el-form-item label="收件地址" prop="location">
  630. <el-cascader v-model="model.location" :options="regionOptions" :props="{ value: 'label' }"
  631. placeholder="请选择省/市/区" clearable></el-cascader>
  632. </el-form-item>
  633. <el-form-item label-width="4px" prop="address">
  634. <el-input v-model="model.address" placeholder="请输入详细地址"/>
  635. </el-form-item>
  636. </el-col>
  637. <el-col :span="16">
  638. <el-form-item style="flex-basis: 70%;" label="快递单号" prop="expressCode">
  639. <el-input v-model="model.expressCode" placeholder="请输入快递单号"/>
  640. </el-form-item>
  641. <el-form-item style="flex-basis: 15%;" label-width="4px" label="" prop="expressDech">
  642. <el-select v-model="model.expressDech" placeholder="顺丰标快" clearable>
  643. <el-option v-for="item in expressDechOptions" :key="item.dictValue"
  644. :label="item.dictLabel" :value="item.dictValue"
  645. ></el-option>
  646. </el-select>
  647. </el-form-item>
  648. <el-form-item style="flex-basis: 10%;" label-width="4px" label="" prop="expressPayType">
  649. <el-select v-model="model.expressPayType" placeholder="月结" clearable>
  650. <el-option v-for="item in expressPayTypeOptions" :key="item.dictValue"
  651. :label="item.dictLabel" :value="item.dictValue"
  652. ></el-option>
  653. </el-select>
  654. </el-form-item>
  655. </el-col>
  656. <el-col :span="8">
  657. <el-form-item label="用药时间" prop="expressTime">
  658. <el-date-picker v-model="model.expressTime" type="datetime" value-format="yyyy-MM-dd HH:mm"
  659. placeholder="请选择用药时间" clearable></el-date-picker>
  660. </el-form-item>
  661. </el-col>
  662. </el-row>
  663. </div>
  664. <div class="row">
  665. <div class="title-container">煎煮信息</div>
  666. <el-row class="form-container" :gutter="8">
  667. <el-col :span="8">
  668. <el-form-item label="是否毒性" prop="decoct_isPoison">
  669. <el-select v-model="model.decoct_isPoison" placeholder="请选择" clearable>
  670. <el-option label="是" :value="'1'"></el-option>
  671. <el-option label="否" :value="'0'"></el-option>
  672. </el-select>
  673. </el-form-item>
  674. </el-col>
  675. <el-col :span="8">
  676. <el-form-item label="浸泡水量" prop="steep_soakingWaterValue">
  677. <div style="display: flex">
  678. <el-input-number class="full" v-model="model.steep_soakingWaterValue" :controls="false"
  679. :precision="2" :step="1" :min="0" placeholder="请输入"
  680. ></el-input-number>
  681. <span style="flex: none; margin-left: 4px;">ml</span>
  682. </div>
  683. </el-form-item>
  684. </el-col>
  685. <el-col :span="8">
  686. <el-form-item label="浸泡时间" prop="steep_soakingTime">
  687. <div style="display: flex">
  688. <el-input-number class="full" v-model="model.steep_soakingTime" :controls="false"
  689. :precision="2" :step="1" :min="0" placeholder="请输入"
  690. ></el-input-number>
  691. <span style="flex: none; margin-left: 4px;">min</span>
  692. </div>
  693. </el-form-item>
  694. </el-col>
  695. <el-col :span="8">
  696. <el-form-item label="煎药方案" prop="decoct_schemeId">
  697. <el-select v-model="model.decoct_schemeId" placeholder="请选择煎药方案" clearable
  698. @change="updateJDModel">
  699. <el-option v-for="item in schemeOptions" :key="item.id"
  700. :label="item.schemeName" :value="item.id"
  701. ></el-option>
  702. </el-select>
  703. </el-form-item>
  704. </el-col>
  705. <el-col :span="8">
  706. <el-form-item label="压力模式" prop="decoct_pressurePattern">
  707. <el-select v-model="model.decoct_pressurePattern" placeholder="请选择压力模式" clearable>
  708. <el-option v-for="item in patternOptions" :key="item.dictCode"
  709. :label="item.dictLabel" :value="item.dictValue"
  710. ></el-option>
  711. </el-select>
  712. </el-form-item>
  713. </el-col>
  714. <el-col :span="8">
  715. <el-form-item label="煎煮时间" prop="decoct_decoctTime">
  716. <div style="display: flex">
  717. <el-input-number class="full" v-model="model.decoct_decoctTime" :controls="false"
  718. :precision="2" :step="1" :min="0"
  719. ></el-input-number>
  720. <span style="flex: none; margin-left: 4px;">min</span>
  721. </div>
  722. </el-form-item>
  723. </el-col>
  724. <el-col :span="6">
  725. <el-form-item label="先煎时间" prop="decoct_preDecoctTime">
  726. <div style="display: flex">
  727. <el-input-number class="full" v-model="model.decoct_preDecoctTime" :controls="false"
  728. :precision="2" :step="1" :min="0"
  729. ></el-input-number>
  730. <span style="flex: none; margin-left: 4px;">min</span>
  731. </div>
  732. </el-form-item>
  733. </el-col>
  734. <el-col :span="6">
  735. <el-form-item label="一煎时间" prop="decoct_firstDecoctTime">
  736. <div style="display: flex">
  737. <el-input-number class="full" v-model="model.decoct_firstDecoctTime" :controls="false"
  738. :precision="2" :step="1" :min="0"
  739. ></el-input-number>
  740. <span style="flex: none; margin-left: 4px;">min</span>
  741. </div>
  742. </el-form-item>
  743. </el-col>
  744. <el-col :span="6">
  745. <el-form-item label="二煎时间" prop="decoct_secondDecoctTime">
  746. <div style="display: flex">
  747. <el-input-number class="full" v-model="model.decoct_secondDecoctTime" :controls="false"
  748. :precision="2" :step="1" :min="0"
  749. ></el-input-number>
  750. <span style="flex: none; margin-left: 4px;">min</span>
  751. </div>
  752. </el-form-item>
  753. </el-col>
  754. <el-col :span="6">
  755. <el-form-item label="后下时间" prop="decoct_backDownTime">
  756. <div style="display: flex">
  757. <el-input-number class="full" v-model="model.decoct_backDownTime" :controls="false"
  758. :precision="2" :step="1" :min="0"
  759. ></el-input-number>
  760. <span style="flex: none; margin-left: 4px;">min</span>
  761. </div>
  762. </el-form-item>
  763. </el-col>
  764. </el-row>
  765. </div>
  766. <transition name="slide-left">
  767. <div v-if="showRS" class="drawer-container">
  768. <div class="header">智能审方</div>
  769. <div class="main" v-loading="rsLoading">
  770. <el-empty v-if="!rsLoading && rs.length === 0">
  771. <el-button type="primary" @click="toggleShowRS(false)">关闭</el-button>
  772. </el-empty>
  773. <div v-for="block in rs" :key="block.title">
  774. <div class="rs-title">{{ block.title }}</div>
  775. <el-row :gutter="20">
  776. <el-col :span="24" v-for="item in block.collection" :key="item.name" style="margin-top: 8px;"
  777. v-html="item"></el-col>
  778. </el-row>
  779. </div>
  780. </div>
  781. <i class="el-icon-circle-close close" @click="toggleShowRS(false)"></i>
  782. </div>
  783. </transition>
  784. </el-col>
  785. <el-col class="col-container" :span="12">
  786. <div class="area" style="flex: auto;display: flex;flex-direction: column;">
  787. <div style="flex: none;display: flex;justify-content: space-between;align-items: center;">
  788. <div style="display: flex;align-items: center;">
  789. <span style="flex: none">协定方:</span>
  790. <el-input></el-input>
  791. <el-button style="margin-left: 8px;" type="primary" size="small">添加</el-button>
  792. </div>
  793. <div>
  794. <span>合计 </span>
  795. <span style="font-weight: 700;">{{ medicineTotal }}</span>
  796. <span> 味药品,总重 </span>
  797. <span style="font-weight: 700;">{{ medicineDosageTotal }}</span>
  798. </div>
  799. </div>
  800. <div v-if="tableHeight" style="flex: auto;margin: 12px 0;">
  801. <el-table style="width: 100%;" :height="tableHeight" size="mini" :data="medicines"
  802. :span-method="medicinesCellSpan">
  803. <el-table-column label="" width="48" align="center" fixed>
  804. <template slot-scope="scope">
  805. <el-button type="danger" icon="el-icon-close" circle size="mini"
  806. :disabled="Object.keys(scope.row).length === 0 || saving"
  807. @click="deleteMedicine(scope.row, scope.$index)"
  808. ></el-button>
  809. </template>
  810. </el-table-column>
  811. <el-table-column label="序号" type="index" width="55" align="center" fixed></el-table-column>
  812. <el-table-column label="药品名称" prop="matName" min-width="120px" align="center">
  813. <template slot-scope="scope">
  814. <template v-if="!scope.row.matCode">
  815. <v-selectpage :tb-columns="searchTableForSystemColumns"
  816. key-field="drugsId" v-model="scope.row.matCode"
  817. placeholder="请输入药品名称" title="药品"
  818. data="drugsSearchForSystem" :params="{}" :pagination="false"
  819. :result-format="searchMedicinesFormat"
  820. @values="selectMedicine($event, scope.row, scope.$index)"
  821. ></v-selectpage>
  822. </template>
  823. <a v-else>
  824. {{ scope.row.matName }}
  825. <i class="icon el-icon-circle-close" @click="selectMedicine([], scope.row, scope.$index)"></i>
  826. </a>
  827. </template>
  828. </el-table-column>
  829. <el-table-column label="规格" prop="drugsSpecsName" min-width="110px" align="center"></el-table-column>
  830. <el-table-column label="剂量" prop="matDose" width="110px" align="center">
  831. <template slot-scope="scope" v-if="scope.row.matCode">
  832. <el-input-number style="width: 100%;" v-model="scope.row.matDose" :min="0" :precision="2"
  833. :controls="false"
  834. :disabled="saving" size="mini"
  835. @change="updateMedicine(scope.row, scope.$index)"></el-input-number>
  836. </template>
  837. </el-table-column>
  838. <el-table-column label="单位" prop="matUnitName" align="center"></el-table-column>
  839. <el-table-column label="用法" prop="matUsageName" width="110px" align="center">
  840. <template slot-scope="scope" v-if="scope.row.matCode">
  841. <el-input v-model="scope.row.matUsageName" :disabled="saving"
  842. @input="updateMedicine(scope.row, scope.$index)"></el-input>
  843. </template>
  844. </el-table-column>
  845. <el-table-column label="标记" prop="drugMark" width="110px" align="center">
  846. <template slot-scope="scope" v-if="scope.row.matCode">
  847. <el-select v-model="scope.row.drugMark" placeholder="" clearable :disabled="saving">
  848. <el-option v-for="item in drugMarkOptions" :key="item.dictValue"
  849. :label="item.dictLabel" :value="item.dictValue"
  850. ></el-option>
  851. </el-select>
  852. </template>
  853. </el-table-column>
  854. <el-table-column label="批发价" prop="matPfj" width="110" align="center"></el-table-column>
  855. <el-table-column label="零售价" prop="matXsj" width="110" align="center"></el-table-column>
  856. <el-table-column label="小计" prop="subtotalMoney" width="110" align="center"></el-table-column>
  857. </el-table>
  858. </div>
  859. <el-row style="flex: none;" :gutter="8">
  860. <el-col :span="8" style="text-align: center;">
  861. <span>批发费用:</span>
  862. <span style="font-weight: 700;">{{ medicineWholesalePriceTotal }}</span>
  863. </el-col>
  864. <el-col :span="8" style="text-align: center;">
  865. <span>零售费用:</span>
  866. <span style="font-weight: 700;">{{ medicinePriceTotal }}</span>
  867. </el-col>
  868. <el-col :span="8" style="text-align: center;">
  869. <span>含税金额:</span>
  870. <span style="font-weight: 700;">{{ medicineWholesalePriceTotal }}</span>
  871. </el-col>
  872. </el-row>
  873. </div>
  874. <el-input v-if="isCheck" style="margin-top: 12px;" v-model="model.remarks" type="textarea"
  875. placeholder="若审核拒绝,请输入原因"
  876. :autosize="{ minRows: 2, maxRows: 2}">
  877. </el-input>
  878. <div class="footer">
  879. <div>
  880. <template v-if="isCheck">
  881. <div v-if="model.remarks">
  882. <el-button type="danger" @click="model.remarks && check('120')" :disabled="saving">审核拒绝</el-button>
  883. </div>
  884. <el-popconfirm v-else title="不通过理由未输入,确定现在提交?" icon="el-icon-info" icon-color="red"
  885. @confirm="check('120')">
  886. <template slot="reference">
  887. <el-button type="danger" :disabled="saving">审核拒绝</el-button>
  888. </template>
  889. </el-popconfirm>
  890. </template>
  891. </div>
  892. <div>
  893. <el-button v-if="isCheck" type="primary" plain @click="toggleShowRS()"
  894. :disabled="!getEmptyMedicineRowIndex">{{ showRS ? '关闭' : '' }}智能审方
  895. </el-button>
  896. <el-button v-if="isCheck" type="primary" @click="check('110')" :disabled="saving">审核通过</el-button>
  897. <el-button v-else type="primary" :loading="saving" @click="handle">保 存</el-button>
  898. <el-button @click="cancel">取 消</el-button>
  899. </div>
  900. </div>
  901. </el-col>
  902. </el-row>
  903. </el-form>
  904. </template>
  905. <style scoped lang="scss">
  906. .wrapper {
  907. display: flex;
  908. height: 100%;
  909. overflow: hidden;
  910. .col-container {
  911. display: flex;
  912. flex-direction: column;
  913. height: 100%;
  914. &:first-of-type {
  915. overflow: auto;
  916. //justify-content: space-between;
  917. }
  918. }
  919. .row {
  920. display: flex;
  921. margin: 12px 0;
  922. &:first-of-type {
  923. margin-top: 0;
  924. }
  925. &:last-of-type {
  926. margin-bottom: 0;
  927. }
  928. .title-container {
  929. flex: none;
  930. display: flex;
  931. align-items: center;
  932. padding: 12px 6px;
  933. width: 2.8em;
  934. color: #fff;
  935. font-weight: 700;
  936. letter-spacing: 0.3em;
  937. line-height: 1.5em;
  938. text-align: right;
  939. box-sizing: content-box;
  940. background-color: #1DBFA7;
  941. }
  942. .form-container {
  943. flex: auto;
  944. padding: 12px 12px 0;
  945. background-color: #5AD8A6;
  946. .el-col {
  947. display: flex;
  948. > .el-form-item {
  949. flex: 1 0 50%;
  950. width: 100%;
  951. }
  952. }
  953. .el-form-item {
  954. margin-bottom: 12px;
  955. ::v-deep {
  956. .el-form-item__label {
  957. color: #000;
  958. padding-right: 6px;
  959. }
  960. .el-input__inner {
  961. padding-left: 6px;
  962. padding-right: 24px;
  963. }
  964. }
  965. .el-date-editor ::v-deep {
  966. .el-input__inner {
  967. padding-left: 28px;
  968. }
  969. }
  970. }
  971. }
  972. }
  973. .area {
  974. padding: 12px 6px;
  975. color: #000;
  976. background-color: #5AD8A6;
  977. }
  978. .el-table {
  979. ::v-deep {
  980. th {
  981. color: #000;
  982. background-color: #1DBFA7;
  983. }
  984. tr {
  985. color: #000;
  986. background-color: #D9EEE5;
  987. }
  988. }
  989. }
  990. }
  991. .el-input-number--medium {
  992. width: auto;
  993. &:not(.full) {
  994. width: min-content;
  995. min-width: 100px;
  996. }
  997. }
  998. .el-form, .el-input, .el-select, .el-cascader {
  999. width: 100%;
  1000. }
  1001. .footer {
  1002. flex: none;
  1003. margin-top: 12px;
  1004. display: flex;
  1005. justify-content: space-between;
  1006. }
  1007. .col-container {
  1008. position: relative;
  1009. .drawer-container {
  1010. position: absolute;
  1011. top: 0;
  1012. bottom: 0;
  1013. left: 0;
  1014. right: 0;
  1015. display: flex;
  1016. flex-direction: column;
  1017. padding: 12px 10px;
  1018. background-color: #fff;
  1019. .close {
  1020. position: absolute;
  1021. top: 12px + 4px;
  1022. right: 12px;
  1023. font-size: 24px;
  1024. cursor: pointer;
  1025. &:hover {
  1026. color: #5AD8A6;
  1027. }
  1028. }
  1029. > .header {
  1030. flex: none;
  1031. font-size: 20px;
  1032. font-weight: 700;
  1033. text-align: center;
  1034. line-height: 32px;
  1035. }
  1036. > .main {
  1037. flex: auto;
  1038. overflow-x: hidden;
  1039. overflow-y: auto;
  1040. .rs-title {
  1041. margin-top: 12px;
  1042. font-size: 18px;
  1043. font-weight: 700;
  1044. }
  1045. }
  1046. }
  1047. /* 动画效果 */
  1048. .slide-left-enter-active,
  1049. .slide-left-leave-active {
  1050. transition: transform 0.3s ease;
  1051. }
  1052. .slide-left-enter,
  1053. .slide-left-leave-to {
  1054. transform: translateX(-100%);
  1055. }
  1056. }
  1057. </style>
  1058. <style lang="scss">
  1059. .el-dialog {
  1060. &.prescription-core-edit-container {
  1061. overflow: hidden;
  1062. }
  1063. &__header {
  1064. flex: none;
  1065. padding: 12px 12px 0;
  1066. }
  1067. &__body {
  1068. flex: auto;
  1069. padding: 12px;
  1070. > * {
  1071. height: 100%;
  1072. }
  1073. }
  1074. }
  1075. </style>