questionnaire.html 9.6 KB

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