AddRecord.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div>
  3. <crumbs :title="title" :param="$route.params" linkTo="RecordInput"></crumbs>
  4. <div class="contents">
  5. <div class="content ">
  6. <el-form ref="form" :label-position="labelPosition" label-width="90px" class="add-record-form clearfix" :model="form">
  7. <div class="contentBox clearfix">
  8. <div class="left fl clearfix">
  9. <div class="selectHospital">
  10. <!-- <el-form-item label="医院名称:" prop="">
  11. <span>{{form.hospitalCode}}</span>
  12. </el-form-item> -->
  13. <el-form-item label="病案号:" prop="">
  14. <span>{{form.caseNumber}}</span>
  15. </el-form-item>
  16. <div class="recordInfoBox">
  17. <!-- <p class="title">病例信息:</p> -->
  18. <el-collapse v-model="activeLeftNames" @change="handleChange">
  19. <el-collapse-item v-for="(item, index) in caseInfoList" :title="item.name" :name="item.id" :key="item.id">
  20. <div v-for="it in item.text" class="caseInfo">
  21. {{it}}
  22. </div>
  23. </el-collapse-item>
  24. </el-collapse>
  25. </div>
  26. </div>
  27. <div class="contentBox">
  28. </div>
  29. </div>
  30. <div class="right fr clearfix">
  31. <p class="title">病例标注:</p>
  32. <div class="rightContentBox">
  33. <el-collapse v-model="activeRightNames" @change="handleChange">
  34. <el-collapse-item v-for="(item, index) in caseLIst" :title="item.name" :name="item.id" :key="item.id">
  35. <el-checkbox-group v-model="checkAllMap[item.remark]" >
  36. <el-checkbox v-for=" casesEntry in item.qcCasesEntry" :label="casesEntry.id" :key="casesEntry.id">{{casesEntry.name}}</el-checkbox>
  37. </el-checkbox-group>
  38. </el-collapse-item>
  39. </el-collapse>
  40. </div>
  41. </div>
  42. </div>
  43. <p class="oper">
  44. <el-button style="margin-right: 30px" size="small" type="primary" :disabled="!canSumbit" @click="confirm('form')">确定</el-button>
  45. <el-button size="small" @click="cancel">取消</el-button>
  46. </p>
  47. </el-form>
  48. </div>
  49. </div>
  50. </div>
  51. </template>
  52. <script type="text/javascript">
  53. import api from '@api/records.js';
  54. export default {
  55. name:'AddRecord',
  56. data(){
  57. return{
  58. // data:{},
  59. labelPosition:'left',
  60. caseLIst:[],
  61. caseRemarkList:[],
  62. casesEntryList:[],
  63. textList:[],
  64. casesEntryListSelect:[],
  65. checkList:[],
  66. caseInfoList:[],
  67. checkAllMap:{},
  68. textAllMap:{},
  69. title:'病例录入-标注病例',
  70. form:{
  71. caseNumber:'',
  72. hospitalCode:'',
  73. caseNumberId:'',
  74. hospitalId:''
  75. },
  76. id:null,
  77. modifier:'',
  78. canSumbit: true,
  79. activeLeftNames: ['1'],
  80. activeRightNames: ['1']
  81. }
  82. },
  83. created(){
  84. const userLoginDTO = JSON.parse(localStorage.getItem('userLoginDTO'));
  85. this.modifier = userLoginDTO && userLoginDTO.linkman;
  86. const { isEdit, data } = this.$route.params;
  87. if(isEdit) {
  88. this.title = '病例录入-标注病例';
  89. this.id= data.id
  90. this.form.caseNumber = data.caseNumber
  91. this.form.hospitalCode = data.hospitalName
  92. this.form.hospitalId = data.hospitalId
  93. // this.form.recordInfo = data.text
  94. this.caseInfoList = data.moduleMappingDTOList
  95. const qcInputcasesMapping = data.qcInputcasesMapping
  96. this.getRecordInpModule()
  97. .then(()=>{
  98. // console.log('checkAllMap',this.checkAllMap)
  99. // console.log('this.caseLIst',this.caseLIst)
  100. if(qcInputcasesMapping){
  101. const checkAllMapCopy = JSON.parse(JSON.stringify(this.checkAllMap))
  102. for(let i = 0; i < this.caseLIst.length; i++){
  103. const filterArr = qcInputcasesMapping.filter(item => item.casesId == this.caseLIst[i].id&& item.pass == -1)
  104. let checkArr = []
  105. for(let j = 0; j < filterArr.length; j++){
  106. checkArr.push(filterArr[j].casesEntryId)
  107. }
  108. checkAllMapCopy[this.caseLIst[i].remark] = checkArr
  109. }
  110. this.checkAllMap = checkAllMapCopy
  111. }
  112. })
  113. }else {
  114. this.getRecordInpModule()
  115. }
  116. },
  117. methods:{
  118. handleChange(val) {
  119. // console.log(val);
  120. },
  121. getRecordInpModule(){
  122. return api.getRecordInpModuleByHospital({
  123. hospitalId: this.form.hospitalId
  124. }).then((res)=>{
  125. const result = res.data;
  126. if(result.code==0){
  127. this.caseLIst = result.data
  128. const checkAllMap = {}
  129. const textAllMap = {}
  130. for(let i = 0; i < this.caseLIst.length; i++){
  131. checkAllMap[this.caseLIst[i].remark] = []
  132. textAllMap[this.caseLIst[i].remark] = []
  133. }
  134. this.checkAllMap = checkAllMap
  135. this.textAllMap = textAllMap
  136. }else{
  137. this.$message({
  138. message:result.msg,
  139. type:'warning'
  140. });
  141. }
  142. })
  143. },
  144. cancel(){
  145. this.$router.push({
  146. name: 'RecordInput',
  147. params: Object.assign({}, this.$route.params)
  148. });
  149. },
  150. getArrDifference(arr1, arr2) {
  151. return arr1.concat(arr2).filter(function(v, i, arr) {
  152. return arr.indexOf(v) === arr.lastIndexOf(v);
  153. });
  154. },
  155. getIdList(arr){
  156. let casesEntryIdList = []
  157. for(let i = 0; i < arr.length; i++){
  158. casesEntryIdList.push( arr[i].id)
  159. }
  160. return casesEntryIdList
  161. },
  162. confirm(form){
  163. const {casesId} = this.form
  164. let qcInputMappingSaveVO = []
  165. const caseLIstCopy = JSON.parse(JSON.stringify(this.caseLIst))
  166. for(let i = 0; i < caseLIstCopy.length; i++){
  167. const CheckList = this.checkAllMap[caseLIstCopy[i].remark]
  168. if(caseLIstCopy[i].qcCasesEntry){
  169. for(let j = 0; j < caseLIstCopy[i].qcCasesEntry.length; j++){
  170. let item = {
  171. casesEntryId: caseLIstCopy[i].qcCasesEntry[j].id,
  172. casesId: caseLIstCopy[i].id,
  173. pass: 0
  174. }
  175. if(CheckList.findIndex(item => item == caseLIstCopy[i].qcCasesEntry[j].id) > -1){
  176. item.pass = -1
  177. }
  178. qcInputMappingSaveVO.push(item)
  179. }
  180. }
  181. }
  182. // for(let i = 0; i < noCheckList.length; i++) {
  183. // qcInputMappingSaveVO.push({
  184. // casesEntryId: noCheckList[i],
  185. // casesId: casesId,
  186. // pass: 0
  187. // })
  188. // }
  189. // for(let i = 0; i < checkedcasesEntrys.length; i++) {
  190. // qcInputMappingSaveVO.push({
  191. // casesEntryId: checkedcasesEntrys[i],
  192. // casesId: casesId,
  193. // pass: -1
  194. // })
  195. // }
  196. let param = {
  197. hospitalId: this.form.hospitalId,
  198. caseNumberId: this.id,
  199. caseNumber: this.form.caseNumber,
  200. isTag: true,
  201. qcInputMappingSaveVO,
  202. }
  203. // for(let i = 0; i < this.textList.length; i++){
  204. // param[this.textList[i].remark] = this.textList[i].recordInfo
  205. // }
  206. // if(this.id){
  207. // param = Object.assign(param,{id: this.id})
  208. // }
  209. this.canSumbit = false
  210. api.addRecordInp(param).then((res)=>{
  211. this.canSumbit = true
  212. if(res.data.code==0){
  213. if(this.id){
  214. this.warning('修改成功', 'success')
  215. }else{
  216. this.warning('添加成功', 'success')
  217. }
  218. //返回带搜索条件的首页
  219. this.$router.push({
  220. name: 'RecordInput',
  221. // params: Object.assign({}, this.$route.params)
  222. });
  223. }else{
  224. this.warning(res.data.msg)
  225. }
  226. })
  227. },
  228. warning(msg,type){
  229. this.$message({
  230. showClose: true,
  231. message:msg,
  232. type:type||'warning'
  233. })
  234. },
  235. }
  236. }
  237. </script>
  238. <style lang="less">
  239. @import "../../less/admin.less";
  240. .content{
  241. background: #fff;
  242. padding: 20px 20px 50px;
  243. color: #545455;
  244. min-width: 980px;
  245. position: relative;
  246. .left,.right{
  247. width: 50%;
  248. // height: 450px;
  249. .el-select{
  250. width: 100%;
  251. }
  252. }
  253. // .el-form-item__label{
  254. // font-weight: bold;
  255. // font-size: 16px;
  256. // }
  257. .title{
  258. font-size: 16px;
  259. color: #606266;
  260. line-height: 40px;
  261. margin-bottom: 22px;
  262. font-weight: bold;
  263. }
  264. .caseInfo{
  265. border: 1px solid #eee;
  266. margin: 0 0 10px 0;
  267. white-space: pre-wrap;
  268. }
  269. .checkBox{
  270. margin: 20px 0 0 0;
  271. .el-checkbox{
  272. display: block;
  273. position: relative;
  274. margin: 0 30px 0 0px;
  275. line-height: 30px;
  276. .el-checkbox__input{
  277. position: absolute;
  278. top: 9px;
  279. }
  280. .el-checkbox__label{
  281. padding: 0 0 0 20px;
  282. white-space: normal;
  283. line-height: 30px;
  284. }
  285. }
  286. }
  287. .right{
  288. width: 45%;
  289. margin-left: 5%;
  290. .el-select{
  291. width: 80%;
  292. }
  293. }
  294. .contentBox{
  295. margin: 20px 0 0 0;
  296. }
  297. .casesEntryList{
  298. margin-top: 20px;
  299. padding: 10px 0;
  300. width: 80%;
  301. border: 1px solid #dcdfe6;
  302. height: 410px;
  303. overflow-y: auto;
  304. .el-checkbox{
  305. position: relative;
  306. display: block;
  307. width: calc(100% - 60px);
  308. margin-left: 30px;
  309. line-height: 30px;
  310. .el-checkbox__input{
  311. position: absolute;
  312. top: 9px;
  313. }
  314. .el-checkbox__label{
  315. padding: 0 0 0 20px;
  316. white-space: normal;
  317. line-height: 30px;
  318. }
  319. }
  320. }
  321. .short-inp{
  322. width: 200px;
  323. }
  324. .sub-title{
  325. font-weight: bold;
  326. font-size: 16px;
  327. margin-bottom: 20px;
  328. }
  329. .oper{
  330. margin: 30px 0 0 0;
  331. padding-right: 80px;
  332. text-align: right;
  333. }
  334. .treatments{
  335. .el-input{
  336. width:200px;
  337. display: inline-block;
  338. }
  339. }
  340. .el-checkbox{
  341. margin: 0 30px 0 0;
  342. display: block;
  343. }
  344. .recordInfoBox{
  345. height: 650px;
  346. overflow-y: auto;
  347. }
  348. .rightContentBox{
  349. height: 650px;
  350. overflow-y: auto;
  351. }
  352. }
  353. </style>