|
|
@@ -25,9 +25,11 @@ import com.github.pagehelper.PageInfo;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -67,7 +69,7 @@ public class FsCompanyCustomerController extends BaseController {
|
|
|
// 获取当前登录用户id
|
|
|
Long currentUserId = SecurityUtils.getLoginUser().getUser().getUserId();
|
|
|
//管理员
|
|
|
-// Long isAdmin = roleMapper.companyUserIsAdmin(fsCompanyCustomer.getCompanyUserId());
|
|
|
+ Long isAdmin = roleMapper.companyUserIsAdmin(fsCompanyCustomer.getCompanyUserId());
|
|
|
PageHelper.startPage(fsCompanyCustomer.getPageNum(), fsCompanyCustomer.getPageSize());
|
|
|
List<FsCompanyCustomer> list = fsCompanyCustomerService.selectFsCompanyCustomerList(fsCompanyCustomer);
|
|
|
// 遍历集合,对每个对象的 phone 属性进行脱敏赋值
|
|
|
@@ -77,9 +79,9 @@ public class FsCompanyCustomerController extends BaseController {
|
|
|
customer.getCompanyUserId() != null && customer.getCompanyUserId().equals(currentUserId)
|
|
|
);
|
|
|
customer.setPhone(maskPhoneMiddleFive(customer.getPhone()));
|
|
|
-// if (isAdmin != null) {
|
|
|
-// customer.setMyCustomerFlag(true); // 如果是管理员全部为自己的客户
|
|
|
-// }
|
|
|
+ if (isAdmin != null) {
|
|
|
+ customer.setMyCustomerFlag(true); // 如果是管理员全部为自己的客户
|
|
|
+ }
|
|
|
});
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
@@ -120,7 +122,11 @@ public class FsCompanyCustomerController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping("/{id}")
|
|
|
public AjaxResult getInfo(@PathVariable Long id) {
|
|
|
- return AjaxResult.success(fsCompanyCustomerService.selectFsCompanyCustomerById(id));
|
|
|
+ FsCompanyCustomer fsCompanyCustomer = fsCompanyCustomerService.selectFsCompanyCustomerById(id);
|
|
|
+ if (fsCompanyCustomer!=null){
|
|
|
+ fsCompanyCustomer.setPhone(maskPhoneMiddleFive(fsCompanyCustomer.getPhone()));
|
|
|
+ }
|
|
|
+ return AjaxResult.success(fsCompanyCustomer);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -136,7 +142,14 @@ public class FsCompanyCustomerController extends BaseController {
|
|
|
*/
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@RequestBody FsCompanyCustomer fsCompanyCustomer) {
|
|
|
- return AjaxResult.success(fsCompanyCustomerService.updateFsCompanyCustomer(fsCompanyCustomer));
|
|
|
+ try {
|
|
|
+ return toAjax(fsCompanyCustomerService.updateFsCompanyCustomer(fsCompanyCustomer));
|
|
|
+ } catch (DuplicateKeyException e) {
|
|
|
+ if (e.getMessage().contains("uk_phone")) {
|
|
|
+ return AjaxResult.error("电话号码已存在,请更换后再试");
|
|
|
+ }
|
|
|
+ return AjaxResult.error("数据冲突,请稍后重试");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -168,6 +181,20 @@ public class FsCompanyCustomerController extends BaseController {
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据传入客户信息id查询手机号然后获取处方列表信息
|
|
|
+ * */
|
|
|
+ @PostMapping("/getPrescribeListByIdAndPhone")
|
|
|
+ public TableDataInfo getPrescribeListByIdAndPhone(@RequestBody PrescribePhoneParam param){
|
|
|
+ FsCompanyCustomer companyCustomer = fsCompanyCustomerService.selectFsCompanyCustomerById(param.getId());
|
|
|
+ if (companyCustomer == null){
|
|
|
+ return getDataTable(Collections.emptyList());
|
|
|
+ }
|
|
|
+ PageHelper.startPage(param.getPageNum(),param.getPageSize());
|
|
|
+ List<FsPrescribe> list = fsPrescribeService.selectPrescribeListByEncryptPhone(companyCustomer.getPhone());
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据传入手机号获取信息采集列表数据
|
|
|
* */
|
|
|
@@ -177,6 +204,20 @@ public class FsCompanyCustomerController extends BaseController {
|
|
|
List<FsUserInformationCollectionOverviewVo> list = fsUserInformationCollectionService.selectUserInformationCollectionByPhone(param.getPhone());
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据传入手机号获取信息采集列表数据
|
|
|
+ * */
|
|
|
+ @PostMapping("/getCollectionInfoListByIdAndPhone")
|
|
|
+ public TableDataInfo getCollectionInfoListByIdAndPhone(@RequestBody CollectionPhoneParam param){
|
|
|
+ FsCompanyCustomer companyCustomer = fsCompanyCustomerService.selectFsCompanyCustomerById(param.getId());
|
|
|
+ if (companyCustomer == null){
|
|
|
+ return getDataTable(Collections.emptyList());
|
|
|
+ }
|
|
|
+ PageHelper.startPage(param.getPageNum(),param.getPageSize());
|
|
|
+ List<FsUserInformationCollectionOverviewVo> list = fsUserInformationCollectionService.selectUserInformationCollectionByPhone(companyCustomer.getPhone());
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
/**
|
|
|
* 销售端-查询医生设置指定可见的患者信息列表
|
|
|
*/
|