prescriptionTable.vue 37KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844
  1. <template>
  2. <div class="prescriptionTable">
  3. <el-table v-if="activeType == 1" :data="prescription.advices" border style="width: 99%;"
  4. :row-style="{ color: '#303133' }"
  5. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
  6. <el-table-column align="center" prop="day" width="70" label="序号" fixed>
  7. <template slot-scope="scope">
  8. <div style="display:flex;align-items:center;">
  9. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.groupno" placeholder="" @input="getAllIndex(scope.row)"></el-input>
  10. </div>
  11. </template>
  12. </el-table-column>
  13. <el-table-column align="center" prop="drug_name" label="名称" fixed>
  14. <template slot-scope="scope"><span :title="scope.row.drug_name">{{ scope.row.drug_name }}</span>
  15. </template>
  16. </el-table-column>
  17. <el-table-column align="center" prop="drug_name" label="规格">
  18. <template slot-scope="scope">
  19. <span>
  20. {{ scope.row.drug.dose }}{{ scope.row.drug.dose_unit }}*{{ scope.row.drug.min_number }}{{ scope.row.drug.min_unit }}/{{ scope.row.drug.max_unit }}
  21. </span>
  22. </template>
  23. </el-table-column>
  24. <el-table-column align="center" prop="single_dose" width="120" label="单次用量">
  25. <template slot-scope="scope">
  26. <div style="display:flex;align-items:center;">
  27. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.single_dose" @input="getAllChangeTwo(scope)"
  28. style="width:50%;"></el-input>
  29. <!-- <div>{{scope.row.single_dose_unit}}</div> -->
  30. <el-select v-model="scope.row.single_dose_unit" placeholder="请选择" style="width:50%;"
  31. @change="getAllChangeTwo(scope)" :disabled="scope.row.is_medicine == 1" >
  32. <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
  33. <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
  34. <el-option :label="scope.row.drug.dose_unit"
  35. v-if="scope.row.drug.dose_unit != scope.row.drug.min_unit"
  36. :value="scope.row.drug.dose_unit"></el-option>
  37. </el-select>
  38. </div>
  39. </template>
  40. </el-table-column>
  41. <el-table-column align="center" prop="delivery_way" width="100" label="用法">
  42. <template slot-scope="scope">
  43. <el-select :disabled="scope.row.is_medicine == 1" v-model="scope.row.delivery_way" placeholder="请选择">
  44. <el-option
  45. v-for="(item,index) in drugways"
  46. :key="index"
  47. :label="item.name"
  48. :value="item.name">
  49. </el-option>
  50. </el-select>
  51. </template>
  52. </el-table-column>
  53. <el-table-column align="center" prop="execution_frequency" width="100" label="频率">
  54. <template slot-scope="scope">
  55. <el-select :disabled="scope.row.is_medicine == 1" v-model="scope.row.execution_frequency" placeholder="请选择" @change="getAllChangeTwo(scope)">
  56. <el-option
  57. v-for="item,index in efs"
  58. :key="index"
  59. :label="item.name"
  60. :value="item.name">
  61. </el-option>
  62. </el-select>
  63. </template>
  64. </el-table-column>
  65. <el-table-column align="center" prop="day" width="70" label="天数">
  66. <template slot-scope="scope">
  67. <div style="display:flex;align-items:center;">
  68. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.day" @input="getAllChangeTwo(scope)" placeholder=""></el-input>
  69. {{'天'}}
  70. </div>
  71. </template>
  72. </el-table-column>
  73. <el-table-column align="center" prop="prescribing_number" width="120" label="总量">
  74. <template slot-scope="scope">
  75. <div style="display:flex;align-items:center;">
  76. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.prescribing_number" @input="changePrescribingNumber(scope)"
  77. style="width:50%" placeholder=""></el-input>
  78. <!-- <div> {{scope.row.prescribing_number_unit}}</div> -->
  79. <el-select :disabled="scope.row.is_medicine == 1" v-model="scope.row.prescribing_number_unit" placeholder="请选择" style="width:50%;"
  80. @change="getPrescribingNumberUnit(scope)">
  81. <el-option :label="scope.row.drug.min_unit" :value="scope.row.drug.min_unit"></el-option>
  82. <el-option :label="scope.row.drug.max_unit"
  83. v-if="scope.row.drug.min_unit != scope.row.drug.max_unit"
  84. :value="scope.row.drug.max_unit"></el-option>
  85. </el-select>
  86. </div>
  87. </template>
  88. </el-table-column>
  89. <el-table-column align="center" prop="retail_price" width="80" label="单价">
  90. <template slot-scope="scope">
  91. <div style="display:flex;align-items:center;">
  92. <el-input v-model="scope.row.retail_price" placeholder="" readonly></el-input>
  93. <div>{{'元'}}</div>
  94. </div>
  95. </template>
  96. </el-table-column>
  97. <el-table-column align="center" prop="hosp_appr_flag" width="100" label="医院审批标志">
  98. <template slot-scope="scope">
  99. <el-select :disabled="scope.row.is_medicine == 1" v-model="scope.row.hosp_appr_flag" placeholder="请选择">
  100. <el-option label="审批通过" value="1"></el-option>
  101. <el-option label="无须审批" value="3"></el-option>
  102. <el-option label="审批不通过" value="2"></el-option>
  103. </el-select>
  104. </template>
  105. </el-table-column>
  106. <el-table-column align="center" prop="remark" width="80" label="国家编码">
  107. <template slot-scope="scope">
  108. <el-input v-model="scope.row.drug.medical_insurance_number" placeholder=""></el-input>
  109. </template>
  110. </el-table-column>
  111. <el-table-column align="center" prop="is_self_drug" width="100" label="医嘱性质" v-if="this.$store.getters.xt_user.org_id == 10206 || this.$store.getters.xt_user.org_id == 0">
  112. <template slot-scope="scope">
  113. <el-select :disabled="scope.row.is_medicine == 1" v-model="scope.row.is_self_drug" placeholder="请选择">
  114. <el-option label="非自备药" value="0"></el-option>
  115. <el-option label="自备药" value="1"></el-option>
  116. </el-select>
  117. </template>
  118. </el-table-column>
  119. <el-table-column align="center" prop="drug_way_count" width="100" label="给药途径次数" >
  120. <template slot-scope="scope">
  121. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.drug_way_count" :title="scope.row.drug_way_count" placeholder=""></el-input>
  122. </template>
  123. </el-table-column>
  124. <el-table-column align="center" prop="remark" width="50" label="备注">
  125. <template slot-scope="scope">
  126. <el-input :disabled="scope.row.is_medicine == 1" v-model="scope.row.remark" :title="scope.row.remark" placeholder=""></el-input>
  127. </template>
  128. </el-table-column>
  129. <el-table-column align="center" width="40" prop="name" label="操作" fixed="right">
  130. <template slot-scope="scope">
  131. <i class="el-icon-delete" @click="deleteDrug(scope.$index, scope.row)"></i>
  132. </template>
  133. </el-table-column>
  134. </el-table>
  135. <el-table v-if="activeType == 2" :data="prescription.project" border style="width: 99%;"
  136. :row-style="{ color: '#303133' }"
  137. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}" highlight-current-row>
  138. <el-table-column align="center" type="index" width="40" label="序号" fixed></el-table-column>
  139. <el-table-column align="center" prop="project_name" label="名称" fixed>
  140. <template slot-scope="scope">
  141. <span :title="scope.row.project_name" v-if="org_id != 10206">{{ scope.row.project_name }}</span>
  142. <span v-if="org_id == 10206&&scope.row.type==3">{{ scope.row.project_name }}{{scope.row.good_info.specification_name}}{{scope.row.good_info.good_number}}</span>
  143. <span v-if="org_id == 10206&&scope.row.type==2">{{ scope.row.project_name }}</span>
  144. </template>
  145. </el-table-column>
  146. <el-table-column align="center" prop="project_name" label="规格">
  147. <template slot-scope="scope">
  148. <span>{{ scope.row.project_name }}</span>
  149. </template>
  150. </el-table-column>
  151. <el-table-column align="center" prop="statistical_classification" width="100" label="组">
  152. <template slot-scope="scope">{{scope.row.statistical_classification}}
  153. </template>
  154. </el-table-column>
  155. <el-table-column align="center" prop="single_dose" width="80" label="单次用量">
  156. <template slot-scope="scope">
  157. <div style="display:flex;align-items:center;">
  158. <el-input v-model="scope.row.single_dose" @input="getProjectSingleDose(scope)"
  159. placeholder=""></el-input>
  160. <div>{{scope.row.unit}}</div>
  161. </div>
  162. </template>
  163. </el-table-column>
  164. <el-table-column align="center" prop="delivery_way" width="80" label="用法">
  165. <template slot-scope="scope">
  166. <el-autocomplete
  167. style="width:100%;"
  168. class="inline-input"
  169. v-model="scope.row.delivery_way"
  170. :fetch-suggestions="querySearch2"
  171. placeholder="请输入内容"
  172. ></el-autocomplete>
  173. </template>
  174. </el-table-column>
  175. <el-table-column align="center" prop="execution_frequency" width="80" label="频率">
  176. <template slot-scope="scope">
  177. <el-input v-model="scope.row.execution_frequency" @input="getProjectSingleDose(scope)"
  178. placeholder=""></el-input>
  179. </template>
  180. </el-table-column>
  181. <el-table-column align="center" prop="number_days" width="70" label="天数">
  182. <template slot-scope="scope">
  183. <div style="display:flex;align-items:center;">
  184. <el-input v-model="scope.row.number_days" @input="getProjectSingleDose(scope)"
  185. placeholder=""></el-input>
  186. <div>{{'天'}}</div>
  187. </div>
  188. </template>
  189. </el-table-column>
  190. <el-table-column align="center" prop="total" width="70" label="总量">
  191. <template slot-scope="scope">
  192. <div style="display:flex;align-items:center;">
  193. <el-input v-model="scope.row.total" style="width:60%" placeholder=""></el-input>
  194. <div>{{scope.row.unit}}</div>
  195. </div>
  196. </template>
  197. </el-table-column>
  198. <el-table-column align="center" prop="name" width="70" label="单价">
  199. <template slot-scope="scope">
  200. <div style="display:flex;align-items:center;">
  201. <el-input v-model="scope.row.price" placeholder="" readonly></el-input>
  202. <div>{{'元'}}</div>
  203. </div>
  204. </template>
  205. </el-table-column>
  206. <el-table-column align="center" prop="name" width="50" label="国家编码">
  207. <template slot-scope="scope" v-if="scope.row.type==3">
  208. <el-input v-model="scope.row.good_info.medical_insurance_number"></el-input>
  209. </template>
  210. <template slot-scope="scope" v-if="scope.row.type==2">
  211. <el-input v-model="scope.row.project.medical_code"></el-input>
  212. </template>
  213. </el-table-column>
  214. <el-table-column align="center" prop="name" width="50" label="备注">
  215. <template slot-scope="scope">
  216. <el-input v-model="scope.row.remark" :title="scope.row.remark"></el-input>
  217. </template>
  218. </el-table-column>
  219. <el-table-column align="center" width="40" prop="name" label="操作" fixed="right">
  220. <template slot-scope="scope">
  221. <i class="el-icon-delete" @click="deleteProject(scope.row,scope.$index)"></i>
  222. </template>
  223. </el-table-column>
  224. </el-table>
  225. <div class="additionalBox">
  226. <div class="additionalOne" v-for="(item,index) in prescription.addition" :key="index">
  227. <span :title="item.item_name">{{item.item_name}}</span>
  228. <el-input v-model="item.price" placeholder="" style="width:50px;"></el-input>
  229. <el-input v-model="item.count" placeholder="" style="width:50px;"></el-input>
  230. <i class="el-icon-delete deleteIcon" @click="delAddition(index,item)"></i>
  231. </div>
  232. </div>
  233. </div>
  234. </template>
  235. <script>
  236. import { getDictionaryDataConfig } from '@/utils/data'
  237. import { delHisAddition, delHisAdvice, delHisProject, getInitData,getHisDoctorAdviceInfo } from '@/api/his/his'
  238. export default {
  239. props: {
  240. preDrugs: Array,
  241. activeType: Number,
  242. addtions_charge: Array,
  243. prescription: {
  244. type: Object,
  245. default: function() {
  246. return {
  247. name: '',
  248. advices: [],
  249. project: [],
  250. drugways: [],
  251. efs: [],
  252. drugList:[],
  253. adviceList:{}
  254. }
  255. }
  256. }
  257. },
  258. data() {
  259. return {
  260. org_id:this.$store.getters.xt_user.org_id,
  261. advices: [],
  262. tableData: [],
  263. newoptions: [{
  264. value: '1',
  265. label: '1'
  266. }, {
  267. value: '2',
  268. label: '2'
  269. }, {
  270. value: '3',
  271. label: '3'
  272. }, {
  273. value: '4',
  274. label: '4'
  275. }, {
  276. value: '5',
  277. label: '5'
  278. }],
  279. value: '1',
  280. input: 1,
  281. efs: [],
  282. drugways: []
  283. }
  284. },
  285. methods: {
  286. createFilter(queryString) {
  287. return (restaurant) => {
  288. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  289. }
  290. },
  291. querySearch2(queryString, cb) {
  292. var restaurants = this.getDictionaryDataConfig('system', 'project_use')
  293. restaurants.map(item => {
  294. item.value = item.name
  295. })
  296. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  297. // 调用 callback 返回建议列表的数据
  298. cb(results)
  299. },
  300. delAddition(index, addition) {
  301. if (this.prescription.order_status == 2 || this.prescription.order_status == 5) {
  302. this.$message.error('该处方已经结算或记账,无法删除')
  303. return
  304. }
  305. this.$confirm('附加费删除后不可恢复,是否确认删除', '删除', {
  306. confirmButtonText: '确 定',
  307. cancelButtonText: '取 消',
  308. type: 'warning'
  309. }).then(() => {
  310. this.$nextTick(function() {
  311. if (addition.id == 0) {
  312. this.prescription.addition.splice(index, 1)
  313. } else {
  314. let params = {
  315. 'id': addition.id
  316. }
  317. delHisAddition(params).then(response => {
  318. if (response.data.state == 0) {
  319. this.$message.error(response.data.msg)
  320. return false
  321. } else {
  322. var temp2 = this.deepClone(this.prescription.addition)
  323. temp2.splice(index, 1)
  324. this.prescription.addition = temp2
  325. this.$message.success(response.data.data.msg)
  326. }
  327. })
  328. }
  329. })
  330. })
  331. .catch(() => {
  332. })
  333. },
  334. getInitData() {
  335. getInitData().then(response => {
  336. if (response.data.state == 0) {
  337. this.$message.error(response.data.msg)
  338. return false
  339. } else {
  340. this.drugways = response.data.data.drugways
  341. this.efs = response.data.data.efs
  342. this.drugList = response.data.data.drugs
  343. }
  344. })
  345. }, deleteDrug: function(index, row) {
  346. if (row.hasOwnProperty('is_medicine')&&row.is_medicine == 1){
  347. this.$message.error('该处方包含已发药的药品,无法删除')
  348. return
  349. }
  350. if (this.prescription.order_status == 2 || this.prescription.order_status ==5) {
  351. this.$message.error('该处方已经结算或记账,无法删除')
  352. return
  353. }
  354. this.$confirm('药品删除后不可恢复,是否确认删除', '删除', {
  355. confirmButtonText: '确 定',
  356. cancelButtonText: '取 消',
  357. type: 'warning'
  358. }).then(() => {
  359. this.$nextTick(function() {
  360. if (row.advice_id == 0) {
  361. this.prescription.advices.splice(index, 1)
  362. } else {
  363. let params = {
  364. 'id': row.advice_id
  365. }
  366. delHisAdvice(params).then(response => {
  367. if (response.data.state == 0) {
  368. this.$message.error(response.data.msg)
  369. return false
  370. } else {
  371. var temp2 = this.deepClone(this.prescription.advices)
  372. temp2.splice(index, 1)
  373. this.prescription.advices = temp2
  374. this.$message.success(response.data.data.msg)
  375. this.$emit("getSunziValue",temp2)
  376. }
  377. })
  378. }
  379. })
  380. })
  381. .catch(() => {
  382. })
  383. }, deepClone(source) {
  384. if (!source && typeof source !== 'object') {
  385. throw new Error('error arguments', 'shallowClone')
  386. }
  387. const targetObj = source.constructor === Array ? [] : {}
  388. Object.keys(source).forEach((keys) => {
  389. if (source[keys] && typeof source[keys] === 'object') {
  390. targetObj[keys] = this.deepClone(source[keys])
  391. } else {
  392. targetObj[keys] = source[keys]
  393. }
  394. })
  395. return targetObj
  396. },
  397. setNewData: function(data) {
  398. this.prescription = data
  399. // this.prescription.advices = data.advices
  400. },
  401. getDictionaryDataConfig(module, filed_name) {
  402. return getDictionaryDataConfig(module, filed_name)
  403. },
  404. getGroup(id) {
  405. var name = ''
  406. var statistics_category = getDictionaryDataConfig('system', 'statistics_category')
  407. // console.log('2235', statistics_category)
  408. for (let i = 0; i < statistics_category.length; i++) {
  409. if (id == statistics_category[i].id) {
  410. name = statistics_category[i].name
  411. }
  412. }
  413. return name
  414. },
  415. deleteProject(row, i) {
  416. if (this.prescription.order_status == 2 || this.prescription.order_status == 5) {
  417. this.$message.error('该处方已经结算或记账,无法删除')
  418. return
  419. }
  420. this.$confirm('项目删除后不可恢复,是否确认删除', '删除', {
  421. confirmButtonText: '确 定',
  422. cancelButtonText: '取 消',
  423. type: 'warning'
  424. }).then(() => {
  425. if (row.id == 0) {
  426. this.prescription.project.splice(i, 1)
  427. } else {
  428. let params = {
  429. 'id': row.id
  430. }
  431. delHisProject(params).then(response => {
  432. if (response.data.state == 0) {
  433. this.$message.error(response.data.msg)
  434. return false
  435. } else {
  436. for (let i = 0; i < this.prescription.project.length; i++) {
  437. if (this.prescription.project[i].id == row.id) {
  438. this.prescription.project.splice(i, 1)
  439. }
  440. }
  441. this.$message.success(response.data.data.msg)
  442. }
  443. })
  444. }
  445. })
  446. .catch(() => {
  447. })
  448. },
  449. getAllChange(scope) {
  450. console.log("scope23322332233232",scope)
  451. // if (this.prescription.is_medicine_status){
  452. // this.$message.error('该处方已经结算或记账,无法删除')
  453. //
  454. // }
  455. if(this.$store.getters.xt_user.org_id != 10206) {
  456. if (scope.row.drug.min_unit == scope.row.single_dose_unit) {
  457. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  458. console.log(1)
  459. scope.row.prescribing_number = scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)
  460. } else {
  461. console.log(12)
  462. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1)) * (scope.row.day ? scope.row.day : 1) / scope.row.drug.min_number)
  463. }
  464. } else {
  465. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  466. console.log(123)
  467. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / scope.row.drug.dose)
  468. } else {
  469. console.log(1234)
  470. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / scope.row.drug.dose / scope.row.drug.min_number)
  471. }
  472. }
  473. if (scope.row.prescribing_number == 0) {
  474. scope.row.prescribing_number = 1
  475. }
  476. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  477. // scope.row.retail_price = scope.row.drug.min_number / scope.row.retail_price
  478. if (scope.row.prescribing_number > scope.row.drug.sum_count) {
  479. this.$message.error(scope.row.drug_name + '库存不足')
  480. }
  481. } else {
  482. if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.sum_count) {
  483. this.$message.error(scope.row.drug_name + '库存不足')
  484. }
  485. // scope.row.retail_price = scope.row.drug.retail_price * scope.row.prescribing_number
  486. }
  487. }
  488. },
  489. getAllChangeTwo(scope) {
  490. // console.log("战国阿道夫阿道夫阿道夫",scope)
  491. // if (scope.row.hasOwnProperty('is_medicine')&&scope.row.is_medicine == 1){
  492. // this.$message.error('该处方包含已发药的药品,无法修改')
  493. // return
  494. // }
  495. if(this.$store.getters.xt_user.org_id != 10206) {
  496. console.log('yyyyyyyy',scope);
  497. if (scope.row.drug.min_unit == scope.row.single_dose_unit) {
  498. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  499. console.log(1)
  500. scope.row.prescribing_number = scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)
  501. } else {
  502. console.log(12)
  503. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1)) * (scope.row.day ? scope.row.day : 1) / scope.row.drug.min_number)
  504. }
  505. } else {
  506. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  507. console.log('123',scope.row.drug.dose)
  508. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / scope.row.drug.dose ) // / scope.row.drug.dose
  509. } else {
  510. console.log(1234)
  511. scope.row.prescribing_number = Math.ceil((scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.day ? scope.row.day : 1)) / scope.row.drug.dose / scope.row.drug.min_number)//
  512. }
  513. }
  514. if (scope.row.prescribing_number == 0) {
  515. scope.row.prescribing_number = 1
  516. }
  517. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  518. // scope.row.retail_price = scope.row.drug.min_number / scope.row.retail_price
  519. if (scope.row.drug.is_user != 1) {
  520. if (scope.row.prescribing_number > scope.row.drug.sum_count && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  521. this.$message.error(scope.row.drug_name + '库存不足')
  522. }
  523. }
  524. } else {
  525. if (scope.row.drug.is_user != 1) {
  526. if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.sum_count && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  527. this.$message.error(scope.row.drug_name + '库存不足')
  528. }
  529. }
  530. // scope.row.retail_price = scope.row.drug.retail_price * scope.row.prescribing_number
  531. }
  532. }
  533. },
  534. getPrescribingNumberUnit(scope) {
  535. if (scope.row.hasOwnProperty('is_medicine')&&scope.row.is_medicine == 1){
  536. this.$message.error('该处方包含已发药的药品,无法修改')
  537. return
  538. }
  539. console.log('scope',scope)
  540. // if(scope.row.drug.min_unit == scope.row.single_dose_unit){
  541. // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  542. // scope.row.prescribing_number = scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day
  543. // }else{
  544. // scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency)) * scope.row.day / scope.row.drug.min_number)
  545. // }
  546. // }else{
  547. // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  548. // scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day) / scope.row.drug.dose)
  549. // }else{
  550. // scope.row.prescribing_number = Math.ceil((scope.row.single_dose * this.getNum(scope.row.execution_frequency) * scope.row.day) / scope.row.drug.dose / scope.row.drug.min_number)
  551. // }
  552. // }
  553. // if(scope.row.prescribing_number == 0){
  554. // scope.row.prescribing_number = 1
  555. // }
  556. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit) {
  557. scope.row.retail_price = scope.row.drug.min_price
  558. // if (scope.row.prescribing_number > scope.row.drug.total) {
  559. // this.$message.error(scope.row.drug_name + '库存不足')
  560. // }
  561. } else {
  562. // if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.total) {
  563. // this.$message.error(scope.row.drug_name + '库存不足')
  564. // }
  565. scope.row.retail_price = scope.row.drug.retail_price
  566. }
  567. },
  568. changePrescribingNumber(scope) {
  569. // if (scope.row.hasOwnProperty('is_medicine')&&scope.row.is_medicine == 1){
  570. // this.$message.error('该处方包含已发药的药品,无法修改')
  571. // return
  572. // }
  573. // var max_number = 0
  574. // if(scope.row.prescribing_number_unit == scope.row.drug.max_unit){
  575. // max_number = parseInt(scope.row.prescribing_number) * scope.row.drug.min_number
  576. // }
  577. // if(scope.row.prescribing_number_unit == scope.row.drug.min_unit){
  578. // max_number = parseInt(scope.row.prescribing_number)
  579. // }
  580. // console.log("修改的数量",max_number)
  581. // //查询该药品库存
  582. // if(this.drugList.length > 0){
  583. // var stock_number = 0
  584. // for(let i=0;i<this.drugList.length;i++){
  585. // if(scope.row.id == this.drugList[i].id){
  586. // for(let j=0;j<this.drugList[i].stock_in.length;j++){
  587. // stock_number += this.drugList[i].stock_in[j].stock_max_number * this.drugList[i].min_number + this.drugList[i].stock_in[j].stock_min_number
  588. // }
  589. // }
  590. // }
  591. // console.log("库存数量",stock_number)
  592. // }
  593. // if(scope.row.advice_id > 0){
  594. // //获取该药品上一次出库的的数量
  595. // getHisDoctorAdviceInfo(scope.row.advice_id).then(response=>{
  596. // if(response.data.state == 1){
  597. // var out_count = 0
  598. // var adviceList = response.data.data.advice
  599. // if(adviceList.prescribing_number_unit == adviceList.drug.max_number){
  600. // out_count = adviceList.prescribing_number * adviceList.drug.min_number
  601. // }
  602. // if(adviceList.prescribing_number_unit == adviceList.drug.min_unit){
  603. // out_count = adviceList.prescribing_number
  604. // }
  605. // //如果更改的数量大于修改之前的数量
  606. // if(max_number > out_count){
  607. // if((max_number - out_count)>stock_number){
  608. // this.$message.error(scope.row.drug_name + '库存不足')
  609. // }
  610. // }
  611. // }
  612. // })
  613. // }
  614. // if(scope.row.advice_id == 0){
  615. // if(max_number > stock_number){
  616. // this.$message.error(scope.row.drug_name + '库存不足')
  617. // }
  618. // }
  619. if(this.$store.getters.xt_user.org_id != 10206) {
  620. if (scope.row.prescribing_number_unit == scope.row.drug.min_unit && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  621. if (scope.row.drug.is_user != 1) {
  622. if (parseInt(scope.row.prescribing_number) > scope.row.drug.sum_count) {
  623. this.$message.error(scope.row.drug_name + '库存不足')
  624. }
  625. }
  626. } else {
  627. if (scope.row.drug.is_user != 1 && this.$store.getters.xt_user.org_id != 10206 && this.$store.getters.xt_user.org_id != 0) {
  628. if ((parseInt(scope.row.prescribing_number) * scope.row.drug.min_number) > scope.row.drug.sum_count) {
  629. this.$message.error(scope.row.drug_name + '库存不足')
  630. }
  631. }
  632. }
  633. }
  634. },
  635. getProjectSingleDose(scope) {
  636. this.prescription.project[scope.$index].total = scope.row.single_dose * (scope.row.execution_frequency ? this.getNum(scope.row.execution_frequency) : 1) * (scope.row.number_days ? scope.row.number_days : 1)
  637. if (this.prescription.project[scope.$index].total == 0) {
  638. this.prescription.project[scope.$index].total = 1
  639. }
  640. },
  641. getProjectDay(scope) {
  642. this.prescription.project[scope.$index].total = scope.row.single_dose * scope.row.number_days
  643. if (this.prescription.project[scope.$index].total == 0) {
  644. this.prescription.project[scope.$index].total = 1
  645. }
  646. },
  647. getNum(execution_frequency) {
  648. let arr = [
  649. { name: '立即执行', count: 1 },
  650. { name: '透析时', count: 1 },
  651. { name: '透析1h一次', count: 1 },
  652. { name: '透析2h一次', count: 1 },
  653. { name: '透析3h一次', count: 1 },
  654. { name: '每日一次', count: 12 },
  655. { name: '每日两次', count: 6 },
  656. { name: '每日三次', count: 4 },
  657. { name: '每晚一次', count: 1 },
  658. { name: '每晚', count: 1 },
  659. { name: '上机前', count: 1 },
  660. { name: '下机前', count: 1 },
  661. { name: '透析后立即', count: 1 },
  662. { name: '持续使用', count: 1 },
  663. { name: '临时开药', count: 1 },
  664. { name: '临睡前', count: 1 },
  665. { name: '隔日一次', count: 1 },
  666. { name: '隔三日一次', count: 1 },
  667. { name: '每二小时一次', count: 12 },
  668. { name: '每四小时一次', count: 6 },
  669. { name: '每六小时一次', count: 4 },
  670. { name: '每八小时一次', count: 3 }
  671. ]
  672. if(this.efs!=null && this.efs.length >0){
  673. for(let i=0;i<this.efs.length;i++){
  674. arr.push(this.efs[i])
  675. }
  676. }
  677. let num = ''
  678. arr.map(item => {
  679. if (item.name == execution_frequency) {
  680. num = item.count
  681. }
  682. })
  683. if (num == '') {
  684. num = 1
  685. }
  686. console.log("numerreerr",num)
  687. return num
  688. },
  689. getAllIndex(val){
  690. console.log("val",val)
  691. console.log("prescription.advices",this.prescription.advices)
  692. var obj = {id:0,day:"",delivery_way:"",execution_frequency:""}
  693. if(this.prescription.advices!=null && this.prescription.advices.length>0){
  694. for(let i=0;i<this.prescription.advices.length;i++){
  695. console.log("this.prescription.advices[i].groupno",this.prescription.advices[i].groupno)
  696. if(parseInt(val.groupno) == parseInt(this.prescription.advices[i].groupno) && parseInt(val.id)!= parseInt(this.prescription.advices[i].id)){
  697. console.log("this.prescription.advices[i]",this.prescription.advices[i])
  698. obj.id = val.id
  699. obj.day = this.prescription.advices[i].day
  700. obj.delivery_way = this.prescription.advices[i].delivery_way
  701. obj.execution_frequency = this.prescription.advices[i].execution_frequency
  702. console.log("-----------------",obj)
  703. }
  704. }
  705. }
  706. console.log("-----------------",obj)
  707. if(this.prescription.advices!=null && this.prescription.advices.length>0){
  708. for(let i=0;i<this.prescription.advices.length;i++){
  709. if(this.prescription.advices[i].id == parseInt(val.id)){
  710. console.log("进啦")
  711. this.prescription.advices[i].delivery_way = obj.delivery_way
  712. this.prescription.advices[i].execution_frequency =obj.execution_frequency
  713. this.prescription.advices[i].day = obj.day
  714. }
  715. }
  716. }
  717. console.log("hahhhahdhha",this.prescription.advices)
  718. },
  719. }, mounted() {
  720. this.getInitData()
  721. },
  722. watch: {
  723. 'prescription.advices': {
  724. handler(newVal, oldVal) {
  725. console.log("检查我我我我",this.prescription.advices)
  726. console.log("检查我我我我",this.prescription.project)
  727. },
  728. deep: true
  729. }
  730. // "prescription.project":{
  731. // handler(newVal,oldVal){
  732. // newVal.map((item,index) => {
  733. // if(item.single_dose != oldVal[index].single_dose || item.number_days != oldVal[index].number_days){
  734. // item.total = item.single_dose * item.number_days
  735. // }
  736. // })
  737. // },
  738. // deep:true
  739. // }
  740. }
  741. }
  742. </script>
  743. <style lang="scss">
  744. .prescriptionTable {
  745. .el-input__inner {
  746. padding: 0 5px;
  747. }
  748. .additionalBox {
  749. margin-top: 20px;
  750. display: flex;
  751. flex-wrap: wrap;
  752. .additionalOne {
  753. margin-right: 20px;
  754. margin-bottom: 10px;
  755. display: flex;
  756. align-items: center;
  757. > span {
  758. white-space: nowrap;
  759. overflow: hidden;
  760. text-overflow: ellipsis;
  761. width: 80px;
  762. display: inline-block;
  763. font-size: 14px;
  764. }
  765. }
  766. .deleteIcon {
  767. color: red;
  768. margin-left: 5px;
  769. }
  770. }
  771. .el-table th .cell, .el-table td .cell {
  772. padding: 0 2px;
  773. white-space: pre-line;
  774. }
  775. .el-icon-delete {
  776. color: red;
  777. }
  778. }
  779. </style>