questionnaire.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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. </head>
  18. <body>
  19. <div class="ui-grid" id="app" style="align-items: flex-start;" v-cloak>
  20. <div class="flex-box-item ptb20">
  21. <!--<div class="prompt-text">请认真填写本页面,方便医生进行综合评估【厦门i健康】</div>-->
  22. <div class="single-choice-question">
  23. <div class="question-title">问卷题目</div>
  24. <div class="question-content">
  25. <ul class="question-list">
  26. <li v-for="(qst,key,index) in questions">
  27. <p class="question-name" v-text="key+'、'+qst.question.title"></p>
  28. <div class="daan-list" v-if="qst.question.questionType!=2">
  29. <lable class="label-block" v-for="opt in qst.option" @click="selectItem(qst.question,opt)">
  30. <span class="pull-right" v-text="(opt.score || 0)+'分'"></span>
  31. <input :type="qst.questionType==1?'checked':'radio'" :name="'ques'+index+screeningType+(qst.questionType==1?'[]':'')" value="1" /><i></i><span v-text="opt.content"></span>
  32. </lable>
  33. </div>
  34. <div class="daan-list" v-else>
  35. <textarea class="wenjuan-textarea" @keyup="changeContent(qst.question,qst.question.content)" rows="2" v-model="qst.question.content"></textarea>
  36. </div>
  37. </li>
  38. </ul>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="w-250">
  43. <div class="base-info">
  44. <p class="f-16 mb0">基本信息</p>
  45. <div class="flex-box right-triangle">
  46. <span class="w-70">
  47. 类型
  48. </span>
  49. <a class="flex-box-item" :alt="screeningTitle" v-text="screeningTitle" @click="goBack">
  50. --
  51. </a>
  52. </div>
  53. <div class="flex-box right-triangle">
  54. <span class="w-70">
  55. 对象
  56. </span>
  57. <a class="flex-box-item" :alt="screeningResidentsName" v-text="screeningResidentsName" @click="goBack(1)">
  58. --
  59. </a>
  60. </div>
  61. <div class="flex-box">
  62. <span class="w-70">
  63. 筛查人员
  64. </span>
  65. <div class="flex-box-item c-999" v-text="doctorInfo.name"></div>
  66. </div>
  67. <div class="flex-box" style="align-items: flex-start;">
  68. <span class="w-70">
  69. 体征记录
  70. </span>
  71. <div class="flex-box-item" v-if="tizhongRecord.value1 || tizhongRecord.value2">
  72. <p v-if="tizhongRecord.value1">体重<input type="number" step="0.1" readonly="readonly" :value="tizhongRecord.value1" />kg</p>
  73. <p class="mb0" v-if="tizhongRecord.value2">身高<input type="number" step="0.1" readonly="readonly" :value="tizhongRecord.value2" />cm</p>
  74. </div>
  75. <div class="flex-box-item" v-else>
  76. 暂无体征
  77. </div>
  78. </div>
  79. </div>
  80. <div class="completion-of-progress">
  81. <p class="f16 mb0">完成情况</p>
  82. <div class="canvas-box">
  83. <canvas-progress :progress="progress"></canvas-progress>
  84. <p class="progress-number">
  85. <span>已完成</span>
  86. </p>
  87. </div>
  88. </div>
  89. <div class="btn-group-bottom">
  90. <button class="btn submit-btn" @click="save">提交</button>
  91. <button class="btn btn-exit" @click="signOut">退出</button>
  92. </div>
  93. </div>
  94. </div>
  95. <script type="text/javascript" src="../../../plugins/echarts/3.8.5/echarts.min.js" ></script>
  96. <script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
  97. <script src="../../../js/jquery-2.2.4.js" type="text/javascript" charset="utf-8"></script>
  98. <script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
  99. <script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
  100. <script src="../../../plugins/toastr/toastr.min.js"></script>
  101. <script type="text/javascript" src="../../../plugins/layer/layer.min.js" ></script>
  102. <script src="../../../js/util.js" type="text/javascript" charset="utf-8"></script>
  103. <script src="../../../api/http-request.js" type="text/javascript" charset="utf-8"></script>
  104. <script type="text/javascript" src="../../../api/jbsc-api.js" ></script>
  105. <script type="text/javascript" src="../component/canvas-progress.js" ></script>
  106. <script type="text/javascript">
  107. var httpData=GetRequest();
  108. var wlyyAgentForDoc=JSON.parse(window.localStorage.getItem('wlyyAgentForDoc'));
  109. var question=new Vue({
  110. el: "#app",
  111. data: {
  112. //数据结果
  113. progress:0,
  114. selectArr:[],
  115. screeningTitle:decodeURI(httpData['fliter_title']),
  116. screeningType:httpData['fliter_code'],
  117. screeningResidents:httpData['resident_code'],
  118. screeningResidentsName:decodeURI(httpData['resident_name']),
  119. doctorInfo:{code:wlyyAgentForDoc.uid},
  120. questions:[],
  121. tizhongRecord:{},
  122. labelType:5,//问卷筛查labelType=5
  123. isAgain:(httpData['isAgain'] || 0),
  124. },
  125. mounted: function(){
  126. this.getQuestion();
  127. this.getHealth();
  128. this.getDoctorInfo()
  129. },
  130. methods: {
  131. getDoctorInfo:function(){
  132. var vm=this;
  133. var data={
  134. code:vm.doctorInfo.code
  135. }
  136. jbscAPI.doctorBaseinfo(data).then(function(res){
  137. if(res.status==200){
  138. vm.doctorInfo=res.data
  139. }else{
  140. top.layer.msg(res.msg, {icon: 5});
  141. }
  142. })
  143. },
  144. //计算选中个数,组装成后台接收格式
  145. selectItem:function(qst,select){
  146. console.log("selectItem");
  147. var data={
  148. qstCode:qst.code,
  149. type:qst.questionType,
  150. content:qst.content,
  151. }
  152. var options=[];
  153. if(select){
  154. options=[{
  155. optionCode:select.code,
  156. comment:select.content,
  157. score:select.score
  158. }]
  159. }
  160. data.options=options;
  161. var oldLen = this.selectArr.length;
  162. this.selectArr = _.filter(this.selectArr,function(o) {
  163. return o.qstCode !=data.qstCode;
  164. }) || [];
  165. this.selectArr.push(data);
  166. var len=this.selectArr.length;
  167. // var questions=Object.values(this.questions)
  168. var questions = _.toArray(this.questions)
  169. var allLen=questions.length;
  170. var progress=len===allLen?100:((len/allLen)*100);
  171. this.progress=progress;
  172. },
  173. signOut:function(){
  174. var index = top.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  175. var current=top.layer.confirm('问卷还未提交,确定要关闭?', {
  176. btn: ['关闭','取消'] //按钮
  177. }, function(){
  178. top.layer.closeAll(); //再执行关闭
  179. }, function(){
  180. top.layer.close(current); //再执行关闭
  181. });
  182. },
  183. changeContent:function(qst,content){
  184. if(!content) return ;
  185. this.selectItem(qst)
  186. },
  187. getQuestion:function(){
  188. var vm=this
  189. var data={
  190. surveyTemplateCode: vm.screeningType
  191. }
  192. jbscAPI.getAllQuestions(data).then(function(res){
  193. if(res.status==200){
  194. var questions = res.data;
  195. vm.questions = questions
  196. }
  197. })
  198. },
  199. getHealth:function(){
  200. var vm=this;
  201. var data={
  202. patient: vm.screeningResidents
  203. }
  204. jbscAPI.getHealth(data).then(function(res){
  205. if(res.status == 200) {
  206. vm.tizhongRecord = _.find(res.data,function(o) {
  207. return o.type =="3";
  208. }) || {};
  209. } else {
  210. top.layer.msg(res.msg, {icon: 5});
  211. }
  212. })
  213. },
  214. save:function(){
  215. var vm=this;
  216. if(vm.progress!=100){
  217. top.layer.msg('问卷还未全部填写', {icon: 5});
  218. return ;
  219. }
  220. var loadding = top.layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
  221. var data={
  222. patientCode:vm.screeningResidents,
  223. labelType:vm.labelType,
  224. isAgain:vm.isAgain,
  225. source:1,
  226. jsonData:JSON.stringify({
  227. surveyCode:vm.screeningType,
  228. questions:vm.selectArr
  229. })
  230. }
  231. jbscAPI.saveAnswer(data).then(function(res){
  232. top.layer.close(loadding);
  233. if(res.status == 200) {
  234. top.layer.open({
  235. type: 2,
  236. area: ['820px', '648px'],
  237. shade: 0.5,
  238. title: '筛选统计',
  239. fixed: true, //不固定
  240. maxmin: true,
  241. closeBtn:1,
  242. shift: 5,
  243. shadeClose: false, //点击遮罩关闭层
  244. content: '../../jbsc/html/filter_result.html?code='+res.data+'&filter_type='+vm.screeningType
  245. });
  246. var index = top.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  247. top.layer.close(index); //再执行关闭
  248. } else {
  249. top.layer.msg(res.msg, {icon: 5});
  250. }
  251. })
  252. },
  253. // 返回选择居民或者问卷类型
  254. goBack:function(number){
  255. var vm=this
  256. if(vm.isAgain){
  257. var content;
  258. if(number==1){
  259. content='再次筛查无法选择居民'
  260. }else{
  261. content='再次筛查无法选择问卷类型'
  262. }
  263. top.layer.msg(content, {icon: 5});
  264. return ;
  265. }
  266. var content='../../jbsc/html/filter_type.html?isReLoad=1';
  267. if(number===1){//选择居民
  268. content+='&goDenizen=1&fliter_code='+vm.screeningType+'&fliter_title='+vm.screeningTitle;
  269. }
  270. layer.open({
  271. type: 2,
  272. offset: 'rb', //右下角弹出
  273. id:"filter_type",
  274. background:"transparent",
  275. area: ['280px', '100%'],
  276. shade: 0.5,
  277. title: false,
  278. fixed: true, //不固定
  279. maxmin: false,
  280. closeBtn:0,
  281. shift: 5,
  282. shadeClose: true, //点击遮罩关闭层
  283. content: content
  284. });
  285. }
  286. },watch:{
  287. screeningType:function(){
  288. $('.daan-list input').attr('checked',false)
  289. }
  290. }
  291. })
  292. </script>
  293. </body>
  294. </html>