questionnaire.html 30 KB

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