diff --git a/xinelu-admin/pom.xml b/xinelu-admin/pom.xml
index 605eede..c2752b0 100644
--- a/xinelu-admin/pom.xml
+++ b/xinelu-admin/pom.xml
@@ -79,10 +79,6 @@
com.xinelu
xinelu-nurse-applet
-
- com.xinelu
- xinelu-familydoctor
-
@@ -90,6 +86,14 @@
xinelu-familydoctor
+
+
+ com.tzwy
+ hmac
+ 1.0
+ system
+ ${basedir}/src/main/resources/lib/hmac-1.0.jar
+
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java
new file mode 100644
index 0000000..3d9148d
--- /dev/null
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/FdMessageController.java
@@ -0,0 +1,151 @@
+package com.xinelu.web.controller.applet;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.github.pagehelper.PageInfo;
+import com.xinelu.applet.dto.chatrecord.ChatRecordDTO;
+import com.xinelu.applet.dto.chatrecord.MessageSearchDto;
+import com.xinelu.applet.service.chatRecord.IChatRecordService;
+import com.xinelu.applet.service.messagepush.MessagePushService;
+import com.xinelu.applet.vo.chatrecord.MessageVo;
+import com.xinelu.common.core.controller.BaseController;
+import com.xinelu.common.core.domain.R;
+import com.xinelu.common.exception.ServiceException;
+import com.xinelu.familydoctor.applet.pojo.body.MessagePushBody;
+import com.xinelu.familydoctor.applet.pojo.dto.FDMessageDto;
+import com.xinelu.familydoctor.applet.pojo.vo.SignInfoDataVo;
+import com.xinelu.framework.config.AsyncExecutorConfig;
+import com.xinelu.manage.domain.chatRecord.ChatRecord;
+import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo;
+import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.annotation.Resource;
+import java.util.Date;
+
+/**
+ * @Author mengkuiliang
+ * @Description 家医消息推送控制器
+ * @Date 2023-10-19 019 11:18
+ * @Param
+ * @return
+ **/
+@Api(tags = "家医消息推送控制器")
+@RestController
+@RequestMapping("/applet/message")
+public class FdMessageController extends BaseController {
+ @Resource
+ private MessagePushService messagePushService;
+ @Resource
+ private AsyncExecutorConfig asyncExecutorConfig;
+ @Resource
+ private IChatRecordService chatRecordService;
+ @Resource
+ private IHospitalPersonInfoService hospitalPersonInfoService;
+
+ @ApiOperation(value = "家医推送订阅消息", notes = "向接收方推送订阅消息")
+ @PostMapping("/push")
+ public R pushMessage(@RequestBody FDMessageDto message) throws Exception {
+ if (StringUtils.isBlank(message.getRecipientIdentity())) {
+ return R.fail("接收方参数异常");
+ }
+ if (StringUtils.isBlank(message.getTemplateType())) {
+ return R.fail("消息模版参数异常");
+ }
+ messagePushService.FdPushMessage(JSONObject.parseObject(JSONObject.toJSONString(message)));
+ return R.ok();
+ }
+
+ @ApiOperation(value = "测试接口")
+ @GetMapping("/test/")
+ public R test(MessagePushBody body, @RequestHeader("region") String region) {
+// JSONObject jsonObject = null;
+// try {
+// String result = (String) httpService.get(SpringUtils.getFdUrl(region) + "/resident/signinfo/detail/2334", null, String.class);
+// jsonObject = JSONObject.parseObject(result);
+// if ("0".equals(jsonObject.get("code"))) {
+// return R.fail(jsonObject.get("msg").toString());
+// }
+// if (!jsonObject.containsKey("data") || jsonObject.get("data") == null) {
+// return R.ok();
+// }
+// return R.ok(JSONObject.parseObject(jsonObject.getJSONObject("data").toJSONString(), SignInfoDataVo.class));
+// } catch (Exception e) {
+// System.out.println("注册完善信息-更新签约标识出错:" + e.getMessage());
+// }
+
+ ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+ //设置子线程共享
+ RequestContextHolder.setRequestAttributes(servletRequestAttributes, true);
+ asyncExecutorConfig.asyncThreadServiceExecutor().execute(new Runnable() {
+ @Override
+ public void run() {
+ System.out.println("发送消息");
+ messagePushService.fdApprovePush(JSONObject.parseObject(JSONObject.toJSONString(body)));
+ }
+ });
+ System.out.println("执行成功");
+ return R.ok();
+ }
+
+
+ @ApiOperation("查询通知推送列表-家医PC端")
+ @PostMapping("/getNoticList")
+ public R> getNoticList(@RequestBody MessageSearchDto messageDto) {
+ if (StringUtils.isBlank(messageDto.getSenderNo())) {
+ return R.fail("发送人编号不能为空");
+ }
+ return R.ok(chatRecordService.getNoticList(messageDto));
+ }
+
+ @ApiOperation("查询通知详情-PC端")
+ @GetMapping("/getNoticDetail/{messageNo}")
+ public R getNoticDetail(@PathVariable String messageNo) {
+ return R.ok(chatRecordService.getNoticDetail(messageNo));
+ }
+
+ @ApiOperation(value = "保存通知-PC端", notes = "健康推送和通知公告消息通知")
+ @PostMapping("/noticeSave")
+ @Transactional
+ public R> noticeSave(@RequestBody ChatRecordDTO message) {
+ // 根据发送人编号查询家医用户信息
+ HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.getByPersonCode(message.getSenderNo(), null);
+ if(hospitalPersonInfo == null) {
+ throw new ServiceException("未查询到医生信息");
+ }
+ if(StringUtils.isBlank(message.getMessageNo())) {
+ message.setSendTime(new Date());
+ message.setSenderId(hospitalPersonInfo.getId());
+ message.setSenderName(hospitalPersonInfo.getPersonName());
+ chatRecordService.insertChatRecord(message);
+ } else {
+ MessageVo messageVo = chatRecordService.getNoticDetail(message.getMessageNo());
+ if(messageVo != null) {
+ ChatRecord entity = new ChatRecord();
+ BeanUtils.copyProperties(messageVo, entity);
+ entity.setMessageType(message.getMessageType());
+ entity.setContent(message.getContent());
+ entity.setCrowds(message.getCrowds());
+ entity.setCrowdsName(message.getCrowdsName());
+ entity.setTitle(message.getTitle());
+ entity.setUpdateTime(new Date());
+ entity.setUpdateBy(message.getSenderNo());
+ chatRecordService.updateChatRecordOfNo(entity);
+ }
+ }
+ return R.ok();
+ }
+
+ @ApiOperation("删除通知-家医PC端")
+ @GetMapping("/noticDel/{messageNo}")
+ public R noticDel(@PathVariable String messageNo) {
+ chatRecordService.del(messageNo);
+ return R.ok();
+ }
+}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/PatientScoreController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/PatientScoreController.java
index bc2635b..4992134 100644
--- a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/PatientScoreController.java
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/PatientScoreController.java
@@ -37,7 +37,7 @@ public class PatientScoreController extends BaseController {
if (!jsonObject.get("code").toString().equals("1")) {
return R.fail(jsonObject.get("msg").toString());
}
- return R.ok("请求成功", jsonObject.getString("data"));
+ return R.ok(jsonObject.getString("data"));
}
@ApiOperation("获取居民积分记录列表")
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentPatientInfoController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentPatientInfoController.java
index 0a00e7b..e57d9bf 100644
--- a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentPatientInfoController.java
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentPatientInfoController.java
@@ -47,13 +47,14 @@ public class ResidentPatientInfoController extends BaseController {
@ApiOperation("注册完善信息")
@PostMapping("")
public R register(@Validated @RequestBody PatientInfoBody body) {
- /*if(body.getDiseaseList() == null || body.getDiseaseList().size() == 0) {
- return R.fail("请选择基础疾病");
- }*/
+// if(body.getDiseaseList() == null || body.getDiseaseList().size() == 0) {
+// return R.fail("请选择基础疾病");
+// }
try {
residentPatientInfoService.register(body);
return R.ok();
} catch (Exception e) {
+ e.printStackTrace();
return R.fail(e.getMessage());
}
}
@@ -78,9 +79,9 @@ public class ResidentPatientInfoController extends BaseController {
}
@ApiOperation("获取已注册列表")
- @GetMapping("/getList/{openid}/{cityCode}")
- public R> getList(@PathVariable String openid, @PathVariable String cityCode) {
- return R.ok(residentPatientInfoService.getList(openid, cityCode));
+ @GetMapping("/getList/{openid}")
+ public R> getList(@PathVariable String openid) {
+ return R.ok(residentPatientInfoService.getList(openid, null));
}
@ApiOperation("切换账号")
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java
index e25b5a8..628432c 100644
--- a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/ResidentServiceApplyController.java
@@ -1,14 +1,22 @@
package com.xinelu.web.controller.applet;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.R;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.exception.ServiceException;
+import com.xinelu.common.utils.http.HttpService;
+import com.xinelu.common.utils.spring.SpringUtils;
import com.xinelu.familydoctor.applet.pojo.body.ResidentServiceApplyBody;
+import com.xinelu.familydoctor.applet.pojo.entity.PatientInfo;
import com.xinelu.familydoctor.applet.pojo.query.ApplyQuery;
-import com.xinelu.familydoctor.applet.pojo.vo.ResidentServiceApplyVo;
-import com.xinelu.familydoctor.applet.pojo.vo.ScreeningProjectVo;
+import com.xinelu.familydoctor.applet.pojo.query.ServiceRecordQuery;
+import com.xinelu.familydoctor.applet.pojo.vo.*;
+import com.xinelu.familydoctor.applet.service.IResidentPatientInfoService;
import com.xinelu.familydoctor.applet.service.IResidentServiceAppletService;
+import com.xinelu.manage.domain.orderevaluateinfo.OrderEvaluateInfo;
+import com.xinelu.manage.service.orderevaluateinfo.IOrderEvaluateInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@@ -16,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
+import java.util.stream.Collectors;
/**
* @Author mengkuiliang
@@ -31,28 +40,34 @@ public class ResidentServiceApplyController extends BaseController {
@Resource
private IResidentServiceAppletService residentServiceAppletService;
+ @Resource
+ private HttpService httpService;
+ @Resource
+ private IResidentPatientInfoService residentPatientInfoService;
+ @Resource
+ private IOrderEvaluateInfoService orderEvaluateInfoService;
- @ApiOperation("提交服务预约")
+ @ApiOperation("提交服务申请")
@PostMapping("/save")
public R> save(@RequestBody ResidentServiceApplyBody body) {
if (body == null || StringUtils.isBlank(body.getPackageNo()) || StringUtils.isBlank(body.getFormNo())) {
return R.fail("请求参数不能为空");
}
- if(StringUtils.isBlank(body.getIdentity())) {
+ if (StringUtils.isBlank(body.getIdentity())) {
return R.fail("居民身份证号不能为空");
}
residentServiceAppletService.insert(body);
return R.ok();
}
- @ApiOperation("取消服务预约")
+ @ApiOperation("取消服务申请")
@GetMapping("/cancel/{bookingNo}")
public R> cancel(@PathVariable String bookingNo) {
residentServiceAppletService.cancel(bookingNo);
return R.ok();
}
- @ApiOperation("服务预约列表")
+ @ApiOperation("服务申请列表")
@PostMapping("/list")
public TableDataInfo performanceBookingList(@RequestBody ApplyQuery query) {
if (StringUtils.isBlank(query.getIdentity())) {
@@ -67,30 +82,79 @@ public class ResidentServiceApplyController extends BaseController {
}
}
- @ApiOperation("服务预约详情")
+ @ApiOperation("服务申请详情")
@GetMapping("/detail/{bookingNo}")
public R performanceBookingDetail(@PathVariable String bookingNo) {
return R.ok(residentServiceAppletService.detail(bookingNo));
}
- @ApiOperation(value = "获取服务预约项目列表", notes = "获取家医个性服务包和筛查项目")
+ @ApiOperation(value = "获取服务申请项目列表", notes = "获取家医个性服务包和筛查项目")
@GetMapping("/getForm/{identity}")
public R> getForm(@PathVariable String identity, String projectName, @RequestHeader("region") String region) {
- return R.ok(residentServiceAppletService.getForm(identity, projectName,region));
+ return R.ok(residentServiceAppletService.getForm(identity, projectName, region));
}
@ApiOperation("服务记录列表")
- @PostMapping("/record")
- public TableDataInfo performanceBookingRecord(@RequestBody ApplyQuery query) {
- if (StringUtils.isBlank(query.getIdentity())) {
- throw new ServiceException("居民身份证号不能为空");
+ @GetMapping("/record/{identity}")
+ public R> performanceBookingRecord(@PathVariable String identity, ServiceRecordQuery query, @RequestHeader("region") String region) {
+ query.setIdentity(identity);
+ if (query.getPageNum() == null) {
+ query.setPageNum(1);
}
- try {
- startPage();
- return getDataTable(residentServiceAppletService.record(query));
- } catch (Exception e) {
- e.printStackTrace();
- throw new ServiceException(e.getMessage());
+ if (query.getPageSize() == null) {
+ query.setPageSize(1000);
}
+ JSONObject result = httpService.post(SpringUtils.getFdUrl(region) + "/performance/recordV1", null, JSONObject.parseObject(JSONObject.toJSONString(query)));
+ if (result.get("code").toString().equals("0")) {
+ throw new ServiceException(result.get("msg").toString());
+ }
+ if (result.get("data") != null) {
+ List perRecordList = JSONArray.parseArray(result.getJSONObject("data").getJSONArray("list").toJSONString()).toJavaList(ResidentServiceRecordVo.class);
+ if (perRecordList != null && perRecordList.size() > 0) {
+ // 查询评价
+ List list = orderEvaluateInfoService.selectOrderEvaluateByServiceNos(perRecordList.stream().map(ResidentServiceRecordVo::getPerformanceNo).collect(Collectors.toList()), "FAMILY_DOCTOR");
+ if (list != null && list.size() > 0) {
+ List orderEvaluateInfoTempList;
+ for (ResidentServiceRecordVo record : perRecordList) {
+ orderEvaluateInfoTempList = list.stream().filter(o -> o.getOrderNo().equals(record.getPerformanceNo())).collect(Collectors.toList());
+ if (orderEvaluateInfoTempList.size() > 0) {
+ record.setOrderEvaluateInfo(orderEvaluateInfoTempList.get(0));
+ }
+ }
+ }
+ }
+ return R.ok(perRecordList);
+ }
+ return R.ok();
+ }
+
+ @ApiOperation("获取服务记录详情")
+ @GetMapping("/serviceRecordDetail/{identity}/{performanceNo}")
+ public R serviceRecordDetail(@PathVariable String identity, @PathVariable String performanceNo, @RequestHeader("region") String region) {
+ String result = (String) httpService.get(SpringUtils.getFdUrl(region) + "/performance/detail/" + identity + "/" + performanceNo, null, String.class);
+ JSONObject jsonObject = JSONObject.parseObject(result);
+ if (jsonObject.getInteger("code") != 1) {
+ throw new ServiceException(jsonObject.getString("msg"));
+ }
+ if (jsonObject.get("data") != null) {
+ return R.ok(JSONObject.parseObject(jsonObject.getJSONObject("data").toJSONString(), ResidentServiceRecordVo.class));
+ }
+ return R.ok();
+ }
+
+ @ApiOperation("服务评价列表")
+ @GetMapping("/evaluateRecord/{identity}")
+ public R> performanceEvaluateRecord(@PathVariable String identity) {
+ PatientInfo patientInfo = residentPatientInfoService.getByCardNo(identity);
+ if (patientInfo != null && !StringUtils.isBlank(patientInfo.getCityCode())) {
+ String result = (String) httpService.get(SpringUtils.getFdUrl(patientInfo.getCityCode()) + "/performance/recordV2/" + identity, null, String.class);
+ JSONObject jsonObject = JSONObject.parseObject(result);
+ if (jsonObject.getInteger("code") == 1) {
+ if (jsonObject.get("data") != null && jsonObject.getJSONArray("data").size() > 0) {
+ return R.ok(JSONArray.parseArray(jsonObject.getJSONArray("data").toJSONString()).toJavaList(OrderEvaluateVo.class));
+ }
+ }
+ }
+ return R.ok();
}
}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/SignInfoController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/SignInfoController.java
index a4ec9c5..7d023fc 100644
--- a/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/SignInfoController.java
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/applet/SignInfoController.java
@@ -2,6 +2,7 @@ package com.xinelu.web.controller.applet;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
+import com.xinelu.applet.service.messagepush.MessagePushService;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.R;
import com.xinelu.common.core.page.TableDataInfo;
@@ -13,6 +14,7 @@ import com.xinelu.familydoctor.applet.pojo.query.NearbyOrgQuery;
import com.xinelu.familydoctor.applet.pojo.query.PackageQuery;
import com.xinelu.familydoctor.applet.pojo.query.TeamListQuery;
import com.xinelu.familydoctor.applet.pojo.vo.*;
+import com.xinelu.framework.config.AsyncExecutorConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@@ -280,4 +282,5 @@ public class SignInfoController extends BaseController {
}
return R.ok(JSONObject.parseObject(jsonObject.getJSONObject("data").toJSONString(), SignInfoDataVo.class));
}
+
}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/DeviceBindResidentController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/DeviceBindResidentController.java
index d230d62..84b7084 100644
--- a/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/DeviceBindResidentController.java
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/DeviceBindResidentController.java
@@ -1,7 +1,7 @@
package com.xinelu.web.controller.familydoctor;
import com.xinelu.common.core.controller.BaseController;
-import com.xinelu.common.core.domain.AjaxResult;
+import com.xinelu.common.core.domain.R;
import com.xinelu.familydoctor.entity.DeviceBindResident;
import com.xinelu.familydoctor.service.DeviceBindResidentService;
import io.swagger.annotations.Api;
@@ -26,38 +26,34 @@ public class DeviceBindResidentController extends BaseController {
@ApiOperation("绑定设备")
@PostMapping("binding")
- public AjaxResult bind(@RequestBody DeviceBindResident entity) {
+ public R> bind(@RequestBody DeviceBindResident entity) {
if (deviceBindResidentService.repeatBind(entity)) {
- return AjaxResult.error("设备【" + entity.getSn() + "】已绑定");
+ return R.fail("设备【" + entity.getSn() + "】已绑定");
}
- AjaxResult ajaxResult;
int row = deviceBindResidentService.bindDevice(entity);
if (row > 0) {
- ajaxResult = AjaxResult.success();
+ return R.ok();
} else {
- ajaxResult = AjaxResult.error("绑定失败");
+ return R.fail("绑定失败");
}
- return ajaxResult;
}
@ApiOperation("已绑定的设备")
@GetMapping("bound/{identity}")
@ApiImplicitParam(name = "identity", value = "身份证号", required = true)
- public AjaxResult boundDevice(@PathVariable String identity) {
+ public R> boundDevice(@PathVariable String identity) {
List list = deviceBindResidentService.boundDevice(identity);
- return AjaxResult.success(list);
+ return R.ok(list);
}
@ApiOperation("解绑设备")
@PostMapping("unbind")
- public AjaxResult unbindDevice(@RequestBody DeviceBindResident entity) {
- AjaxResult ajaxResult;
+ public R> unbindDevice(@RequestBody DeviceBindResident entity) {
int row = deviceBindResidentService.unbindDevice(entity);
if (row > 0) {
- ajaxResult = AjaxResult.success();
+ return R.ok();
} else {
- ajaxResult = AjaxResult.error("解绑失败");
+ return R.fail("解绑失败");
}
- return ajaxResult;
}
}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/EvaluateAdviceTemplateController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/EvaluateAdviceTemplateController.java
new file mode 100644
index 0000000..72a5752
--- /dev/null
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/EvaluateAdviceTemplateController.java
@@ -0,0 +1,65 @@
+package com.xinelu.web.controller.familydoctor;
+
+import com.xinelu.common.core.controller.BaseController;
+import com.xinelu.common.core.domain.AjaxResult;
+import com.xinelu.common.core.page.TableDataInfo;
+import com.xinelu.familydoctor.entity.EvaluateAdviceTemplate;
+import com.xinelu.familydoctor.service.EvaluateAdviceTemplateService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author gaoyu
+ * @description 自我评估处方模板接口控制器
+ * @date 2023-10-16 16:59
+ */
+@Api(tags = {"自我评估处方模板接口控制器"})
+@RestController
+@RequestMapping("/evaluate/advice/template")
+public class EvaluateAdviceTemplateController extends BaseController {
+
+ @Resource
+ private EvaluateAdviceTemplateService evaluateAdviceTemplateService;
+
+ @ApiOperation("模板列表")
+ @GetMapping("list")
+ public TableDataInfo list(EvaluateAdviceTemplate entity) {
+ startPage();
+ List list = evaluateAdviceTemplateService.findList(entity);
+ return getDataTable(list);
+ }
+
+ @ApiOperation("新增/编辑模板")
+ @PostMapping("save")
+ public AjaxResult save(@RequestBody EvaluateAdviceTemplate entity) {
+ evaluateAdviceTemplateService.save(entity);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("修改模板状态")
+ @PostMapping("change/status")
+ public AjaxResult changeStatus(@RequestBody EvaluateAdviceTemplate entity) {
+ evaluateAdviceTemplateService.changeStatus(entity);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("逻辑删除模板")
+ @PostMapping("del/{id}")
+ @ApiImplicitParam(name = "id", value = "模板ID", required = true)
+ public AjaxResult del(@PathVariable Long id) {
+ evaluateAdviceTemplateService.delTemplate(id);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("根据自评结果获取处方模板")
+ @GetMapping("get/{templateType}")
+ @ApiImplicitParam(name = "templateType", value = "处方模板类型", required = true)
+ public AjaxResult getTemplate(@PathVariable String templateType) {
+ return AjaxResult.success(evaluateAdviceTemplateService.getTemplate(templateType));
+ }
+}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/EvaluateSurveyController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/EvaluateSurveyController.java
new file mode 100644
index 0000000..5c8fa2e
--- /dev/null
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/EvaluateSurveyController.java
@@ -0,0 +1,88 @@
+package com.xinelu.web.controller.familydoctor;
+
+import com.xinelu.common.core.controller.BaseController;
+import com.xinelu.common.core.domain.AjaxResult;
+import com.xinelu.common.core.page.TableDataInfo;
+import com.xinelu.familydoctor.entity.EvaluateRecord;
+import com.xinelu.familydoctor.entity.EvaluateSurvey;
+import com.xinelu.familydoctor.service.EvaluateRecordService;
+import com.xinelu.familydoctor.service.EvaluateSurveyService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author gaoyu
+ * @description 自我评估问卷控制器
+ * @date 2023-10-10 11:02
+ */
+@Api(tags = {"自我评估问卷控制器"})
+@RestController
+@RequestMapping("/evaluate")
+public class EvaluateSurveyController extends BaseController {
+ @Resource
+ private EvaluateSurveyService evaluateSurveyService;
+ @Resource
+ private EvaluateRecordService evaluateRecordService;
+
+ @ApiOperation("问卷列表")
+ @GetMapping("survey/list")
+ public TableDataInfo surveyList(EvaluateSurvey entity) {
+ startPage();
+ List list = evaluateSurveyService.findList(entity);
+ return getDataTable(list);
+ }
+
+ @ApiOperation("问卷新增")
+ @PostMapping("survey/save")
+ public AjaxResult surveySave(@RequestBody EvaluateSurvey entity) {
+ evaluateSurveyService.insert(entity);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("问卷编辑")
+ @PostMapping("survey/update")
+ public AjaxResult surveyUpdate(@RequestBody EvaluateSurvey entity) {
+ evaluateSurveyService.update(entity);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("修改问卷状态(启用/停用)")
+ @PostMapping("survey/change/state")
+ public AjaxResult changeState() {
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("获取问卷")
+ @GetMapping("survey/get/{subject}")
+ @ApiImplicitParam(name = "subject", value = "问卷主题", required = true)
+ public AjaxResult getSurvey(@PathVariable String subject) {
+ EvaluateSurvey survey = evaluateSurveyService.getSurvey(subject);
+ return AjaxResult.success(survey);
+ }
+
+ @ApiOperation("问卷提交")
+ @PostMapping("survey/submit")
+ public AjaxResult surveySubmit(@RequestBody EvaluateRecord evaluateRecord) {
+ evaluateRecordService.submit(evaluateRecord);
+ return AjaxResult.success();
+ }
+
+ @ApiOperation("获取评估记录")
+ @GetMapping("record/timeline/{userId}")
+ @ApiImplicitParam(name = "userId", value = "用户ID", required = true)
+ public AjaxResult record(@PathVariable Long userId) {
+ return AjaxResult.success(evaluateRecordService.getEvaluateTimeline(userId));
+ }
+
+ @ApiOperation("获取评估问卷答案")
+ @GetMapping("survey/answer/{recordId}")
+ @ApiImplicitParam(name = "recordId", value = "评估记录ID", required = true)
+ public AjaxResult detail(@PathVariable Long recordId) {
+ return AjaxResult.success(evaluateRecordService.getAnswers(recordId));
+ }
+}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/PhysicalSignController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/PhysicalSignController.java
index f4dad3f..55685e2 100644
--- a/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/PhysicalSignController.java
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/familydoctor/PhysicalSignController.java
@@ -1,9 +1,10 @@
package com.xinelu.web.controller.familydoctor;
import com.xinelu.common.core.controller.BaseController;
-import com.xinelu.common.core.domain.AjaxResult;
+import com.xinelu.common.core.domain.R;
import com.xinelu.familydoctor.entity.*;
import com.xinelu.familydoctor.service.PhysicalSignService;
+import com.xinelu.familydoctor.vo.PhysicalLastRecordVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -11,6 +12,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
+import java.util.List;
import java.util.Map;
/**
@@ -27,51 +29,51 @@ public class PhysicalSignController extends BaseController {
@ApiOperation("上传血糖")
@PostMapping("bg/save")
- public AjaxResult saveBg(@RequestBody DeviceBgRecord record) {
+ public R> saveBg(@RequestBody DeviceBgRecord record) {
physicalSignService.saveBg(record);
- return AjaxResult.success();
+ return R.ok();
}
@ApiOperation("上传血压")
@PostMapping("bp/save")
- public AjaxResult saveBp(@RequestBody DeviceBpRecord record) {
+ public R> saveBp(@RequestBody DeviceBpRecord record) {
physicalSignService.saveBp(record);
- return AjaxResult.success();
+ return R.ok();
}
@ApiOperation("上传血脂")
@PostMapping("bf/save")
- public AjaxResult saveBf(@RequestBody DeviceBfRecord record) {
+ public R> saveBf(@RequestBody DeviceBfRecord record) {
physicalSignService.saveBf(record);
- return AjaxResult.success();
+ return R.ok();
}
@ApiOperation("上传BMI")
@PostMapping("bmi/save")
- public AjaxResult saveBmi(@RequestBody DeviceBmiRecord record) {
+ public R> saveBmi(@RequestBody DeviceBmiRecord record) {
physicalSignService.saveBmi(record);
- return AjaxResult.success();
+ return R.ok();
}
@ApiOperation("上传血氧")
@PostMapping("bo/save")
- public AjaxResult saveBo(@RequestBody DeviceBoRecord record) {
+ public R> saveBo(@RequestBody DeviceBoRecord record) {
physicalSignService.saveBo(record);
- return AjaxResult.success();
+ return R.ok();
}
@ApiOperation("上传心率")
@PostMapping("hr/save")
- public AjaxResult saveHr(@RequestBody DeviceHrRecord record) {
+ public R> saveHr(@RequestBody DeviceHrRecord record) {
physicalSignService.saveHr(record);
- return AjaxResult.success();
+ return R.ok();
}
@ApiOperation("上传体温")
@PostMapping("temp/save")
- public AjaxResult saveTemp(@RequestBody DeviceTempRecord record) {
+ public R> saveTemp(@RequestBody DeviceTempRecord record) {
physicalSignService.saveTemp(record);
- return AjaxResult.success();
+ return R.ok();
}
@ApiOperation("获取体征记录")
@@ -79,8 +81,15 @@ public class PhysicalSignController extends BaseController {
@ApiImplicitParams({@ApiImplicitParam(name = "identity", value = "身份证号", required = true),
@ApiImplicitParam(name = "type", value = "时间类型0:全部1:周2:月3:年", required = true),
@ApiImplicitParam(name = "label", value = "查询标识1:血糖2:血压3:血脂4:bmi5:血氧6:心率7:体温", required = true)})
- public AjaxResult record(String identity, String type, String label) {
+ public R> record(String identity, String type, String label) {
Map map = physicalSignService.record(identity, type, label);
- return AjaxResult.success(map);
+ return R.ok(map);
+ }
+
+ @ApiOperation("获取最后一次体征记录")
+ @GetMapping("record/last/{identity}")
+ @ApiImplicitParam(name = "identity", value = "身份证号", required = true)
+ public R> lastRecord(@PathVariable String identity) {
+ return R.ok(physicalSignService.getLastRecord(identity));
}
}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/DzsCodeController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/DzsCodeController.java
new file mode 100644
index 0000000..c131fe3
--- /dev/null
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/DzsCodeController.java
@@ -0,0 +1,352 @@
+package com.xinelu.web.controller.fd;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.xinelu.common.core.controller.BaseController;
+import com.xinelu.common.core.domain.R;
+import com.xinelu.common.exception.ServiceException;
+import com.xinelu.common.utils.DateUtils;
+import com.xinelu.common.utils.http.HttpService;
+import com.xinelu.common.utils.http.SslUtils;
+import com.xinelu.familydoctor.applet.pojo.body.DzsCodeBody;
+import com.xinelu.familydoctor.applet.pojo.query.DzsCodeQuery;
+import com.xinelu.web.controller.fd.utils.DzsCodeSign;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+@Api(tags = "德州市居民码控制器(爱山东APP)")
+@Slf4j
+@RestController
+@RequestMapping("/applet/fd/dzs/code")
+public class DzsCodeController extends BaseController {
+
+ @Resource
+ private HttpService httpService;
+ @Value("${dzsCode.appid}")
+ private String appid;
+ @Value("${dzsCode.appSecret}")
+ private String appSecret;
+ @Value("${dzsCode.url}")
+ private String url;
+ @Value("${dzsCode.mutualUrl}")
+ private String mutualUrl;
+ @Value("${dzsCode.isSecret}")
+ private String isSecret;
+ @Value("${dzsCode.isWhole}")
+ private String isWhole;
+ @Value("${dzsCode.institutionCode}")
+ private String institutionCode;
+ @Value("${dzsCode.useCityCode}")
+ private String useCityCode;
+ @Value("${dzsCode.businessStepCode}")
+ private String businessStepCode;
+
+ @ApiOperation(value = "居民码注册接口")
+ @GetMapping("/register")
+ public R> register(DzsCodeBody body) {
+ try {
+ JSONObject bodyParams = registerBody(body);
+ String message = "";
+ // 0:明文 1:加密
+ if (isSecret.equals("1")) {
+ message = DzsCodeSign.makeSign(appSecret, bodyParams.toJSONString());
+ } else {
+ message = bodyParams.toJSONString();
+ }
+ Map headerMap = headerParams(message);
+ // 0:明文 1:加密
+ JSONObject requestBody = new JSONObject();
+ requestBody.put("message", message);
+ SslUtils.ignoreSsl();
+ JSONObject resultObj = httpService.post(url + "/register", headerMap, requestBody);
+ log.info("居民码注册接口响应:{}", resultObj);
+ if (!resultObj.containsKey("code") || !resultObj.getString("code").equals("200")) {
+ if (resultObj.containsKey("msg") && !StringUtils.isBlank(resultObj.getString("msg"))) {
+ return R.fail(resultObj.getString("msg"));
+ }
+ return R.fail("接口异常");
+ }
+ if (resultObj.containsKey("data")) {
+ return R.ok(resultObj.get("data"));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new ServiceException(e.getMessage());
+ }
+ return R.ok();
+ }
+
+ @ApiOperation(value = "居民码查询接口")
+ @GetMapping("/analysis")
+ public R> query(DzsCodeQuery queryBody) {
+ try {
+ JSONObject bodyParams;
+ switch (queryBody.getInterfaceName()) {
+ // 是否已注册
+ case "isReg":
+ bodyParams = isRegBody(queryBody.getCardType(), queryBody.getCardNo());
+ break;
+ // 根据UID获取码值
+ case "getCodeByUid":
+ bodyParams = getCodeByUidBody(queryBody.getUid());
+ break;
+ // 根据证件获取居民码
+ case "getCodeByCard":
+ bodyParams = getCodeByCardBody(queryBody.getCardType(), queryBody.getCardNo());
+ break;
+ // 解析二维码
+ case "parsingCode":
+ bodyParams = parsingCodeBody(queryBody.getQrCode());
+ break;
+ // 获取用户信息
+ case "getUserInfo":
+ bodyParams = getUserInfoBody(queryBody.getJmmCode());
+ break;
+ default:
+ return R.fail("参数无效");
+ }
+ String message = "";
+ // 0:明文 1:加密
+ if (isSecret.equals("1")) {
+ message = DzsCodeSign.makeSign(appSecret, bodyParams.toJSONString());
+ } else {
+ message = bodyParams.toJSONString();
+ }
+ Map headerMap = headerParams(message);
+ // 0:明文 1:加密
+ JSONObject requestBody = new JSONObject();
+ requestBody.put("message", message);
+ SslUtils.ignoreSsl();
+ JSONObject resultObj = httpService.post(url + "/" + queryBody.getInterfaceName(), headerMap, requestBody);
+ log.info("居民码{}接口响应:{}", queryBody.getInterfaceName(), resultObj);
+ if (!resultObj.containsKey("code") || !resultObj.getString("code").equals("200")) {
+ if (resultObj.containsKey("msg") && !StringUtils.isBlank(resultObj.getString("msg"))) {
+ return R.fail(resultObj.getString("msg"));
+ }
+ return R.fail("接口异常");
+ }
+ if (resultObj.containsKey("data")) {
+ return R.ok(resultObj.getJSONObject("data"));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new ServiceException(e.getMessage());
+ }
+ return R.ok();
+ }
+
+ @ApiOperation(value = "多码互认接口")
+ @PostMapping("/mutualDiscern")
+ public R> mutualDiscern(@RequestBody DzsCodeBody body) {
+ // 请求参数示例:
+ // {
+ // "qrCode":"SDQR0000001A00010001371400011667058654613299203000169828216216982822221410ff8de0b234bdf8a92932e36173578789c4099bf3606c4c1e3e175a91a5ac754434bd767e4155ffdf095dc8a096714d4b86e535231efbb5383e9fd4cd13f2"
+ // }
+ if(body == null || StringUtils.isBlank(body.getQrCode())) {
+ return R.fail("请求参数无效");
+ }
+ try {
+ JSONObject bodyParams = mutualDiscernBody(body.getQrCode());
+ Map headerMap;
+ SslUtils.ignoreSsl();
+ String message = "";
+ JSONObject resultObj;
+ // 0:明文 1:加密
+ if (isSecret.equals("1")) {
+ message = DzsCodeSign.makeSign(appSecret, bodyParams.toJSONString());
+ headerMap = headerParams(message);
+ resultObj = httpService.post(mutualUrl + "/mutualDiscern", headerMap, message);
+ } else {
+ headerMap = headerParams(bodyParams.toJSONString());
+ resultObj = httpService.post(mutualUrl + "/mutualDiscern", headerMap, bodyParams);
+ }
+ log.info("居民码多码互认接口响应:{}", resultObj);
+ if (!resultObj.containsKey("code") || !resultObj.getString("code").equals("200")) {
+ if (resultObj.containsKey("msg") && !StringUtils.isBlank(resultObj.getString("msg"))) {
+ if (resultObj.containsKey("detail") && !StringUtils.isBlank(resultObj.getString("detail"))) {
+ return R.fail(resultObj.getString("msg") + "->" + resultObj.getString("detail"));
+ } else {
+ return R.fail(resultObj.getString("msg"));
+ }
+ }
+ return R.fail("接口异常");
+ }
+ if (resultObj.containsKey("data")) {
+ return R.ok(resultObj.getJSONObject("data"));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new ServiceException(e.getMessage());
+ }
+ return R.ok();
+ }
+
+ /**
+ * 设置请求header参数 参数都是必填的
+ */
+ private Map headerParams(String message) {
+ Map headMap = new HashMap<>();
+ // 客户端生成的安全随机码
+ String nonceStr = DzsCodeSign.getRandomString(10);
+ // 当前时间(yyyyMMddHHmmss)
+ String time = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
+ // 根据appid、nonceStr、time和(message),经过HMAC算法计算的值
+ String str = appid + "&" + time + "&" + nonceStr;
+ if (isWhole.equals("1")) {
+ str += message;
+ }
+ System.out.println("签名字符串:" + str);
+
+ // 应用ID
+ headMap.put("appid", appid);
+ headMap.put("nonceStr", nonceStr);
+ headMap.put("time", time);
+ headMap.put("sign", DzsCodeSign.makeSign(appSecret, str));
+ headMap.put("isSecret", isSecret);
+ headMap.put("isWhole", isWhole);
+ return headMap;
+ }
+
+ /**
+ * 设置body参数 - 判断是否已注册居民码
+ */
+ private JSONObject isRegBody(String cardType, String cardNo) {
+ JSONObject jsonObject = new JSONObject();
+ // 证件类型 必
+ jsonObject.put("cardType", cardType);
+ // 证件编号 必
+ jsonObject.put("cardNo", cardNo);
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 用户注册
+ */
+ private JSONObject registerBody(DzsCodeBody body) {
+ JSONObject jsonObject = new JSONObject();
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 根据UID获取居民码
+ */
+ private JSONObject getCodeByUidBody(String uid) {
+ JSONObject jsonObject = new JSONObject();
+ // 居民码UID 必
+ jsonObject.put("uid", uid);
+ // 经度
+ jsonObject.put("longitude", "");
+ // 纬度
+ jsonObject.put("latitude", "");
+ // 县区编码
+ jsonObject.put("county", "");
+ // 街道
+ jsonObject.put("subdistrict", "");
+ // 地点
+ jsonObject.put("position", "");
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 根据证件获取居民码
+ */
+ private JSONObject getCodeByCardBody(String cardType, String cardNo) {
+ JSONObject jsonObject = new JSONObject();
+ // 证件类型 必
+ jsonObject.put("cardType", cardType);
+ // 证件编号 必
+ jsonObject.put("cardNo", cardNo);
+ // 经度
+ jsonObject.put("longitude", "");
+ // 纬度
+ jsonObject.put("latitude", "");
+ // 县区编码
+ jsonObject.put("county", "");
+ // 街道
+ jsonObject.put("subdistrict", "");
+ // 地点
+ jsonObject.put("position", "");
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 解析二维码
+ */
+ private JSONObject parsingCodeBody(String qrCode) {
+ JSONObject jsonObject = new JSONObject();
+ // 必
+ jsonObject.put("QrCode", qrCode);
+ // 机构编码 必
+ jsonObject.put("institutionCode", institutionCode);
+ // 终端类型(0人工、1自助)必
+ jsonObject.put("channelCode", "0");
+ // 业务环节 必
+ jsonObject.put("businessStepCode", businessStepCode);
+ // 用码时间 yyyy-MM-dd HH:mm:ss 必
+ jsonObject.put("useTime", DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
+ // 返回值类型(对接时添加,后台的 二维码解析返回值类型)必
+ jsonObject.put("returnValueType", "01");
+ // 经度
+ jsonObject.put("longitude", "");
+ // 纬度
+ jsonObject.put("latitude", "");
+ // 县区编码
+ jsonObject.put("county", "");
+ // 街道
+ jsonObject.put("subdistrict", "");
+ // 地点
+ jsonObject.put("position", "");
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 获取用户信息
+ */
+ private JSONObject getUserInfoBody(String jmmCode) {
+ JSONObject jsonObject = new JSONObject();
+ // 省居民码授权码 必
+ jsonObject.put("jmmCode", jmmCode);
+ return jsonObject;
+ }
+
+ /**
+ * 设置body参数 - 多码互认 二维码识读
+ */
+ private JSONObject mutualDiscernBody(String qrCode) {
+ JSONObject jsonObject = new JSONObject();
+ // 必
+ jsonObject.put("QrCode", qrCode);
+ // 城市编码 必
+ jsonObject.put("useCityCode", useCityCode);
+ // 机构编码 必
+ jsonObject.put("institutionCode", institutionCode);
+ // 终端类型(0人工、1自助)必
+ jsonObject.put("channelCode", "0");
+ // 业务环节(接口方提供) 必
+ jsonObject.put("businessStepCode", businessStepCode);
+ // 用卡时间 yyyy-MM-dd HH:mm:ss 必
+ jsonObject.put("useTime", DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));
+ // 返回值类型(对接时添加,后台的 二维码解析返回值类型)必
+ jsonObject.put("returnValueType", "01");
+ // 经度
+ jsonObject.put("longitude", "");
+ // 纬度
+ jsonObject.put("latitude", "");
+ // 县区编码 (市辖区:371401 德城区:371402 陵城区:371403 宁津县:371422 庆云县:371423 临邑县:371424 齐河县:371425 平原县:371426 夏津县:371427 武城县:371428 乐陵市:371481 禹城市:371482 天衢新区:371471)
+ jsonObject.put("county", "");
+ // 街道
+ jsonObject.put("subdistrict", "");
+ // 地点
+ jsonObject.put("position", "");
+ return jsonObject;
+ }
+
+}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java
index acd2eb1..535617d 100644
--- a/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/FDController.java
@@ -1,9 +1,15 @@
package com.xinelu.web.controller.fd;
+
import com.alibaba.fastjson2.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
+import com.xinelu.applet.dto.chatrecord.ChatRecordDTO;
+import com.xinelu.applet.dto.chatrecord.MessageSearchDto;
+import com.xinelu.applet.service.chatRecord.IChatRecordService;
+import com.xinelu.applet.vo.chatrecord.MessageVo;
import com.xinelu.common.core.domain.R;
import com.xinelu.familydoctor.applet.pojo.body.ApprovalBody;
+import com.xinelu.familydoctor.applet.pojo.body.SyncHospitalPersonInfoBody;
import com.xinelu.familydoctor.applet.pojo.query.ApplyQuery;
import com.xinelu.familydoctor.applet.pojo.vo.ResidentRescindApplyVo;
import com.xinelu.familydoctor.applet.pojo.vo.ResidentServiceApplyVo;
@@ -11,11 +17,20 @@ import com.xinelu.familydoctor.applet.pojo.vo.ResidentSignApplyVo;
import com.xinelu.familydoctor.applet.service.IResidentRescindApplyService;
import com.xinelu.familydoctor.applet.service.IResidentServiceAppletService;
import com.xinelu.familydoctor.applet.service.IResidentSignAppletService;
+import com.xinelu.manage.domain.chatRecord.ChatRecord;
+import com.xinelu.manage.domain.hospitalinfo.HospitalInfo;
+import com.xinelu.manage.domain.hospitalpersoninfo.HospitalPersonInfo;
+import com.xinelu.manage.service.hospitalinfo.IHospitalInfoService;
+import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService;
import com.xinelu.manage.service.patientinfo.IPatientInfoService;
import com.xinelu.manage.vo.patientinfo.PatientInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -31,8 +46,13 @@ public class FDController {
private IResidentSignAppletService residentSignAppletService;
@Resource
private IResidentServiceAppletService residentServiceAppletService;
- @Resource
- private IPatientInfoService patientInfoService;
+ @Resource
+ private IPatientInfoService patientInfoService;
+ @Resource
+ private IHospitalPersonInfoService hospitalPersonInfoService;
+ @Resource
+ private IHospitalInfoService hospitalInfoService;
+
@ApiOperation("服务申请列表")
@PostMapping("/performanceBooking/list")
@@ -40,6 +60,7 @@ public class FDController {
PageHelper.startPage(query.getPageNum(), query.getPageSize());
return R.ok(PageInfo.of(residentServiceAppletService.findList(query)));
}
+
@ApiOperation("服务申请详情")
@GetMapping("/performanceBooking/detail/{bookingNo}")
public R performanceBookingDetail(@PathVariable String bookingNo) {
@@ -66,13 +87,14 @@ public class FDController {
@ApiOperation("解约申请列表")
@PostMapping("/rescindApply/list")
public R> rescindApplyList(@RequestBody ApplyQuery query) {
- if(StringUtils.isBlank(query.getUserNo())) {
+ if (StringUtils.isBlank(query.getUserNo())) {
return R.fail("医生编号不能为空");
}
PageHelper.startPage(query.getPageNum(), query.getPageSize());
query.setBookingStatus("0");
return R.ok(PageInfo.of(residentRescindApplyService.findList(query)));
}
+
@ApiOperation("解约申请详情")
@GetMapping("/rescindApply/detail/{applyNo}")
public R rescindApplyDetail(@PathVariable String applyNo) {
@@ -92,7 +114,7 @@ public class FDController {
@ApiOperation("签约申请列表")
@PostMapping("/signBooking/list")
public R> signBookingList(@RequestBody ApplyQuery query) {
- if(StringUtils.isBlank(query.getUserNo())) {
+ if (StringUtils.isBlank(query.getUserNo())) {
return R.fail("医生编号不能为空");
}
PageHelper.startPage(query.getPageNum(), query.getPageSize());
@@ -116,15 +138,66 @@ public class FDController {
return R.ok();
}
- @ApiOperation("根据签约主键查询绑定编号")
- @GetMapping("/signBooking/getBySignNo/{cardNo}")
- public R getBySignNo(@PathVariable String cardNo) {
- JSONObject retObj = new JSONObject();
+ @ApiOperation("根据签约主键查询绑定编号")
+ @GetMapping("/signBooking/getBySignNo/{cardNo}")
+ public R getBySignNo(@PathVariable String cardNo) {
+ JSONObject retObj = new JSONObject();
PatientInfoVO patientInfo = patientInfoService.selectPatientInfoByCardNo(cardNo);
- if (patientInfo != null) {
- retObj.fluentPut("bindingNo", patientInfo.getPatientCode())
- .fluentPut("openid", patientInfo.getOpenid());
- }
- return R.ok(retObj);
- }
+ if (patientInfo != null) {
+ retObj.fluentPut("bindingNo", patientInfo.getPatientCode())
+ .fluentPut("openid", patientInfo.getOpenid());
+ }
+ return R.ok(retObj);
+ }
+
+ @ApiOperation("家医医生同步科室人员信息")
+ @PostMapping("/synHospatialPersonInfo")
+ public R> synHospatialPersonInfo(@RequestBody SyncHospitalPersonInfoBody body) {
+ if (body == null) {
+ return R.fail("请求参数不能为空");
+ }
+ if (StringUtils.isBlank(body.getPersonCode())) {
+ return R.fail("科室人员编号不能为空");
+ }
+ if (StringUtils.isBlank(body.getOrgCode())) {
+ return R.fail("家医机构编号不能为空");
+ }
+ // 判断是否已存在
+ HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.getByPersonCode(body.getPersonCode(), body.getStatus());
+ // 根据家医机构查询医院信息
+ HospitalInfo hospital = hospitalInfoService.getHosptalByOrgCode(body.getOrgCode());
+ // 新增
+ if (hospitalPersonInfo == null) {
+ hospitalPersonInfo = new HospitalPersonInfo();
+ BeanUtils.copyProperties(body, hospitalPersonInfo);
+ hospitalPersonInfo.setCreateBy(body.getPersonCode());
+ hospitalPersonInfo.setStatus("1");
+ if (hospital != null) {
+ hospitalPersonInfo.setHospitalId(hospital.getId());
+ }
+ hospitalPersonInfoService.insert(hospitalPersonInfo);
+
+ // 修改
+ } else {
+ if (!String.valueOf(hospitalPersonInfo.getPersonAccount()).equals(String.valueOf(body.getPersonAccount()))
+ || !String.valueOf(hospitalPersonInfo.getPersonPhone()).equals(String.valueOf(body.getPersonPhone()))
+ || !String.valueOf(hospitalPersonInfo.getPersonName()).equals(String.valueOf(body.getPersonName()))
+ || !String.valueOf(hospitalPersonInfo.getPersonIntroduce()).equals(String.valueOf(body.getPersonIntroduce()))
+ || !String.valueOf(hospitalPersonInfo.getCardNo()).equals(String.valueOf(body.getCardNo()))
+ ) {
+ hospitalPersonInfo.setPersonName(body.getPersonName());
+ hospitalPersonInfo.setPersonPhone(body.getPersonPhone());
+ hospitalPersonInfo.setPersonAddress(body.getPersonAddress());
+ hospitalPersonInfo.setPersonAccount(body.getPersonAccount());
+ hospitalPersonInfo.setPersonIntroduce(body.getPersonIntroduce());
+ hospitalPersonInfo.setCardNo(body.getCardNo());
+ if (hospital != null) {
+ hospitalPersonInfo.setHospitalId(hospital.getId());
+ }
+ hospitalPersonInfo.setUpdateBy(body.getPersonCode());
+ hospitalPersonInfoService.updateByPersonCode(hospitalPersonInfo);
+ }
+ }
+ return R.ok();
+ }
}
diff --git a/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/utils/DzsCodeSign.java b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/utils/DzsCodeSign.java
new file mode 100644
index 0000000..2b07e79
--- /dev/null
+++ b/xinelu-admin/src/main/java/com/xinelu/web/controller/fd/utils/DzsCodeSign.java
@@ -0,0 +1,98 @@
+package com.xinelu.web.controller.fd.utils;
+
+import cn.hutool.core.codec.Base64;
+import cn.hutool.core.util.HexUtil;
+import com.tzwy.hmac.sm3.utils.Sm3HmacUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.io.UnsupportedEncodingException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Random;
+
+/**
+ * @Author mengkuiliang
+ * @Description 德州市居民码签名工具类
+ * @Date 2023-06-08 16:45
+ * @Param
+ * @return
+ **/
+@Slf4j
+@Component
+public class DzsCodeSign {
+
+ /**
+ * @return java.lang.String
+ * @Author mengkuiliang
+ * @Description 生成签名
+ * @Date 2023-06-08 16:40
+ * @Param [appId, appSecret, isWhole]
+ **/
+ public static String createSign(String appId, String appSecret, String isWhole, String message) {
+ SimpleDateFormat formater = new SimpleDateFormat("yyyyMMddHHmmss");
+ String str;
+ if(isWhole.equals("0")) {
+ str = appId + "&" + formater.format(new Date()) + "&" + getRandomString(10);
+ } else {
+ // message前边没有 &
+ str = appId + "&" + formater.format(new Date()) + "&" + getRandomString(10) + message;
+ }
+ System.out.println("签名字符串:" + str);
+ return makeSign(appSecret, str);
+ }
+
+ /**
+ * @return boolean
+ * @Author mengkuiliang
+ * @Description 验证签名
+ * @Date 2023-06-08 16:43
+ * @Param [str, appSecret, sign]
+ **/
+ public static boolean verifySign(String str, String appSecret, String sign) {
+ String signS = makeSign(appSecret, str);
+ return signS.equals(sign);
+ }
+
+ /**
+ * 生成指定长度的随机字符串
+ */
+ public static String getRandomString(int length) {
+ String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ Random random = new Random();
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < length; i++) {
+ int number = random.nextInt(62);
+ sb.append(str.charAt(number));
+ }
+ return sb.toString();
+ }
+
+ /**
+ * 生成签名
+ */
+ public static String makeSign(String appSecret, String str) {
+ try {
+ byte[] sm3Sign = Sm3HmacUtils.calcMac(HexUtil.decodeHex(appSecret), str.getBytes("UTF-8"));
+ return Base64.encode(sm3Sign);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public static void main(String[] args) throws UnsupportedEncodingException {
+
+ String appSecret = "74cb380c19b5448da4d7a1ef505089c4";
+ String appid = "lhw8570wl9zojyou6zv6";
+// String time = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
+ String time = "20230609165045";
+// String nonceStr = DzsCodeSign.getRandomString(10);
+ String nonceStr = "8EqtkddxC2";
+ String str = appid + "&" + time + "&" + nonceStr;
+ String signS = makeSign(appSecret, str);
+ System.out.println(signS);
+
+ // JAlMiqpak3hwtTa+OzlWPcTuE2sSwn+F/I0j5/Cu3Mg=
+ }
+}
diff --git a/xinelu-admin/src/main/resources/application.yml b/xinelu-admin/src/main/resources/application.yml
index fb063b6..479d194 100644
--- a/xinelu-admin/src/main/resources/application.yml
+++ b/xinelu-admin/src/main/resources/application.yml
@@ -163,7 +163,7 @@ token:
# 令牌有效期(默认30分钟)
expireTime: 1440
#请求拦截白名单
- ant-matchers: /nurseApplet/**,/nurseApp/**,/applet/**,webSocket/**
+ ant-matchers: /nurseApplet/**,/nurseApp/**,/applet/**,webSocket/**,/message/**
# MyBatis-Plus配置
mybatis-plus:
@@ -249,8 +249,8 @@ xss:
# 家医配置
fd:
- dy: http://192.168.124.6:8001/fd/mp
- dz: http://192.168.124.6:8001/fd/mp
+ dz: http://8.131.93.145:54089/fd/mp
+ dy: http://8.131.93.145:54089/fd/mp
# 签约附近的机构多少公里内 <=0时不限制
distance: 0
@@ -315,4 +315,23 @@ we-chat-payment-url-config:
logistics-config:
e-business-id: 1781371
api-key: 998b273d-c926-4659-a9d5-ae0613782d70
- express-bird-url: https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx
\ No newline at end of file
+ express-bird-url: https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx
+
+# 德州市鲁通码接口配置
+dzsCode:
+ appid: lhw8570wl9zojyou6zv6
+ appSecret: 74cb380c19b5448da4d7a1ef505089c4
+ # 接口服务
+ url: https://dsjj.dezhou.gov.cn/dzjmm/code
+ # 多码互认
+ mutualUrl: https://dsjj.dezhou.gov.cn/dzjmm/mutual
+ # 传输数据是否要加密(0:否1:是)
+ isSecret: 0
+ # 是否校验完整性(0:否1:是) 当为1时:sign的生成入参包括message
+ isWhole: 0
+ # 机构编码
+ institutionCode: 1137140000440159XP
+ # 城市编码 德州市
+ useCityCode: 371400
+ # 业务场景
+ businessStepCode: 302
diff --git a/xinelu-admin/src/main/resources/lib/hmac-1.0.jar b/xinelu-admin/src/main/resources/lib/hmac-1.0.jar
new file mode 100644
index 0000000..492272f
Binary files /dev/null and b/xinelu-admin/src/main/resources/lib/hmac-1.0.jar differ
diff --git a/xinelu-common/src/main/java/com/xinelu/common/config/AppletChatConfig.java b/xinelu-common/src/main/java/com/xinelu/common/config/AppletChatConfig.java
index d2c2b96..f726231 100644
--- a/xinelu-common/src/main/java/com/xinelu/common/config/AppletChatConfig.java
+++ b/xinelu-common/src/main/java/com/xinelu/common/config/AppletChatConfig.java
@@ -64,4 +64,5 @@ public class AppletChatConfig {
* 签到通知模板
*/
private String signTemplateId;
+
}
diff --git a/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTemplateType.java b/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTemplateType.java
new file mode 100644
index 0000000..b1ba81c
--- /dev/null
+++ b/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTemplateType.java
@@ -0,0 +1,79 @@
+package com.xinelu.common.enums;
+
+import lombok.Getter;
+
+import java.util.*;
+
+/**
+ * @Author mengkuiliang
+ * @Description 订阅消息枚举
+ * @Date 2023-01-11 17:32
+ * @Param
+ * @return
+ **/
+@Getter
+public enum MessageTemplateType {
+
+ JTYSXXTZ("1", "家庭医生消息通知", "8InV9jXDT5sMj9OWfXEvlLQGlw2UaWfZ9OBMFxufmfk", "默认通知模版"),
+
+ YYTX_1("9", "用药提醒", "2wn1BssReKjZasxKKZRWxBN0VqSmGmkuhc3AhTr18I0", "提醒居民用药"),
+
+ YYCGTZ("10", "预约成功", "MSSKCxOdtMUkY1ACu-u3itz8Vh_w5xDkO2llAOGwElU", "筛查项目预约成功");
+
+
+ /**
+ * 模版类型
+ */
+ private final String type;
+
+ /**
+ * 标题
+ */
+ private final String title;
+ /**
+ * 模版ID
+ */
+ private final String templateId;
+ /**
+ * 说明
+ */
+ private final String description;
+
+ MessageTemplateType(String type,String title, String templateId, String description) {
+ this.type = type;
+ this.title = title;
+ this.templateId = templateId;
+ this.description = description;
+ }
+
+ public static MessageTemplateType getFolllowupTypeByCode(String type) {
+ for (MessageTemplateType templateType : MessageTemplateType.values()) {
+ if (type.equals(templateType.getType())) {
+ return templateType;
+ }
+ }
+ return MessageTemplateType.JTYSXXTZ;
+ }
+
+
+ /**
+ * 获得所有枚举类型到list
+ */
+ public static List getAllToList() {
+ List list = new ArrayList<>();
+ MessageTemplateType[] values = values();
+ Collections.addAll(list, values);
+ return list;
+ }
+
+ /**
+ * 获得所有枚举类型到map
+ */
+ public static Map getAllToMap() {
+ Map map = new HashMap<>();
+ for (MessageTemplateType templateType : values()) {
+ map.put(templateType.getType(), templateType);
+ }
+ return map;
+ }
+}
diff --git a/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTypePath.java b/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTypePath.java
new file mode 100644
index 0000000..0f1a62c
--- /dev/null
+++ b/xinelu-common/src/main/java/com/xinelu/common/enums/MessageTypePath.java
@@ -0,0 +1,45 @@
+package com.xinelu.common.enums;
+
+import lombok.Getter;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * @Author haown
+ * @Description 订阅消息跳转路径枚举类
+ * @Date 2023-05-11 17:32
+ * @return
+ **/
+@Getter
+public enum MessageTypePath {
+ //消息类型,1:健康推送,2:日常提醒, 3:风险评估完成, 4:推送筛查项目,5:预约筛查成功, 6:筛查完成,
+ // 7:康复处方,8:随访提醒,9:纳入管理,10:申请转诊,11:转诊申请通过,12:申请会诊,13:会诊申请通过,14:处理异常"
+ JKTS("1", "pages/index/index"),
+ RCTX("2", "pages/dailyhealth/dailyhealth"),
+ FXPG("3", "pages/index/index"),
+ SCXM("4", "pagesB/screeningUserInfo/screeningUserInfo?assessRecordId="),
+ YYCG("5", "pages/index/index"),
+ SCWC("6", "pages/screeningResult/screeningResult?screeningId="),
+ KFCF("7", "pages/boughtRecoveryPrescription/boughtRecoveryPrescription?prescriptionRecordId="),
+ DEFAULT("0", "pages/index/index");
+
+ private final String messageType;
+
+ private final String path;
+
+ MessageTypePath(String messageType, String path) {
+ this.messageType = messageType;
+ this.path = path;
+ }
+
+ public static MessageTypePath getPathByType(String type) {
+ if(StringUtils.isBlank(type)) {
+ return MessageTypePath.DEFAULT;
+ }
+ for (MessageTypePath typePath : MessageTypePath.values()) {
+ if (type.equals(typePath.getMessageType())) {
+ return typePath;
+ }
+ }
+ return MessageTypePath.DEFAULT;
+ }
+}
diff --git a/xinelu-common/src/main/java/com/xinelu/common/enums/RegionKeyType.java b/xinelu-common/src/main/java/com/xinelu/common/enums/RegionKeyType.java
index 3aecc6a..acaae97 100644
--- a/xinelu-common/src/main/java/com/xinelu/common/enums/RegionKeyType.java
+++ b/xinelu-common/src/main/java/com/xinelu/common/enums/RegionKeyType.java
@@ -35,6 +35,6 @@ public enum RegionKeyType {
return uploadType;
}
}
- throw new ServiceException("获取区域配置出错");
+ throw new ServiceException("未查询到区域配置");
}
}
diff --git a/xinelu-common/src/main/java/com/xinelu/common/enums/SurveySubjectEnum.java b/xinelu-common/src/main/java/com/xinelu/common/enums/SurveySubjectEnum.java
new file mode 100644
index 0000000..29109f3
--- /dev/null
+++ b/xinelu-common/src/main/java/com/xinelu/common/enums/SurveySubjectEnum.java
@@ -0,0 +1,32 @@
+package com.xinelu.common.enums;
+/**
+ * @description: 问卷主题枚举
+ * @author gaoyu
+ * @date 2023-10-11 10:44
+ */
+public enum SurveySubjectEnum {
+ HBP_EVALUATE("1001", "高血压评估问卷"),
+ BG_EVALUATE("1002", "糖尿病评估问卷"),
+ STOKE_EVALUATE("1003", "脑卒中评估问卷"),
+ COPD_EVALUATE("1004", "慢阻肺评估问卷"),
+ CHRONIC_EVALUATE("1005", "慢病评估问卷"),
+ NS_EVALUATE("1006", "糖尿病肾病评估问卷"),
+ ED_EVALUATE("1007", "糖尿病眼病评估问卷"),
+ FD_EVALUATE("1008", "糖尿病足病评估问卷");
+
+ private final String code;
+ private final String label;
+
+ SurveySubjectEnum(String code, String label) {
+ this.code = code;
+ this.label = label;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+}
diff --git a/xinelu-common/src/main/java/com/xinelu/common/utils/http/HttpUtils.java b/xinelu-common/src/main/java/com/xinelu/common/utils/http/HttpUtils.java
index f22b454..c25a523 100644
--- a/xinelu-common/src/main/java/com/xinelu/common/utils/http/HttpUtils.java
+++ b/xinelu-common/src/main/java/com/xinelu/common/utils/http/HttpUtils.java
@@ -79,7 +79,7 @@ public class HttpUtils {
while ((line = in.readLine()) != null) {
result.append(line);
}
- log.info("recv - {}", result);
+// log.info("recv - {}", result);
} catch (ConnectException e) {
log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e);
} catch (SocketTimeoutException e) {
@@ -130,7 +130,7 @@ public class HttpUtils {
while ((line = in.readLine()) != null) {
result.append(line);
}
- log.info("recv - {}", result);
+// log.info("recv - {}", result);
} catch (ConnectException e) {
log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e);
} catch (SocketTimeoutException e) {
@@ -182,7 +182,7 @@ public class HttpUtils {
result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8));
}
}
- log.info("recv - {}", result);
+// log.info("recv - {}", result);
conn.disconnect();
br.close();
} catch (ConnectException e) {
diff --git a/xinelu-common/src/main/java/com/xinelu/common/utils/map/MapUtil.java b/xinelu-common/src/main/java/com/xinelu/common/utils/map/MapUtil.java
new file mode 100644
index 0000000..fe5652c
--- /dev/null
+++ b/xinelu-common/src/main/java/com/xinelu/common/utils/map/MapUtil.java
@@ -0,0 +1,72 @@
+package com.xinelu.common.utils.map;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Author mengkuiliang
+ * @Description Obj转Map
+ * @Date 2022-04-27 13:39
+ * @Param
+ * @return
+ **/
+public class MapUtil {
+ /**
+ * Pojo -> Map
+ *
+ * @param obj
+ * @return
+ * @throws Exception
+ */
+ public static Map object2Map(Object obj) throws Exception {
+ Map map = new HashMap();
+ Field[] fields = obj.getClass().getDeclaredFields();
+ for (Field field : fields) {
+ field.setAccessible(true);
+ map.put(field.getName(), field.get(obj));
+ }
+ return map;
+ }
+
+ /**
+ * List --> List