|
|
@@ -30,6 +30,7 @@ import lombok.var;
|
|
30
|
30
|
import org.checkerframework.checker.nullness.Opt;
|
|
31
|
31
|
import org.elasticsearch.cluster.metadata.AliasAction;
|
|
32
|
32
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
33
|
+import org.springframework.transaction.annotation.Transactional;
|
|
33
|
34
|
import org.springframework.web.bind.annotation.*;
|
|
34
|
35
|
|
|
35
|
36
|
import java.text.DecimalFormat;
|
|
|
@@ -139,7 +140,7 @@ public class SurveyController extends BaseController {
|
|
139
|
140
|
@ApiOperation("详情 参数是id和分类名")
|
|
140
|
141
|
@Log(title = "查询q_survey详情",businessType = BusinessType.QUERY)
|
|
141
|
142
|
@GetMapping("/getinfo")
|
|
142
|
|
- @Anonymous
|
|
|
143
|
+
|
|
143
|
144
|
public AjaxResult getInfo( long id, String classname) {
|
|
144
|
145
|
//根据问卷id 获取问题及选项
|
|
145
|
146
|
Survey survey= surveyService.getEntity(id) ;
|
|
|
@@ -181,7 +182,7 @@ public class SurveyController extends BaseController {
|
|
181
|
182
|
@ApiOperation("详情")
|
|
182
|
183
|
@Log(title = "查询q_survey详情",businessType = BusinessType.QUERY)
|
|
183
|
184
|
@GetMapping("/getdetail")
|
|
184
|
|
- @Anonymous
|
|
|
185
|
+
|
|
185
|
186
|
public AjaxResult getdetail( @RequestParam long id,
|
|
186
|
187
|
@RequestParam(required = false) String user,
|
|
187
|
188
|
@RequestParam(required = false) String patientid,
|
|
|
@@ -254,9 +255,9 @@ public class SurveyController extends BaseController {
|
|
254
|
255
|
|
|
255
|
256
|
List<Answer> det= answerList.stream().filter(x->x.getQuestionid().equals(qs.getQuestionId()) ).collect(Collectors.toList());
|
|
256
|
257
|
|
|
257
|
|
- if(sheetid!=null && sheetid>0){
|
|
258
|
|
- det=det.stream().filter(x->x.getSheetId()==sheetid).collect(Collectors.toList());
|
|
259
|
|
- }
|
|
|
258
|
+// if(sheetid!=null && sheetid>0){
|
|
|
259
|
+// det=det.stream().filter(x->x.getSheetId()==sheetid).collect(Collectors.toList());
|
|
|
260
|
+// }
|
|
260
|
261
|
if(det==null || det.stream().count()==0){
|
|
261
|
262
|
qsv.setAnswerdetail("");
|
|
262
|
263
|
}
|
|
|
@@ -274,7 +275,10 @@ public class SurveyController extends BaseController {
|
|
274
|
275
|
{
|
|
275
|
276
|
// var vv= answerList.stream().filter(x->x.getQuestionid().equals(qs.getQuestionId())).findAny();
|
|
276
|
277
|
// vv.ifPresent(answer -> qsv.setScore(answer.getScore()));
|
|
277
|
|
- qsv.setScore(answerList.stream().filter(x->x.getQuestionid().equals(qs.getQuestionId())).findAny().get().getScore());
|
|
|
278
|
+
|
|
|
279
|
+// try{
|
|
|
280
|
+// qsv.setScore(answerList.stream().filter(x->x.getQuestionid().equals(qs.getQuestionId())).findAny().get().getScore());
|
|
|
281
|
+// }catch (){}
|
|
278
|
282
|
qsv.setAnswerdetail(answerList.stream().filter(x->x.getQuestionid().equals(qs.getQuestionId())).findAny().get().getAnswer());
|
|
279
|
283
|
}
|
|
280
|
284
|
System.out.println(qsv);
|
|
|
@@ -303,7 +307,7 @@ public class SurveyController extends BaseController {
|
|
303
|
307
|
@ApiOperation("新增")
|
|
304
|
308
|
@Log(title = "新增q_survey",businessType = BusinessType.INSERT)
|
|
305
|
309
|
@PostMapping
|
|
306
|
|
-
|
|
|
310
|
+ @Transactional
|
|
307
|
311
|
public AjaxResult add(@RequestBody SurveyView input) {
|
|
308
|
312
|
if (input.getQuestionlist() == null || input.getQuestionlist().stream().count() == 0) {
|
|
309
|
313
|
return Error("问题不能为空");
|
|
|
@@ -402,8 +406,9 @@ public class SurveyController extends BaseController {
|
|
402
|
406
|
if(input.getScoreRanges()!=null && !input.getScoreRanges().isEmpty())
|
|
403
|
407
|
{
|
|
404
|
408
|
for (ScoreRange sr : input.getScoreRanges()){
|
|
405
|
|
- if(sr.isCheckin()){
|
|
406
|
|
- LambdaUpdateWrapper<Survey> luw=new LambdaUpdateWrapper<>();
|
|
|
409
|
+ // if(sr.isCheckin()){
|
|
|
410
|
+ if(StringHelper.isNotEmpty(input.getSurveyScoreLabel()) && Objects.equals(sr.getLabelName(), input.getSurveyScoreLabel()))
|
|
|
411
|
+ { LambdaUpdateWrapper<Survey> luw=new LambdaUpdateWrapper<>();
|
|
407
|
412
|
luw.set(Survey::getYjMinScore,sr.getMin());
|
|
408
|
413
|
luw.set(Survey::getSurveyScoreLabel,sr.getLabelName());
|
|
409
|
414
|
luw.eq(Survey::getSurveyId,surveyid);
|
|
|
@@ -411,6 +416,7 @@ public class SurveyController extends BaseController {
|
|
411
|
416
|
}
|
|
412
|
417
|
sr.setSurveyId(surveyid);
|
|
413
|
418
|
sr.setCreateBy(CurrentUser().getUserName());
|
|
|
419
|
+ sr.setCreateTime(new Date());
|
|
414
|
420
|
scoreRangeService.insert(sr);
|
|
415
|
421
|
}
|
|
416
|
422
|
|
|
|
@@ -481,7 +487,7 @@ public class SurveyController extends BaseController {
|
|
481
|
487
|
@ApiOperation("统计详情")
|
|
482
|
488
|
@Log(title = "查询q_survey详情",businessType = BusinessType.QUERY)
|
|
483
|
489
|
@GetMapping("/answerstatis/{id}")
|
|
484
|
|
- @Anonymous
|
|
|
490
|
+
|
|
485
|
491
|
public AjaxResult getAnswerStatis(@PathVariable long id) {
|
|
486
|
492
|
List<AnswerStatisView> statisViewList = answerService.selectAnswerStatis(id);
|
|
487
|
493
|
//根据问卷id 获取问题及选项
|
|
|
@@ -534,7 +540,7 @@ public class SurveyController extends BaseController {
|
|
534
|
540
|
@ApiOperation("数据导出Excel")
|
|
535
|
541
|
@Log(title = "回答数据导出Excel", businessType = BusinessType.EXPORT)
|
|
536
|
542
|
@PostMapping("/answerlist/exportExcel")
|
|
537
|
|
- @Anonymous
|
|
|
543
|
+
|
|
538
|
544
|
public void answerListExportExcel(Long surveyid) {
|
|
539
|
545
|
LambdaQueryWrapper<Question> qw=new LambdaQueryWrapper<>();
|
|
540
|
546
|
qw.eq(Question::getSurveyid,surveyid);
|
|
|
@@ -597,7 +603,7 @@ public class SurveyController extends BaseController {
|
|
597
|
603
|
@ApiOperation("查询q_survey问题的分类")
|
|
598
|
604
|
@Log(title = "查询q_survey问题的分类",businessType = BusinessType.QUERY)
|
|
599
|
605
|
@GetMapping("getclassification")
|
|
600
|
|
- @Anonymous
|
|
|
606
|
+
|
|
601
|
607
|
public AjaxResult getInfoByType( long id) {
|
|
602
|
608
|
LambdaQueryWrapper<Question> qw = new LambdaQueryWrapper();
|
|
603
|
609
|
if(id>0){
|
|
|
@@ -661,6 +667,7 @@ public AjaxResult getStatisScoreRange(@PathVariable long id) {
|
|
661
|
667
|
@ApiOperation("根据手机号,问卷id 获取填写的sheet数据")
|
|
662
|
668
|
@Log(title = "根据工单编号获取填写的问卷", businessType = BusinessType.UPDATE)
|
|
663
|
669
|
@GetMapping("/getsurveyinfo")
|
|
|
670
|
+
|
|
664
|
671
|
public AjaxResult getSurveyInfo(@RequestParam String phone,@RequestParam long surveyid){
|
|
665
|
672
|
if ( StringHelper.isEmpty( phone)){
|
|
666
|
673
|
return Error("phone不能为空");
|
|
|
@@ -674,19 +681,27 @@ public AjaxResult getStatisScoreRange(@PathVariable long id) {
|
|
674
|
681
|
LambdaQueryWrapper<AnswerSheet> lqw=new LambdaQueryWrapper<>();
|
|
675
|
682
|
lqw.eq(AnswerSheet::getSurveyid,surveyid);
|
|
676
|
683
|
lqw.eq(AnswerSheet::getEnterphone, SecretHelper.AesEncrypt( phone));
|
|
|
684
|
+ lqw.orderByDesc(AnswerSheet::getCreatetime);
|
|
677
|
685
|
List<AnswerSheet> lists= answerSheetService.getList(lqw);
|
|
678
|
686
|
for (AnswerSheet as :lists){
|
|
679
|
687
|
|
|
680
|
|
- Optional<String> color = sclist.stream()
|
|
681
|
|
- .filter(scoreRange -> as.getLabelName().equals(scoreRange.getLabelName())) // 过滤 label 为 "张三" 的对象
|
|
682
|
|
- .map(ScoreRange::getColor) // 映射到 color 字段
|
|
683
|
|
- .findFirst(); // 获取第一个匹配的 color
|
|
|
688
|
+ if(StringHelper.isNotEmpty(as.getLabelName())){
|
|
|
689
|
+ Optional<String> color = sclist.stream()
|
|
|
690
|
+ .filter(scoreRange -> as.getLabelName().equals(scoreRange.getLabelName())) // 过滤 label 为 "张三" 的对象
|
|
|
691
|
+ .map(ScoreRange::getColor) // 映射到 color 字段
|
|
|
692
|
+ .filter(Objects::nonNull) // 过滤掉 null 值
|
|
|
693
|
+ .findFirst();
|
|
|
694
|
+
|
|
|
695
|
+
|
|
|
696
|
+ if (color.isPresent()) {
|
|
|
697
|
+ as.setYjColor(color.get());
|
|
|
698
|
+ }
|
|
684
|
699
|
|
|
685
|
|
- if (color.isPresent()) {
|
|
686
|
|
- as.setYjColor(color.get());
|
|
687
|
700
|
}
|
|
688
|
701
|
|
|
689
|
702
|
|
|
|
703
|
+
|
|
|
704
|
+
|
|
690
|
705
|
as.setYjName(as.getLabelName());
|
|
691
|
706
|
|
|
692
|
707
|
}
|
|
|
@@ -854,7 +869,7 @@ public AjaxResult getStatisScoreRange(@PathVariable long id) {
|
|
854
|
869
|
@ApiOperation("根据callid 获取来电弹屏的问卷列表")
|
|
855
|
870
|
@Log(title = "根据工单编号获取填写的问卷", businessType = BusinessType.UPDATE)
|
|
856
|
871
|
@GetMapping("/getcallsurvey")
|
|
857
|
|
- @Anonymous
|
|
|
872
|
+
|
|
858
|
873
|
public AjaxResult getcallsurvey(@RequestParam String callid,@RequestParam(required = false) String phone,@RequestParam (required = false) String part){
|
|
859
|
874
|
LambdaQueryWrapper<Survey> surveyLambdaQueryWrapper =new LambdaQueryWrapper<>();
|
|
860
|
875
|
surveyLambdaQueryWrapper.eq(Survey::getSurveyType,"ldtp");
|