questionnaire.html 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809
  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. this.getHealth()
  219. this.getQuestion()
  220. this.getDoctorInfo()
  221. },
  222. methods: {
  223. getDoctorInfo: function () {
  224. var vm = this
  225. var data = {
  226. code: vm.doctorInfo.code
  227. }
  228. jbscAPI.doctorBaseinfo(data).then(function (res) {
  229. if (res.status == 200) {
  230. vm.doctorInfo = res.data
  231. } else {
  232. top.layer.msg(res.msg, { icon: 5 })
  233. }
  234. })
  235. },
  236. //计算选中个数,组装成后台接收格式
  237. selectItem: function (qst, select, num) {
  238. var vm = this
  239. var isFlag = 1
  240. if (qst.title == '抗栓药物其他名称' && vm.screeningTitle == '大肠癌筛查问卷(OB筛查)') {
  241. vm.selectArr.forEach(function (item, index) {
  242. if (item.thirdKey == 'ksDrugName1') {
  243. item.options.forEach(function (v, i) {
  244. if (v.comment == '其他') {
  245. isFlag = 0
  246. return false
  247. }
  248. })
  249. }
  250. })
  251. // 如果没有勾选“其他”选项,提示并返回
  252. if (isFlag) {
  253. qst.content = '' // 清空当前输入的内容
  254. this.$message.error('请先勾选抗栓药物名称的其他选项')
  255. return false
  256. }
  257. }
  258. if (vm.ascvdShow) {
  259. if (select.thirdKey == 'acs' || select.thirdKey == 'myocardialInfarct' || select.thirdKey == 'ischemicStroke' || select.thirdKey == 'seriousMedicalHistory') {
  260. return false
  261. }
  262. }
  263. var data = {
  264. qstCode: qst.code,
  265. type: qst.questionType,
  266. content: qst.content,
  267. thirdKey: qst.thirdKey
  268. }
  269. var options = []
  270. var ls = []
  271. var lsTo = []
  272. if (select) {
  273. if (qst.questionType == '1') {
  274. // 处理多选题
  275. if (!qst.selectedOptions) {
  276. qst.selectedOptions = []
  277. }
  278. var optionIndex = qst.selectedOptions.findIndex(item => item.optionCode == select.code)
  279. if (optionIndex > -1) {
  280. // 如果已经选中,则取消选择
  281. qst.selectedOptions.splice(optionIndex, 1)
  282. } else {
  283. // 如果未选中,则添加选项
  284. qst.selectedOptions.push({
  285. optionCode: select.code,
  286. comment: select.content,
  287. score: select.score,
  288. thirdKey: select.thirdKey,
  289. thirdValue: select.thirdValue
  290. })
  291. }
  292. options = qst.selectedOptions // 将选中的所有选项赋值给options
  293. } else {
  294. options = [
  295. {
  296. optionCode: select.code,
  297. comment: select.content,
  298. score: select.score,
  299. thirdKey: select.thirdKey,
  300. thirdValue: select.thirdValue
  301. }
  302. ]
  303. }
  304. if (select.thirdKey == 'ascvd' && select.thirdValue == 0) {
  305. this.ascvdShow = '0'
  306. vm.spliceFunction()
  307. for (var i in this.questions) {
  308. if (
  309. this.questions[i].question.thirdKey == 'acs' ||
  310. this.questions[i].question.thirdKey == 'myocardialInfarct' ||
  311. this.questions[i].question.thirdKey == 'ischemicStroke' ||
  312. this.questions[i].question.thirdKey == 'seriousMedicalHistory'
  313. ) {
  314. var s = this.questions[i].option[1]
  315. var v = this.questions[i].question
  316. ls.push({
  317. qstCode: v.code,
  318. type: v.questionType,
  319. thirdKey: v.thirdKey,
  320. options: [
  321. {
  322. optionCode: s.code,
  323. comment: s.content,
  324. score: s.score,
  325. thirdKey: s.thirdKey,
  326. thirdValue: s.thirdValue
  327. }
  328. ]
  329. })
  330. }
  331. }
  332. document.getElementById('myInput1').disabled = true
  333. document.getElementById('myInput2').disabled = true
  334. document.getElementById('myInput3').disabled = true
  335. document.getElementById('myInput4').disabled = true
  336. } else if (select.thirdKey == 'ascvd' && select.thirdValue == 1) {
  337. this.ascvdShow = ''
  338. this.ascvdS1 = ''
  339. this.ascvdS2 = ''
  340. this.ascvdS3 = ''
  341. this.ascvdS4 = ''
  342. document.getElementById('myInput1').disabled = false
  343. document.getElementById('myInput2').disabled = false
  344. document.getElementById('myInput3').disabled = false
  345. document.getElementById('myInput4').disabled = false
  346. ls = []
  347. vm.spliceFunction()
  348. }
  349. if (select.thirdKey == 'acs') {
  350. vm.ascvdS1 = select.thirdValue
  351. }
  352. if (select.thirdKey == 'myocardialInfarct') {
  353. vm.ascvdS2 = select.thirdValue
  354. }
  355. if (select.thirdKey == 'ischemicStroke') {
  356. vm.ascvdS3 = select.thirdValue
  357. }
  358. if (select.thirdKey == 'seriousMedicalHistory') {
  359. vm.ascvdS4 = select.thirdValue
  360. }
  361. }
  362. if ((num && qst.thirdKey == 'weight') || qst.thirdKey == 'height') {
  363. var weight = ''
  364. var height = ''
  365. for (var i in vm.questions) {
  366. if (vm.questions[i].question.thirdKey == 'weight') {
  367. weight = vm.questions[i].question.content
  368. }
  369. if (vm.questions[i].question.thirdKey == 'height') {
  370. height = vm.questions[i].question.content
  371. }
  372. }
  373. var w = qst.thirdKey == 'weight' ? qst.content : weight
  374. var h = qst.thirdKey == 'height' ? qst.content : height / 100
  375. var s = (w / (h * h)).toFixed(2)
  376. vm.selectArr.forEach(function (v, i) {
  377. if (v.thirdKey == 'bmi') {
  378. vm.selectArr.splice(i, 1)
  379. }
  380. })
  381. for (var i in vm.questions) {
  382. if (vm.questions[i].question.thirdKey == 'bmi') {
  383. lsTo.push({
  384. qstCode: vm.questions[i].question.code,
  385. type: vm.questions[i].question.questionType,
  386. content: s,
  387. thirdKey: vm.questions[i].question.thirdKey,
  388. options: []
  389. })
  390. vm.shaowas = s
  391. // if(w && h) {
  392. // vm.shaowas = s
  393. // }
  394. // console.log(vm.questions[i].question.content,"0809")
  395. // vm.questions[i].question.content = ''
  396. // console.log(vm.questions[i].question.content,"00000---")
  397. }
  398. }
  399. }
  400. data.options = options
  401. console.log('111111111111xsssssssss')
  402. var oldLen = this.selectArr.length
  403. this.selectArr =
  404. _.filter(this.selectArr, function (o) {
  405. return o.qstCode != data.qstCode
  406. }) || []
  407. this.selectArr = this.selectArr.concat(lsTo)
  408. this.selectArr = this.selectArr.concat(ls)
  409. this.selectArr.push(data)
  410. console.log(this.selectArr, 'this.selectArr')
  411. var len = this.selectArr.length
  412. // var questions=Object.values(this.questions)
  413. var questions = _.toArray(this.questions)
  414. var allLen = questions.length
  415. var progress = len === allLen ? 100 : (len / allLen) * 100
  416. if (select && select.thirdKey == 'ascvd') {
  417. this.$refs.progress.dataFunction(progress)
  418. } else {
  419. this.progress = progress
  420. }
  421. },
  422. spliceFunction: function () {
  423. var vm = this
  424. vm.selectArr.forEach(function (v, i) {
  425. if (v.thirdKey == 'acs') {
  426. vm.selectArr.splice(i, 1)
  427. }
  428. })
  429. vm.selectArr.forEach(function (v, i) {
  430. if (v.thirdKey == 'myocardialInfarct') {
  431. vm.selectArr.splice(i, 1)
  432. }
  433. })
  434. vm.selectArr.forEach(function (v, i) {
  435. if (v.thirdKey == 'ischemicStroke') {
  436. vm.selectArr.splice(i, 1)
  437. }
  438. })
  439. vm.selectArr.forEach(function (v, i) {
  440. if (v.thirdKey == 'seriousMedicalHistory') {
  441. vm.selectArr.splice(i, 1)
  442. }
  443. })
  444. },
  445. signOut: function () {
  446. var index = top.layer.getFrameIndex(window.name) //先得到当前iframe层的索引
  447. var current = top.layer.confirm(
  448. '问卷还未提交,确定要关闭?',
  449. {
  450. btn: ['关闭', '取消'] //按钮
  451. },
  452. function () {
  453. top.layer.closeAll() //再执行关闭
  454. },
  455. function () {
  456. top.layer.close(current) //再执行关闭
  457. }
  458. )
  459. },
  460. changeContent: function (qst, content, num) {
  461. if (!content) return
  462. this.selectItem(qst, '', num)
  463. },
  464. getQuestion: function () {
  465. var vm = this
  466. var data = {
  467. surveyTemplateCode: vm.screeningType
  468. }
  469. jbscAPI.getAllQuestions(data).then(function (res) {
  470. if (res.status == 200) {
  471. // console.log(res.data,"res.data")
  472. for (var i in res.data) {
  473. if (res.data[i].isThird == 3) {
  474. if (res.data[i].question.questionType == '1') {
  475. res.data[i].question.selectedOptions = [] // 初始化多选项的数组
  476. }
  477. if (res.data[i].question.thirdKey == 'assessTime') {
  478. res.data[i].question.content = new Date()
  479. }
  480. if (res.data[i].option.length != 0) {
  481. res.data[i].question.thirdKey = res.data[i].option[0].thirdKey
  482. }
  483. if (res.data[i].question.thirdKey == 'assessDoctor') {
  484. res.data[i].question.content = docInfo.name
  485. }
  486. if (res.data[i].question.thirdKey == 'assessOrgId') {
  487. res.data[i].question.content = docInfo.hospitalName
  488. }
  489. if (res.data[i].question.thirdKey == 'name') {
  490. res.data[i].question.content = vm.screeningResidentsName
  491. }
  492. if (res.data[i].question.thirdKey == 'sex') {
  493. res.data[i].question.content = vm.sex
  494. }
  495. if (res.data[i].question.thirdKey == 'age') {
  496. res.data[i].question.content = vm.age
  497. }
  498. }
  499. if (res.data[i].question.thirdKey == 'belongCommunity') {
  500. res.data[i].question.content = docInfo.hospitalName
  501. }
  502. if (res.data[i].question.thirdKey == 'doctorName') {
  503. res.data[i].question.content = docInfo.name
  504. }
  505. if (res.data[i].question.thirdKey == 'doctorPhoneNo') {
  506. res.data[i].question.content = docInfo.mobile
  507. }
  508. if (res.data[i].question.thirdKey == 'userName') {
  509. res.data[i].question.content = decodeURI(httpData.resident_name)
  510. }
  511. if (res.data[i].question.thirdKey == 'idNo') {
  512. res.data[i].question.content = httpData.idcard
  513. }
  514. if (res.data[i].question.thirdKey == 'phoneNo') {
  515. res.data[i].question.content = httpData.mobile
  516. }
  517. if (res.data[i].question.thirdKey == 'assessDoctor') {
  518. res.data[i].question.content = docInfo.name
  519. }
  520. if (res.data[i].question.thirdKey == 'assessOrgId') {
  521. res.data[i].question.content = docInfo.hospitalName
  522. }
  523. if (res.data[i].question.thirdKey == 'age') {
  524. res.data[i].question.content = httpData.age
  525. }
  526. if (res.data[i].question.title == '性别') {
  527. var index = vm.sex == 1 ? '0' : '1'
  528. console.log('==================aaaaaaaaaa', res.data[i].question, res.data[i].option[index])
  529. vm.selectItem(res.data[i].question, res.data[i].option[index])
  530. }
  531. if (res.data[i].question.thirdKey == 'createDate') {
  532. res.data[i].question.content = new Date().format('yyyy-MM-dd hh:mm:ss')
  533. }
  534. if (res.data[i].question.thirdKey == 'assessTime') {
  535. res.data[i].question.content = new Date().format('yyyy-MM-dd hh:mm:ss')
  536. }
  537. if (res.data[i].question.thirdKey == 'sex' && (vm.screeningTitle == '大肠癌筛查问卷(OB筛查)' || vm.screeningTitle == '脑卒中风险评估(冠心病、脑卒中、肾病)')) {
  538. var index = vm.sex == 1 ? '0' : '1'
  539. vm.selectItem(res.data[i].question, res.data[i].option[index])
  540. }
  541. }
  542. console.log(res.data, 'ssssssssslllllllllll')
  543. vm.questions = res.data
  544. for (var i in res.data) {
  545. if (res.data[i].isThird == 3) {
  546. if (res.data[i].question.thirdKey == 'assessTime') {
  547. vm.changeContent(res.data[i].question, new Date().format('yyyy-MM-dd HH:mm'))
  548. }
  549. if (res.data[i].question.thirdKey == 'assessDoctor') {
  550. vm.changeContent(res.data[i].question, docInfo.name)
  551. }
  552. if (res.data[i].question.thirdKey == 'assessOrgId') {
  553. vm.changeContent(res.data[i].question, docInfo.hospitalName)
  554. }
  555. if (res.data[i].question.thirdKey == 'name') {
  556. vm.changeContent(res.data[i].question, vm.screeningResidentsName)
  557. }
  558. if (res.data[i].question.thirdKey == 'age') {
  559. vm.changeContent(res.data[i].question, vm.age)
  560. }
  561. if (res.data[i].question.thirdKey == 'sex') {
  562. var index = vm.sex == 1 ? '0' : '1'
  563. console.log('------111111000000000', res.data[i].question, res.data[i].option[index])
  564. vm.selectItem(res.data[i].question, res.data[i].option[index])
  565. }
  566. }
  567. }
  568. }
  569. })
  570. },
  571. getHealth: function () {
  572. var vm = this
  573. jbscAPI
  574. .listMedical({
  575. patient: vm.screeningResidents,
  576. pageIndex: 1,
  577. pageSize: 1
  578. })
  579. .then(function (v) {
  580. if (v.status == 200) {
  581. if (v.list[0]) {
  582. jbscAPI
  583. .findMedicalDetail({
  584. medicalNo: v.list[0].medicalNo
  585. })
  586. .then(function (res) {
  587. if (res.status == 200) {
  588. var data = res.medical_detail
  589. for (var i in vm.questions) {
  590. if (vm.questions[i].question.thirdKey == 'height') {
  591. vm.questions[i].question.content = data.height
  592. vm.changeContent(vm.questions[i].question, data.height)
  593. }
  594. if (vm.questions[i].question.thirdKey == 'weight') {
  595. vm.questions[i].question.content = data.weight
  596. vm.changeContent(vm.questions[i].question, data.weight)
  597. }
  598. if (vm.questions[i].question.thirdKey == 'bmi') {
  599. if (data.height && data.weight) {
  600. var w = data.weight
  601. var h = data.height / 100
  602. var s = (w / (h * h)).toFixed(2)
  603. vm.questions[i].question.content = s
  604. vm.shaowas = s
  605. vm.changeContent(vm.questions[i].question, s)
  606. }
  607. }
  608. if (vm.questions[i].question.thirdKey == 'systolicPressure') {
  609. vm.questions[i].question.content = data.bloodPressureRigthU
  610. vm.changeContent(vm.questions[i].question, data.bloodPressureRigthU)
  611. }
  612. if (vm.questions[i].question.thirdKey == 'diastolicPressure') {
  613. vm.questions[i].question.content = data.bloodPressureRigthD
  614. vm.changeContent(vm.questions[i].question, data.bloodPressureRigthD)
  615. }
  616. if (vm.questions[i].question.thirdKey == 'bpU') {
  617. vm.questions[i].question.content = data.bloodPressureLeftU || data.bloodPressureRigthU
  618. vm.changeContent(vm.questions[i].question, data.bloodPressureLeftU || data.bloodPressureRigthU)
  619. }
  620. if (vm.questions[i].question.thirdKey == 'bpD') {
  621. vm.questions[i].question.content = data.bloodPressureLeftD || data.bloodPressureRigthD
  622. vm.changeContent(vm.questions[i].question, data.bloodPressureLeftD || data.bloodPressureRigthD)
  623. }
  624. if (vm.questions[i].question.thirdKey == 'glycolatedHemoglobin') {
  625. vm.questions[i].question.content = data.glycolatedHemoglobin
  626. vm.changeContent(vm.questions[i].question, data.glycolatedHemoglobin)
  627. }
  628. if (vm.questions[i].question.thirdKey == 'fbg') {
  629. vm.questions[i].question.content = data.fastingPlasmaGlucoseL
  630. vm.changeContent(vm.questions[i].question, data.fastingPlasmaGlucoseL)
  631. }
  632. if (vm.questions[i].question.thirdKey == 'bloodPotassium') {
  633. vm.questions[i].question.content = data.renalFunctionBloodPotassium
  634. vm.changeContent(vm.questions[i].question, data.renalFunctionBloodPotassium)
  635. }
  636. if (vm.questions[i].question.thirdKey == 'renalFunctionCreatinine') {
  637. vm.questions[i].question.content = data.renalFunctionCreatinine
  638. vm.changeContent(vm.questions[i].question, data.renalFunctionCreatinine)
  639. }
  640. }
  641. }
  642. })
  643. } else {
  644. var data = {
  645. patient: vm.screeningResidents
  646. }
  647. jbscAPI.getHealth(data).then(function (res) {
  648. if (res.status == 200) {
  649. vm.tizhongRecord =
  650. _.find(res.data, function (o) {
  651. return o.type == '3'
  652. }) || {}
  653. for (var i in vm.questions) {
  654. if (vm.questions[i].question.thirdKey == 'height') {
  655. vm.questions[i].question.content = vm.tizhongRecord.value2
  656. vm.changeContent(vm.questions[i].question, vm.tizhongRecord.value2)
  657. }
  658. if (vm.questions[i].question.thirdKey == 'weight') {
  659. vm.questions[i].question.content = vm.tizhongRecord.value1
  660. vm.changeContent(vm.questions[i].question, vm.tizhongRecord.value1)
  661. }
  662. if (vm.questions[i].question.thirdKey == 'systolicPressure') {
  663. vm.questions[i].question.content = res.data.xy.value1
  664. vm.changeContent(vm.questions[i].question, res.data.xy.value1)
  665. }
  666. if (vm.questions[i].question.thirdKey == 'diastolicPressure') {
  667. vm.questions[i].question.content = res.data.xy.value2
  668. vm.changeContent(vm.questions[i].question, res.data.xy.value2)
  669. }
  670. if (vm.questions[i].question.thirdKey == 'bmi') {
  671. if (vm.tizhongRecord.value2 && vm.tizhongRecord.value1) {
  672. var w = vm.tizhongRecord.value1
  673. var h = vm.tizhongRecord.value2 / 100
  674. var s = (w / (h * h)).toFixed(2)
  675. vm.questions[i].question.content = s
  676. vm.shaowas = s
  677. vm.changeContent(vm.questions[i].question, s)
  678. }
  679. }
  680. }
  681. } else {
  682. top.layer.msg(res.msg, { icon: 5 })
  683. }
  684. })
  685. }
  686. }
  687. })
  688. },
  689. save: function () {
  690. console.log('2222221sssssssssssssssss', this.selectArr)
  691. var vm = this
  692. if (vm.progress != 100) {
  693. top.layer.msg('问卷还未全部填写', { icon: 5 })
  694. return
  695. }
  696. var loadding = top.layer.load(0, { shade: false }) //0代表加载的风格,支持0-2
  697. vm.selectArr.forEach(function (v) {
  698. if (v.thirdKey == 'assessTime') {
  699. v.content = new Date(v.content).format('yyyy-MM-dd HH:mm')
  700. }
  701. })
  702. var data = {
  703. patientCode: vm.screeningResidents,
  704. labelType: vm.labelType,
  705. isAgain: vm.isAgain,
  706. source: 1,
  707. surveyStatus: vm.surveyStatus,
  708. jsonData: JSON.stringify({
  709. surveyCode: vm.screeningType,
  710. questions: vm.selectArr
  711. })
  712. }
  713. jbscAPI.saveAnswer(data).then(function (res) {
  714. top.layer.close(loadding)
  715. if (res.status == 200) {
  716. if (vm.questions[1].isThird == 3) {
  717. top.layer.open({
  718. type: 2,
  719. // offset: ['100px'], //右下角弹出
  720. area: ['568px', '100%'],
  721. shade: 0.5,
  722. title: '查看筛选结果',
  723. fixed: true, //不固定
  724. maxmin: true,
  725. closeBtn: 1,
  726. shift: 5,
  727. shadeClose: false, //点击遮罩关闭层
  728. content: '../../jbsc/html/view_screening_results.html?resultCode=' + res.data,
  729. end: function () {
  730. var index = top.layer.getFrameIndex(window.name) //先得到当前iframe层的索引
  731. parent.eventBuss.$emit('guan_results', index)
  732. }
  733. })
  734. } else {
  735. top.layer.open({
  736. type: 2,
  737. area: ['820px', '648px'],
  738. shade: 0.5,
  739. title: '筛选统计',
  740. fixed: true, //不固定
  741. maxmin: true,
  742. closeBtn: 1,
  743. shift: 5,
  744. shadeClose: false, //点击遮罩关闭层
  745. content: '../../jbsc/html/filter_result.html?code=' + res.data + '&filter_type=' + vm.screeningType
  746. })
  747. }
  748. } else {
  749. top.layer.msg(res.msg, { icon: 5 })
  750. }
  751. })
  752. },
  753. // 返回选择居民或者问卷类型
  754. goBack: function (number) {
  755. if (this.noswitch) {
  756. return
  757. }
  758. var vm = this
  759. if (vm.isAgain) {
  760. var content
  761. if (number == 1) {
  762. content = '再次筛查无法选择居民'
  763. } else {
  764. content = '再次筛查无法选择问卷类型'
  765. }
  766. top.layer.msg(content, { icon: 5 })
  767. return
  768. }
  769. var content = '../../jbsc/html/filter_type.html?isReLoad=1'
  770. if (number === 1) {
  771. //选择居民
  772. content += '&goDenizen=1&fliter_code=' + vm.screeningType + '&fliter_title=' + vm.screeningTitle
  773. }
  774. layer.open({
  775. type: 2,
  776. offset: 'rb', //右下角弹出
  777. id: 'filter_type',
  778. background: 'transparent',
  779. area: ['280px', '100%'],
  780. shade: 0.5,
  781. title: false,
  782. fixed: true, //不固定
  783. maxmin: false,
  784. closeBtn: 0,
  785. shift: 5,
  786. shadeClose: true, //点击遮罩关闭层
  787. content: content
  788. })
  789. }
  790. },
  791. watch: {
  792. screeningType: function () {
  793. $('.daan-list input').attr('checked', false)
  794. }
  795. }
  796. })
  797. </script>
  798. </body>
  799. </html>