questionnaire.html 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>筛选类型</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <meta name="renderer" content="webkit" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <meta name="keywords" content="筛选类型" />
  10. <meta name="description" content="筛选类型" />
  11. <link rel="shortcut icon" href="../../../favicon.ico" />
  12. <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css" />
  13. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  14. <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
  15. <link href="../../../plugins/toastr/toastr.min.css" rel="stylesheet" />
  16. <link rel="stylesheet" href="../css/questionnaire.css" />
  17. <link rel="stylesheet" type="text/css" href="../../../css/element-ui.css" />
  18. <!-- <link rel="stylesheet" type="text/css" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" /> -->
  19. </head>
  20. <body>
  21. <div class="ui-grid" id="app" style="align-items: flex-start" v-cloak>
  22. <div class="flex-box-item ptb20">
  23. <!--<div class="prompt-text">请认真填写本页面,方便医生进行综合评估【厦门i健康】</div>-->
  24. <div class="single-choice-question">
  25. <div class="question-title">问卷题目</div>
  26. <div class="question-content">
  27. <ul class="question-list">
  28. <li v-for="(qst,key,index) in questions">
  29. <p class="question-name" v-text="key+'、'+qst.question.title"></p>
  30. <div class="daan-list" v-if="qst.question.questionType!=2">
  31. <lable class="label-block" v-for="opt in qst.option" @click="selectItem(qst.question,opt,index)">
  32. <span class="pull-right" v-text="(opt.score || 0)+'分'" v-if="qst.isThird!=3"></span>
  33. <template v-if="qst.isThird==3&&qst.question.thirdKey=='sex'">
  34. <input
  35. :type="qst.questionType==1?'checkbox':'radio'"
  36. :checked="opt.thirdValue == sex"
  37. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  38. value="1" />
  39. <i></i>
  40. <span v-text="opt.content"></span>
  41. </template>
  42. <template v-if="qst.isThird==3&&qst.question.thirdKey=='acs'">
  43. <input
  44. :type="qst.questionType==1?'checkbox':'radio'"
  45. :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS1)"
  46. id="myInput1"
  47. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  48. value="1" />
  49. <i></i>
  50. <span v-text="opt.content"></span>
  51. </template>
  52. <template v-if="qst.isThird==3&&qst.question.thirdKey=='myocardialInfarct'">
  53. <input
  54. :type="qst.questionType==1?'checkbox':'radio'"
  55. :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS2)"
  56. id="myInput2"
  57. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  58. value="1" />
  59. <i></i>
  60. <span v-text="opt.content"></span>
  61. </template>
  62. <template v-if="qst.isThird==3&&qst.question.thirdKey=='ischemicStroke'">
  63. <input
  64. :type="qst.questionType==1?'checkbox':'radio'"
  65. :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS3)"
  66. id="myInput3"
  67. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  68. value="1" />
  69. <i></i>
  70. <span v-text="opt.content"></span>
  71. </template>
  72. <template v-if="qst.isThird==3&&qst.question.thirdKey=='seriousMedicalHistory'">
  73. <input
  74. :type="qst.questionType==1?'checkbox':'radio'"
  75. :checked="opt.thirdValue == (ascvdShow?ascvdShow:ascvdS4)"
  76. id="myInput4"
  77. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  78. value="1" />
  79. <i></i>
  80. <span v-text="opt.content"></span>
  81. </template>
  82. <template
  83. v-if="qst.question.thirdKey!='sex'&&qst.question.thirdKey!='acs'&&qst.question.thirdKey!='myocardialInfarct'&&qst.question.thirdKey!='ischemicStroke'&&qst.question.thirdKey!='seriousMedicalHistory'">
  84. <input
  85. :type="qst.questionType==1||qst.question.questionType?'checkbox':'radio'"
  86. v-if="qst.question.thirdKey!='sex'"
  87. :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')"
  88. value="1" />
  89. <i></i>
  90. <span v-text="opt.content"></span>
  91. </template>
  92. </lable>
  93. </div>
  94. <div v-else>
  95. <template
  96. v-if="(qst.isThird=='3' && qst.question.thirdKey == 'assessTime')||(qst.question.thirdKey == 'createDate'&&screeningTitle=='大肠癌筛查问卷(OB筛查)')||(qst.question.thirdKey == 'createDate'&&screeningTitle=='脑卒中风险评估(冠心病、脑卒中、肾病)')">
  97. <div style="padding-left: 20px">
  98. <el-date-picker
  99. v-model="qst.question.content"
  100. type="datetime"
  101. format="yyyy-MM-dd HH:mm"
  102. value-format="yyyy-MM-dd HH:mm"
  103. placeholder="选择日期时间"
  104. @change="changeContent(qst.question,qst.question.content)"></el-date-picker>
  105. </div>
  106. </template>
  107. <template v-else>
  108. <div
  109. class="daan-list"
  110. v-if="qst.isThird==3 && (qst.question.thirdKey == 'assessDoctor' || qst.question.thirdKey == 'assessOrgId'||(!shaowas&&qst.question.thirdKey == 'bmi'))">
  111. <textarea class="wenjuan-textarea" disabled rows="2" v-model="qst.question.content"></textarea>
  112. </div>
  113. <div class="daan-list" v-else-if="qst.question.thirdKey != 'bmi'">
  114. <textarea class="wenjuan-textarea" @keyup="changeContent(qst.question,qst.question.content,1)" rows="2" v-model="qst.question.content"></textarea>
  115. </div>
  116. <div class="daan-list" v-if="(shaowas&&qst.question.thirdKey == 'bmi')">
  117. <textarea class="wenjuan-textarea" disabled rows="2" v-model="shaowas"></textarea>
  118. </div>
  119. </template>
  120. </div>
  121. </li>
  122. </ul>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="w-250">
  127. <div class="base-info">
  128. <p class="f-16 mb0">基本信息</p>
  129. <div :class="`flex-box ${noswitch?'':'right-triangle'}`">
  130. <span class="w-70">类型</span>
  131. <a class="flex-box-item" :alt="screeningTitle" v-text="screeningTitle" @click="goBack">--</a>
  132. </div>
  133. <div :class="`flex-box ${noswitch?'':'right-triangle'}`">
  134. <span class="w-70">对象</span>
  135. <a class="flex-box-item" :alt="screeningResidentsName" v-text="screeningResidentsName" @click="goBack(1)">--</a>
  136. </div>
  137. <div class="flex-box">
  138. <span class="w-70">筛查人员</span>
  139. <div class="flex-box-item c-999" v-text="doctorInfo.name"></div>
  140. </div>
  141. <div class="flex-box" style="align-items: flex-start">
  142. <span class="w-70">体征记录</span>
  143. <div class="flex-box-item" v-if="tizhongRecord.value1 || tizhongRecord.value2">
  144. <p v-if="tizhongRecord.value1">
  145. 体重
  146. <input type="number" step="0.1" readonly="readonly" :value="tizhongRecord.value1" />
  147. kg
  148. </p>
  149. <p class="mb0" v-if="tizhongRecord.value2">
  150. 身高
  151. <input type="number" step="0.1" readonly="readonly" :value="tizhongRecord.value2" />
  152. cm
  153. </p>
  154. </div>
  155. <div class="flex-box-item" v-else>暂无体征</div>
  156. </div>
  157. </div>
  158. <div class="completion-of-progress">
  159. <p class="f16 mb0">完成情况</p>
  160. <div class="canvas-box">
  161. <canvas-progress :progress="progress" ref="progress"></canvas-progress>
  162. <p class="progress-number">
  163. <span>已完成</span>
  164. </p>
  165. </div>
  166. </div>
  167. <div class="btn-group-bottom">
  168. <button class="btn submit-btn" @click="save">提交</button>
  169. <button class="btn btn-exit" @click="signOut">退出</button>
  170. </div>
  171. </div>
  172. </div>
  173. <script type="text/javascript" src="../../../plugins/echarts/3.8.5/echarts.min.js"></script>
  174. <script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
  175. <script src="../../../js/jquery-2.2.4.js" type="text/javascript" charset="utf-8"></script>
  176. <script src="../../../component/common/event-bus.js"></script>
  177. <script src="../../../js/element-ui.js" type="text/javascript" charset="utf-8"></script>
  178. <!-- <script src="https://unpkg.com/element-ui/lib/index.js" type="text/javascript" charset="utf-8"></script> -->
  179. <script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
  180. <script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
  181. <script src="../../../plugins/toastr/toastr.min.js"></script>
  182. <script type="text/javascript" src="../../../plugins/layer/layer.min.js"></script>
  183. <script src="../../../js/util.js" type="text/javascript" charset="utf-8"></script>
  184. <script src="../../../api/http-request.js" type="text/javascript" charset="utf-8"></script>
  185. <script type="text/javascript" src="../../../api/jbsc-api.js"></script>
  186. <script type="text/javascript" src="../component/canvas-progress.js"></script>
  187. <script type="text/javascript">
  188. var httpData = GetRequest()
  189. var docInfo = JSON.parse(window.localStorage.getItem('docInfo'))
  190. var question = new Vue({
  191. el: '#app',
  192. data: {
  193. //数据结果
  194. progress: 0,
  195. selectArr: [],
  196. screeningTitle: decodeURI(httpData['fliter_title']),
  197. screeningType: httpData['fliter_code'],
  198. screeningResidents: httpData['resident_code'],
  199. screeningResidentsName: decodeURI(httpData['resident_name']),
  200. sex: decodeURI(httpData['sex']),
  201. age: decodeURI(httpData['age']),
  202. doctorInfo: { code: docInfo.code },
  203. surveyStatus: httpData['surveyStatus'] || '',
  204. questions: [],
  205. tizhongRecord: {},
  206. labelType: 5, //问卷筛查labelType=5
  207. isAgain: httpData['isAgain'] || 0,
  208. ascvdShow: '',
  209. ascvdS1: '',
  210. ascvdS2: '',
  211. ascvdS3: '',
  212. ascvdS4: '',
  213. shaowas: '',
  214. noswitch: httpData['noswitch']
  215. },
  216. mounted: function () {
  217. console.log('screeningTitle', this.screeningTitle)
  218. if (this.screeningType != '6bcd306aaafb4e4381071346d86fadbb1') {
  219. this.getHealth()
  220. }
  221. this.getQuestion()
  222. this.getDoctorInfo()
  223. },
  224. methods: {
  225. getInitData() {
  226. var vm = this
  227. console.log('sssssssssssxxxxxxxxx', vm.questions)
  228. httpRequest.get('doctor/screen/physicalList', { data: { patient: vm.screeningResidents } }).then(function (res) {
  229. var data = res.data
  230. if (res.status == 200 && data) {
  231. for (var i in vm.questions) {
  232. if (vm.questions[i].question.thirdKey == 'height' && data.height) {
  233. vm.questions[i].question.content = data.height + ''
  234. }
  235. if (vm.questions[i].question.thirdKey == 'weight' && data.weight) {
  236. vm.questions[i].question.content = data.weight + ''
  237. }
  238. if (vm.questions[i].question.thirdKey == 'bmi' && data.BodyMassIndex) {
  239. vm.questions[i].question.content = data.BodyMassIndex + ''
  240. }
  241. if (vm.questions[i].question.thirdKey == 'systolicPressure' && data.systolicPressure) {
  242. vm.questions[i].question.content = data.systolicPressure + ''
  243. }
  244. if (vm.questions[i].question.thirdKey == 'diastolicPressure' && data.diastolicPressure) {
  245. vm.questions[i].question.content = data.diastolicPressure + ''
  246. }
  247. if (vm.questions[i].question.thirdKey == 'totalCholesterol' && data.totalCholesterol) {
  248. vm.questions[i].question.content = data.totalCholesterol + ''
  249. }
  250. if (vm.questions[i].question.thirdKey == 'hdlc' && data.HDL) {
  251. vm.questions[i].question.content = data.HDL + ''
  252. }
  253. if (vm.questions[i].question.thirdKey == 'ldlc' && data.LDL) {
  254. vm.questions[i].question.content = data.LDL + ''
  255. }
  256. if (vm.questions[i].question.thirdKey == 'ckd34' && data.height) {
  257. vm.questions[i].question.content = data.height + ''
  258. }
  259. if (vm.questions[i].question.title == '既往有心肌梗死病史' && data.AMI) {
  260. var index = data.AMI == 1 ? 0 : data.AMI == 2 ? 1 : ''
  261. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  262. }
  263. if (vm.questions[i].question.title == '缺血性脑卒中病史' && data.CerebralIschemicStroke) {
  264. var index = data.CerebralIschemicStroke == 1 ? 0 : data.CerebralIschemicStroke == 2 ? 1 : ''
  265. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  266. }
  267. if (vm.questions[i].question.title == '高血压' && data.hypertension) {
  268. var index = data.hypertension == 1 ? 0 : data.hypertension == 2 ? 1 : ''
  269. vm.selectItem(vm.questions[i].question, vm.questions[i].option[index])
  270. }
  271. if (vm.questions[i].question.title == '糖尿病' && data.Diabetes) {
  272. var index = data.Diabetes == 1 ? 0 : data.Diabetes == 2 ? 1 : ''
  273. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  274. }
  275. if (vm.questions[i].question.title == '吸烟' && data.smoke) {
  276. var index = data.smoke == 1 ? 0 : data.smoke == 2 ? 1 : ''
  277. vm.selectItem(vm.questions[i].question, vm.questions[i].option[Number(index)])
  278. }
  279. }
  280. }
  281. httpRequest.get('doctor/screen/checkUpList', { data: { patient: vm.screeningResidents } }).then(function (res) {
  282. console.log(res)
  283. var obj = res.data
  284. if (res.status == 200 && obj) {
  285. for (var i in vm.questions) {
  286. if (vm.questions[i].question.thirdKey == 'hdlc' && !vm.questions[i].question.content) {
  287. vm.questions[i].question.content = obj.hdlc
  288. }
  289. if (vm.questions[i].question.thirdKey == 'ldlc' && !vm.questions[i].question.content) {
  290. vm.questions[i].question.content = obj.ldlc
  291. }
  292. if (vm.questions[i].question.thirdKey == 'totalCholesterol' && !vm.questions[i].question.content) {
  293. vm.questions[i].question.content = obj.totalCholesterol
  294. console.log('ssssssssssyyyyyyyyyyyyy', obj.totalCholesterol)
  295. }
  296. if (vm.questions[i].question.thirdKey == 'diastolicPressure' && !vm.questions[i].question.content) {
  297. vm.questions[i].question.content = obj.diastolicPressure
  298. }
  299. if (vm.questions[i].question.thirdKey == 'systolicPressure' && !vm.questions[i].question.content) {
  300. vm.questions[i].question.content = obj.systolicPressure
  301. }
  302. }
  303. }
  304. // var data = res.data
  305. // if (!vm.form.totalCholesterol) {
  306. // vm.form.totalCholesterol = data.totalCholesterol
  307. // }
  308. // if (!vm.form.hdlc) {
  309. // vm.form.hdlc = data.hdlc
  310. // }
  311. // if (!vm.form.ldlc) {
  312. // vm.form.ldlc = data.ldlc
  313. // }
  314. // if (!vm.form.systolicPressure) {
  315. // vm.form.systolicPressure = data.systolicPressure
  316. // }
  317. // if (!vm.diastolicPressure) {
  318. // vm.form.diastolicPressure = data.diastolicPressure
  319. // }
  320. })
  321. })
  322. },
  323. getDoctorInfo: function () {
  324. var vm = this
  325. var data = {
  326. code: vm.doctorInfo.code
  327. }
  328. jbscAPI.doctorBaseinfo(data).then(function (res) {
  329. if (res.status == 200) {
  330. vm.doctorInfo = res.data
  331. } else {
  332. top.layer.msg(res.msg, { icon: 5 })
  333. }
  334. })
  335. },
  336. //计算选中个数,组装成后台接收格式
  337. selectItem: function (qst, select, num) {
  338. console.log('ssssssssssss99999999999999999999', qst, select)
  339. var vm = this
  340. var isFlag = 1
  341. if (qst.title == '抗栓药物其他名称' && vm.screeningTitle == '大肠癌筛查问卷(OB筛查)') {
  342. vm.selectArr.forEach(function (item, index) {
  343. if (item.thirdKey == 'ksDrugName1') {
  344. item.options.forEach(function (v, i) {
  345. if (v.comment == '其他') {
  346. isFlag = 0
  347. return false
  348. }
  349. })
  350. }
  351. })
  352. // 如果没有勾选“其他”选项,提示并返回
  353. if (isFlag) {
  354. qst.content = '' // 清空当前输入的内容
  355. this.$message.error('请先勾选抗栓药物名称的其他选项')
  356. return false
  357. }
  358. }
  359. if (vm.ascvdShow) {
  360. if (select.thirdKey == 'acs' || select.thirdKey == 'myocardialInfarct' || select.thirdKey == 'ischemicStroke' || select.thirdKey == 'seriousMedicalHistory') {
  361. return false
  362. }
  363. }
  364. var data = {
  365. qstCode: qst.code,
  366. type: qst.questionType,
  367. content: qst.content,
  368. thirdKey: qst.thirdKey
  369. }
  370. var options = []
  371. var ls = []
  372. var lsTo = []
  373. if (select) {
  374. if (qst.questionType == '1') {
  375. // 处理多选题
  376. if (!qst.selectedOptions) {
  377. qst.selectedOptions = []
  378. }
  379. var optionIndex = qst.selectedOptions.findIndex(item => item.optionCode == select.code)
  380. if (optionIndex > -1) {
  381. // 如果已经选中,则取消选择
  382. qst.selectedOptions.splice(optionIndex, 1)
  383. } else {
  384. // 如果未选中,则添加选项
  385. qst.selectedOptions.push({
  386. optionCode: select.code,
  387. comment: select.content,
  388. score: select.score,
  389. thirdKey: select.thirdKey,
  390. thirdValue: select.thirdValue
  391. })
  392. }
  393. options = qst.selectedOptions // 将选中的所有选项赋值给options
  394. } else {
  395. options = [
  396. {
  397. optionCode: select.code,
  398. comment: select.content,
  399. score: select.score,
  400. thirdKey: select.thirdKey,
  401. thirdValue: select.thirdValue
  402. }
  403. ]
  404. }
  405. if (select.thirdKey == 'ascvd' && select.thirdValue == 0) {
  406. this.ascvdShow = '0'
  407. vm.spliceFunction()
  408. for (var i in this.questions) {
  409. if (
  410. this.questions[i].question.thirdKey == 'acs' ||
  411. this.questions[i].question.thirdKey == 'myocardialInfarct' ||
  412. this.questions[i].question.thirdKey == 'ischemicStroke' ||
  413. this.questions[i].question.thirdKey == 'seriousMedicalHistory'
  414. ) {
  415. var s = this.questions[i].option[1]
  416. var v = this.questions[i].question
  417. ls.push({
  418. qstCode: v.code,
  419. type: v.questionType,
  420. thirdKey: v.thirdKey,
  421. options: [
  422. {
  423. optionCode: s.code,
  424. comment: s.content,
  425. score: s.score,
  426. thirdKey: s.thirdKey,
  427. thirdValue: s.thirdValue
  428. }
  429. ]
  430. })
  431. }
  432. }
  433. document.getElementById('myInput1').disabled = true
  434. document.getElementById('myInput2').disabled = true
  435. document.getElementById('myInput3').disabled = true
  436. document.getElementById('myInput4').disabled = true
  437. } else if (select.thirdKey == 'ascvd' && select.thirdValue == 1) {
  438. this.ascvdShow = ''
  439. this.ascvdS1 = ''
  440. this.ascvdS2 = ''
  441. this.ascvdS3 = ''
  442. this.ascvdS4 = ''
  443. document.getElementById('myInput1').disabled = false
  444. document.getElementById('myInput2').disabled = false
  445. document.getElementById('myInput3').disabled = false
  446. document.getElementById('myInput4').disabled = false
  447. ls = []
  448. vm.spliceFunction()
  449. }
  450. if (select.thirdKey == 'acs') {
  451. vm.ascvdS1 = select.thirdValue
  452. }
  453. if (select.thirdKey == 'myocardialInfarct') {
  454. vm.ascvdS2 = select.thirdValue
  455. }
  456. if (select.thirdKey == 'ischemicStroke') {
  457. vm.ascvdS3 = select.thirdValue
  458. }
  459. if (select.thirdKey == 'seriousMedicalHistory') {
  460. vm.ascvdS4 = select.thirdValue
  461. }
  462. }
  463. if ((num && qst.thirdKey == 'weight') || qst.thirdKey == 'height') {
  464. var weight = ''
  465. var height = ''
  466. for (var i in vm.questions) {
  467. if (vm.questions[i].question.thirdKey == 'weight') {
  468. weight = vm.questions[i].question.content
  469. }
  470. if (vm.questions[i].question.thirdKey == 'height') {
  471. height = vm.questions[i].question.content
  472. }
  473. }
  474. var w = qst.thirdKey == 'weight' ? qst.content : weight
  475. var h = qst.thirdKey == 'height' ? qst.content : height / 100
  476. var s = (w / (h * h)).toFixed(2)
  477. vm.selectArr.forEach(function (v, i) {
  478. if (v.thirdKey == 'bmi') {
  479. vm.selectArr.splice(i, 1)
  480. }
  481. })
  482. for (var i in vm.questions) {
  483. if (vm.questions[i].question.thirdKey == 'bmi') {
  484. lsTo.push({
  485. qstCode: vm.questions[i].question.code,
  486. type: vm.questions[i].question.questionType,
  487. content: s,
  488. thirdKey: vm.questions[i].question.thirdKey,
  489. options: []
  490. })
  491. vm.shaowas = s
  492. // if(w && h) {
  493. // vm.shaowas = s
  494. // }
  495. // console.log(vm.questions[i].question.content,"0809")
  496. // vm.questions[i].question.content = ''
  497. // console.log(vm.questions[i].question.content,"00000---")
  498. }
  499. }
  500. }
  501. data.options = options
  502. console.log('111111111111xsssssssss')
  503. var oldLen = this.selectArr.length
  504. this.selectArr =
  505. _.filter(this.selectArr, function (o) {
  506. return o.qstCode != data.qstCode
  507. }) || []
  508. this.selectArr = this.selectArr.concat(lsTo)
  509. this.selectArr = this.selectArr.concat(ls)
  510. this.selectArr.push(data)
  511. console.log(this.selectArr, 'this.selectArr')
  512. var len = this.selectArr.length
  513. // var questions=Object.values(this.questions)
  514. var questions = _.toArray(this.questions)
  515. var allLen = questions.length
  516. var progress = len === allLen ? 100 : (len / allLen) * 100
  517. if (select && select.thirdKey == 'ascvd') {
  518. this.$refs.progress.dataFunction(progress)
  519. } else {
  520. this.progress = progress
  521. }
  522. },
  523. spliceFunction: function () {
  524. var vm = this
  525. vm.selectArr.forEach(function (v, i) {
  526. if (v.thirdKey == 'acs') {
  527. vm.selectArr.splice(i, 1)
  528. }
  529. })
  530. vm.selectArr.forEach(function (v, i) {
  531. if (v.thirdKey == 'myocardialInfarct') {
  532. vm.selectArr.splice(i, 1)
  533. }
  534. })
  535. vm.selectArr.forEach(function (v, i) {
  536. if (v.thirdKey == 'ischemicStroke') {
  537. vm.selectArr.splice(i, 1)
  538. }
  539. })
  540. vm.selectArr.forEach(function (v, i) {
  541. if (v.thirdKey == 'seriousMedicalHistory') {
  542. vm.selectArr.splice(i, 1)
  543. }
  544. })
  545. },
  546. signOut: function () {
  547. var index = top.layer.getFrameIndex(window.name) //先得到当前iframe层的索引
  548. var current = top.layer.confirm(
  549. '问卷还未提交,确定要关闭?',
  550. {
  551. btn: ['关闭', '取消'] //按钮
  552. },
  553. function () {
  554. top.layer.closeAll() //再执行关闭
  555. },
  556. function () {
  557. top.layer.close(current) //再执行关闭
  558. }
  559. )
  560. },
  561. changeContent: function (qst, content, num) {
  562. if (!content) return
  563. this.selectItem(qst, '', num)
  564. },
  565. getQuestion: function () {
  566. var vm = this
  567. var data = {
  568. surveyTemplateCode: vm.screeningType
  569. }
  570. jbscAPI.getAllQuestions(data).then(function (res) {
  571. if (res.status == 200) {
  572. // console.log(res.data,"res.data")
  573. for (var i in res.data) {
  574. if (res.data[i].isThird == 3) {
  575. if (res.data[i].question.questionType == '1') {
  576. res.data[i].question.selectedOptions = [] // 初始化多选项的数组
  577. }
  578. if (res.data[i].question.thirdKey == 'assessTime') {
  579. res.data[i].question.content = new Date()
  580. }
  581. if (res.data[i].option.length != 0) {
  582. res.data[i].question.thirdKey = res.data[i].option[0].thirdKey
  583. }
  584. if (res.data[i].question.thirdKey == 'assessDoctor') {
  585. res.data[i].question.content = docInfo.name
  586. }
  587. if (res.data[i].question.thirdKey == 'assessOrgId') {
  588. res.data[i].question.content = docInfo.hospitalName
  589. }
  590. if (res.data[i].question.thirdKey == 'name') {
  591. res.data[i].question.content = vm.screeningResidentsName
  592. }
  593. if (res.data[i].question.thirdKey == 'sex') {
  594. res.data[i].question.content = vm.sex
  595. }
  596. if (res.data[i].question.thirdKey == 'age') {
  597. res.data[i].question.content = vm.age
  598. }
  599. }
  600. if (res.data[i].question.thirdKey == 'belongCommunity') {
  601. res.data[i].question.content = docInfo.hospitalName
  602. }
  603. if (res.data[i].question.thirdKey == 'doctorName') {
  604. res.data[i].question.content = docInfo.name
  605. }
  606. if (res.data[i].question.thirdKey == 'doctorPhoneNo') {
  607. res.data[i].question.content = docInfo.mobile
  608. }
  609. if (res.data[i].question.thirdKey == 'userName') {
  610. res.data[i].question.content = decodeURI(httpData.resident_name)
  611. }
  612. if (res.data[i].question.thirdKey == 'idNo') {
  613. res.data[i].question.content = httpData.idcard
  614. }
  615. if (res.data[i].question.thirdKey == 'phoneNo') {
  616. res.data[i].question.content = httpData.mobile
  617. }
  618. if (res.data[i].question.thirdKey == 'assessDoctor') {
  619. res.data[i].question.content = docInfo.name
  620. }
  621. if (res.data[i].question.thirdKey == 'assessOrgId') {
  622. res.data[i].question.content = docInfo.hospitalName
  623. }
  624. if (res.data[i].question.thirdKey == 'age') {
  625. res.data[i].question.content = httpData.age
  626. }
  627. if (res.data[i].question.title == '性别') {
  628. var index = vm.sex == 1 ? '0' : '1'
  629. console.log('==================aaaaaaaaaa', res.data[i].question, res.data[i].option[index])
  630. vm.selectItem(res.data[i].question, res.data[i].option[index])
  631. }
  632. if (res.data[i].question.thirdKey == 'createDate') {
  633. res.data[i].question.content = new Date().format('yyyy-MM-dd hh:mm:ss')
  634. }
  635. if (res.data[i].question.thirdKey == 'assessTime') {
  636. res.data[i].question.content = new Date().format('yyyy-MM-dd hh:mm:ss')
  637. }
  638. if (res.data[i].question.thirdKey == 'sex' && (vm.screeningTitle == '大肠癌筛查问卷(OB筛查)' || vm.screeningTitle == '脑卒中风险评估(冠心病、脑卒中、肾病)')) {
  639. var index = vm.sex == 1 ? '0' : '1'
  640. vm.selectItem(res.data[i].question, res.data[i].option[index])
  641. }
  642. }
  643. console.log(res.data, 'ssssssssslllllllllll')
  644. vm.questions = res.data
  645. for (var i in res.data) {
  646. if (res.data[i].isThird == 3) {
  647. if (res.data[i].question.thirdKey == 'assessTime') {
  648. vm.changeContent(res.data[i].question, new Date().format('yyyy-MM-dd HH:mm'))
  649. }
  650. if (res.data[i].question.thirdKey == 'assessDoctor') {
  651. vm.changeContent(res.data[i].question, docInfo.name)
  652. }
  653. if (res.data[i].question.thirdKey == 'assessOrgId') {
  654. vm.changeContent(res.data[i].question, docInfo.hospitalName)
  655. }
  656. if (res.data[i].question.thirdKey == 'name') {
  657. vm.changeContent(res.data[i].question, vm.screeningResidentsName)
  658. }
  659. if (res.data[i].question.thirdKey == 'age') {
  660. vm.changeContent(res.data[i].question, vm.age)
  661. }
  662. if (res.data[i].question.thirdKey == 'sex') {
  663. var index = vm.sex == 1 ? '0' : '1'
  664. console.log('------111111000000000', res.data[i].question, res.data[i].option[index])
  665. vm.selectItem(res.data[i].question, res.data[i].option[index])
  666. }
  667. }
  668. }
  669. if (vm.screeningType == '6bcd306aaafb4e4381071346d86fadbb1') {
  670. vm.getInitData()
  671. }
  672. }
  673. })
  674. },
  675. getHealth: function () {
  676. var vm = this
  677. jbscAPI
  678. .listMedical({
  679. patient: vm.screeningResidents,
  680. pageIndex: 1,
  681. pageSize: 1
  682. })
  683. .then(function (v) {
  684. if (v.status == 200) {
  685. if (v.list[0]) {
  686. jbscAPI
  687. .findMedicalDetail({
  688. medicalNo: v.list[0].medicalNo
  689. })
  690. .then(function (res) {
  691. if (res.status == 200) {
  692. var data = res.medical_detail
  693. for (var i in vm.questions) {
  694. if (vm.questions[i].question.thirdKey == 'height') {
  695. vm.questions[i].question.content = data.height
  696. vm.changeContent(vm.questions[i].question, data.height)
  697. }
  698. if (vm.questions[i].question.thirdKey == 'weight') {
  699. vm.questions[i].question.content = data.weight
  700. vm.changeContent(vm.questions[i].question, data.weight)
  701. }
  702. if (vm.questions[i].question.thirdKey == 'bmi') {
  703. if (data.height && data.weight) {
  704. var w = data.weight
  705. var h = data.height / 100
  706. var s = (w / (h * h)).toFixed(2)
  707. vm.questions[i].question.content = s
  708. vm.shaowas = s
  709. vm.changeContent(vm.questions[i].question, s)
  710. }
  711. }
  712. if (vm.questions[i].question.thirdKey == 'systolicPressure') {
  713. vm.questions[i].question.content = data.bloodPressureRigthU
  714. vm.changeContent(vm.questions[i].question, data.bloodPressureRigthU)
  715. }
  716. if (vm.questions[i].question.thirdKey == 'diastolicPressure') {
  717. vm.questions[i].question.content = data.bloodPressureRigthD
  718. vm.changeContent(vm.questions[i].question, data.bloodPressureRigthD)
  719. }
  720. if (vm.questions[i].question.thirdKey == 'bpU') {
  721. vm.questions[i].question.content = data.bloodPressureLeftU || data.bloodPressureRigthU
  722. vm.changeContent(vm.questions[i].question, data.bloodPressureLeftU || data.bloodPressureRigthU)
  723. }
  724. if (vm.questions[i].question.thirdKey == 'bpD') {
  725. vm.questions[i].question.content = data.bloodPressureLeftD || data.bloodPressureRigthD
  726. vm.changeContent(vm.questions[i].question, data.bloodPressureLeftD || data.bloodPressureRigthD)
  727. }
  728. if (vm.questions[i].question.thirdKey == 'glycolatedHemoglobin') {
  729. vm.questions[i].question.content = data.glycolatedHemoglobin
  730. vm.changeContent(vm.questions[i].question, data.glycolatedHemoglobin)
  731. }
  732. if (vm.questions[i].question.thirdKey == 'fbg') {
  733. vm.questions[i].question.content = data.fastingPlasmaGlucoseL
  734. vm.changeContent(vm.questions[i].question, data.fastingPlasmaGlucoseL)
  735. }
  736. if (vm.questions[i].question.thirdKey == 'bloodPotassium') {
  737. vm.questions[i].question.content = data.renalFunctionBloodPotassium
  738. vm.changeContent(vm.questions[i].question, data.renalFunctionBloodPotassium)
  739. }
  740. if (vm.questions[i].question.thirdKey == 'renalFunctionCreatinine') {
  741. vm.questions[i].question.content = data.renalFunctionCreatinine
  742. vm.changeContent(vm.questions[i].question, data.renalFunctionCreatinine)
  743. }
  744. }
  745. }
  746. })
  747. } else {
  748. var data = {
  749. patient: vm.screeningResidents
  750. }
  751. jbscAPI.getHealth(data).then(function (res) {
  752. if (res.status == 200) {
  753. vm.tizhongRecord =
  754. _.find(res.data, function (o) {
  755. return o.type == '3'
  756. }) || {}
  757. for (var i in vm.questions) {
  758. if (vm.questions[i].question.thirdKey == 'height') {
  759. vm.questions[i].question.content = vm.tizhongRecord.value2
  760. vm.changeContent(vm.questions[i].question, vm.tizhongRecord.value2)
  761. }
  762. if (vm.questions[i].question.thirdKey == 'weight') {
  763. vm.questions[i].question.content = vm.tizhongRecord.value1
  764. vm.changeContent(vm.questions[i].question, vm.tizhongRecord.value1)
  765. }
  766. if (vm.questions[i].question.thirdKey == 'systolicPressure') {
  767. vm.questions[i].question.content = res.data.xy.value1
  768. vm.changeContent(vm.questions[i].question, res.data.xy.value1)
  769. }
  770. if (vm.questions[i].question.thirdKey == 'diastolicPressure') {
  771. vm.questions[i].question.content = res.data.xy.value2
  772. vm.changeContent(vm.questions[i].question, res.data.xy.value2)
  773. }
  774. if (vm.questions[i].question.thirdKey == 'bmi') {
  775. if (vm.tizhongRecord.value2 && vm.tizhongRecord.value1) {
  776. var w = vm.tizhongRecord.value1
  777. var h = vm.tizhongRecord.value2 / 100
  778. var s = (w / (h * h)).toFixed(2)
  779. vm.questions[i].question.content = s
  780. vm.shaowas = s
  781. vm.changeContent(vm.questions[i].question, s)
  782. }
  783. }
  784. }
  785. } else {
  786. top.layer.msg(res.msg, { icon: 5 })
  787. }
  788. })
  789. }
  790. }
  791. })
  792. },
  793. save: function () {
  794. console.log('2222221sssssssssssssssss', this.selectArr)
  795. var vm = this
  796. if (vm.progress != 100) {
  797. top.layer.msg('问卷还未全部填写', { icon: 5 })
  798. return
  799. }
  800. var loadding = top.layer.load(0, { shade: false }) //0代表加载的风格,支持0-2
  801. vm.selectArr.forEach(function (v) {
  802. if (v.thirdKey == 'assessTime') {
  803. v.content = new Date(v.content).format('yyyy-MM-dd HH:mm')
  804. }
  805. })
  806. var data = {
  807. patientCode: vm.screeningResidents,
  808. labelType: vm.labelType,
  809. isAgain: vm.isAgain,
  810. source: 1,
  811. surveyStatus: vm.surveyStatus,
  812. jsonData: JSON.stringify({
  813. surveyCode: vm.screeningType,
  814. questions: vm.selectArr
  815. })
  816. }
  817. jbscAPI.saveAnswer(data).then(function (res) {
  818. top.layer.close(loadding)
  819. if (res.status == 200) {
  820. if (vm.questions[1].isThird == 3) {
  821. top.layer.open({
  822. type: 2,
  823. // offset: ['100px'], //右下角弹出
  824. area: ['568px', '100%'],
  825. shade: 0.5,
  826. title: '查看筛选结果',
  827. fixed: true, //不固定
  828. maxmin: true,
  829. closeBtn: 1,
  830. shift: 5,
  831. shadeClose: false, //点击遮罩关闭层
  832. content: '../../jbsc/html/view_screening_results.html?resultCode=' + res.data,
  833. end: function () {
  834. var index = top.layer.getFrameIndex(window.name) //先得到当前iframe层的索引
  835. parent.eventBuss.$emit('guan_results', index)
  836. }
  837. })
  838. } else {
  839. top.layer.open({
  840. type: 2,
  841. area: ['820px', '648px'],
  842. shade: 0.5,
  843. title: '筛选统计',
  844. fixed: true, //不固定
  845. maxmin: true,
  846. closeBtn: 1,
  847. shift: 5,
  848. shadeClose: false, //点击遮罩关闭层
  849. content: '../../jbsc/html/filter_result.html?code=' + res.data + '&filter_type=' + vm.screeningType
  850. })
  851. }
  852. } else {
  853. top.layer.msg(res.msg, { icon: 5 })
  854. }
  855. })
  856. },
  857. // 返回选择居民或者问卷类型
  858. goBack: function (number) {
  859. if (this.noswitch) {
  860. return
  861. }
  862. var vm = this
  863. if (vm.isAgain) {
  864. var content
  865. if (number == 1) {
  866. content = '再次筛查无法选择居民'
  867. } else {
  868. content = '再次筛查无法选择问卷类型'
  869. }
  870. top.layer.msg(content, { icon: 5 })
  871. return
  872. }
  873. var content = '../../jbsc/html/filter_type.html?isReLoad=1'
  874. if (number === 1) {
  875. //选择居民
  876. content += '&goDenizen=1&fliter_code=' + vm.screeningType + '&fliter_title=' + vm.screeningTitle
  877. }
  878. layer.open({
  879. type: 2,
  880. offset: 'rb', //右下角弹出
  881. id: 'filter_type',
  882. background: 'transparent',
  883. area: ['280px', '100%'],
  884. shade: 0.5,
  885. title: false,
  886. fixed: true, //不固定
  887. maxmin: false,
  888. closeBtn: 0,
  889. shift: 5,
  890. shadeClose: true, //点击遮罩关闭层
  891. content: content
  892. })
  893. }
  894. },
  895. watch: {
  896. screeningType: function () {
  897. $('.daan-list input').attr('checked', false)
  898. }
  899. }
  900. })
  901. </script>
  902. </body>
  903. </html>