Commit df61b9f9 authored by 向怀芳's avatar 向怀芳 🎱

调整导医参数

调整导医返回结构
parent 9cd218f6
...@@ -7,7 +7,6 @@ import cn.sh.stc.sict.cloud.common.core.constant.Constant; ...@@ -7,7 +7,6 @@ import cn.sh.stc.sict.cloud.common.core.constant.Constant;
import cn.sh.stc.sict.cloud.common.core.util.NumberUtil; import cn.sh.stc.sict.cloud.common.core.util.NumberUtil;
import cn.sh.stc.sict.cloud.common.core.util.R; import cn.sh.stc.sict.cloud.common.core.util.R;
import cn.sh.stc.sict.cloud.common.security.util.SecurityUtils; import cn.sh.stc.sict.cloud.common.security.util.SecurityUtils;
import cn.sh.stc.sict.cloud.upms.dto.CurrentUser;
import cn.sh.stc.sict.theme.common.dto.SocketMsg; import cn.sh.stc.sict.theme.common.dto.SocketMsg;
import cn.sh.stc.sict.theme.handler.WebSocketServer; import cn.sh.stc.sict.theme.handler.WebSocketServer;
import cn.sh.stc.sict.theme.hphy.constant.PatientConstant; import cn.sh.stc.sict.theme.hphy.constant.PatientConstant;
...@@ -22,6 +21,7 @@ import cn.sh.stc.sict.theme.hphy.util.PythonUtil; ...@@ -22,6 +21,7 @@ import cn.sh.stc.sict.theme.hphy.util.PythonUtil;
import cn.sh.stc.sict.theme.hphy.vo.*; import cn.sh.stc.sict.theme.hphy.vo.*;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -144,11 +144,12 @@ public class HphyEvaController { ...@@ -144,11 +144,12 @@ public class HphyEvaController {
@ApiOperation("调用python程序") @ApiOperation("调用python程序")
@GetMapping("/python/result") @GetMapping("/python/result")
public R getPythonResult(@RequestParam("guideId") Long guideId, public R getPythonResult(@RequestParam("guideId") Long guideId,
@RequestParam("")String a, @ApiParam("纬度") @RequestParam(value = "addX",required = false)String addX,
@RequestParam("")String b, @ApiParam("经度") @RequestParam(value = "addY",required = false)String addY,
@RequestParam("")String c, @ApiParam("是否距离优先 Y-是") @RequestParam(value = "distence", defaultValue = "N", required = false)String distence,
@RequestParam("")String d) throws UnsupportedEncodingException { @ApiParam("是否高龄医生优先 H-是") @RequestParam(value = "exp",defaultValue = "N", required = false)String exp,
return hphyGuideRecordService.getPythonResult(guideId); @ApiParam("是否人气优先 Y-是") @RequestParam(value = "fre",defaultValue = "N", required = false)String fre) throws UnsupportedEncodingException {
return hphyGuideRecordService.getPythonResult(guideId, addX, addY, distence, exp, fre);
} }
/** /**
......
...@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/hphy/c/patientbase") @RequestMapping("/hphy/c/patientbase")
@AllArgsConstructor @AllArgsConstructor
@Slf4j @Slf4j
@Api(tags = "[D]患者基本信息") @Api(tags = "[C]患者基本信息")
public class HphyPatientBaseController { public class HphyPatientBaseController {
private HphyPatientBaseService hphyPatientBaseService; private HphyPatientBaseService hphyPatientBaseService;
......
...@@ -17,24 +17,24 @@ import java.util.List; ...@@ -17,24 +17,24 @@ import java.util.List;
@Component @Component
public class RefreshJob { public class RefreshJob {
@Scheduled(cron = "") // @Scheduled(cron = "")
public void updateHosp(){ // public void updateHosp(){
HosInfo hosInfo = new HosInfo(); // HosInfo hosInfo = new HosInfo();
List<HosInfo> list = WanDaHttpUtil.getHospitalInfo(hosInfo); // List<HosInfo> list = WanDaHttpUtil.getHospitalInfo(hosInfo);
} // }
//
@Scheduled(cron = "") // @Scheduled(cron = "")
public void updateDeptTop(){ // public void updateDeptTop(){
//
} // }
//
@Scheduled(cron = "") // @Scheduled(cron = "")
public void updateDeptTwo(){ // public void updateDeptTwo(){
//
} // }
//
@Scheduled(cron = "") // @Scheduled(cron = "")
public void updateDocInfo(){ // public void updateDocInfo(){
//
} // }
} }
...@@ -26,7 +26,7 @@ public interface HphyGuideRecordService extends IService<HphyGuideRecord> { ...@@ -26,7 +26,7 @@ public interface HphyGuideRecordService extends IService<HphyGuideRecord> {
HphyGuideRecord getByPatientId(String patientId); HphyGuideRecord getByPatientId(String patientId);
R getPythonResult(Long guideId) throws UnsupportedEncodingException; R getPythonResult(Long guideId, String addX, String addY, String distence, String exp, String fre) throws UnsupportedEncodingException;
List<DiseaseAnalysisDTO> listAnalysis(Long guideId); List<DiseaseAnalysisDTO> listAnalysis(Long guideId);
} }
......
...@@ -2,13 +2,14 @@ package cn.sh.stc.sict.theme.hphy.service.impl; ...@@ -2,13 +2,14 @@ package cn.sh.stc.sict.theme.hphy.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import cn.sh.stc.sict.cloud.common.core.constant.Constant; import cn.sh.stc.sict.cloud.common.core.constant.Constant;
import cn.sh.stc.sict.cloud.common.core.util.NumberUtil; import cn.sh.stc.sict.cloud.common.core.util.NumberUtil;
import cn.sh.stc.sict.cloud.common.core.util.R; import cn.sh.stc.sict.cloud.common.core.util.R;
import cn.sh.stc.sict.theme.common.model.HphyArticle;
import cn.sh.stc.sict.theme.common.service.HphyArticleService;
import cn.sh.stc.sict.theme.hphy.constant.PatientConstant; import cn.sh.stc.sict.theme.hphy.constant.PatientConstant;
import cn.sh.stc.sict.theme.hphy.dao.HphyGuideRecordMapper; import cn.sh.stc.sict.theme.hphy.dao.HphyGuideRecordMapper;
import cn.sh.stc.sict.theme.hphy.model.HphyGuideRecord; import cn.sh.stc.sict.theme.hphy.model.HphyGuideRecord;
...@@ -29,10 +30,7 @@ import lombok.AllArgsConstructor; ...@@ -29,10 +30,7 @@ import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -44,6 +42,7 @@ public class HphyGuideRecordServiceImpl extends ServiceImpl<HphyGuideRecordMappe ...@@ -44,6 +42,7 @@ public class HphyGuideRecordServiceImpl extends ServiceImpl<HphyGuideRecordMappe
private final HphyGuideRecordMapper hphyGuideRecordMapper; private final HphyGuideRecordMapper hphyGuideRecordMapper;
private final HphyDoctorService hphyDoctorService; private final HphyDoctorService hphyDoctorService;
private final HphyPatientBaseService hphyPatientBaseService; private final HphyPatientBaseService hphyPatientBaseService;
private final HphyArticleService hphyArticleService;
/** /**
* 初始化导医记录 * 初始化导医记录
...@@ -247,33 +246,56 @@ public class HphyGuideRecordServiceImpl extends ServiceImpl<HphyGuideRecordMappe ...@@ -247,33 +246,56 @@ public class HphyGuideRecordServiceImpl extends ServiceImpl<HphyGuideRecordMappe
return dtoList; return dtoList;
} }
/**
* @param guideId
* @param addX
* @param addY
* @param distence
* @param exp
* @param fre
* @return
* @throws UnsupportedEncodingException
*/
@Override @Override
public R getPythonResult(Long guideId) throws UnsupportedEncodingException { public R getPythonResult(Long guideId, String addX, String addY, String distence, String exp, String fre) throws UnsupportedEncodingException {
// 调用python程序分析 // 调用python程序分析
HphyGuideRecord guide = this.getById(guideId); HphyGuideRecord guide = this.getById(guideId);
if (null == guide || NumberUtil.isNullOrZero(guide.getId())) { if (null == guide || NumberUtil.isNullOrZero(guide.getId())) {
return new R().error("未找到导医记录!"); return new R().error("未找到导医记录!");
} }
if (StrUtil.isBlank(guide.getPyResult())) { // if (StrUtil.isBlank(guide.getPyResult())) {
HphyGuideRecord update = new HphyGuideRecord(); // }
update.setId(guideId); HphyGuideRecord update = new HphyGuideRecord();
HphyPatientBase patient = hphyPatientBaseService.getById(guide.getPatientId()); update.setId(guideId);
PythonDTO pydto = new PythonDTO(patient, new ArrayList<>(Arrays.asList(guide.getDisease().split(StringPool.SEMICOLON)))); HphyPatientBase patient = hphyPatientBaseService.getById(guide.getPatientId());
String pyResutl = PythonUtil.getDcotorMatchListForHP(JSONUtil.toJsonStr(pydto)); PythonDTO pydto = new PythonDTO(patient, new ArrayList<>(Arrays.asList(guide.getDisease().split(StringPool.SEMICOLON))));
update.setPyResult(pyResutl); pydto.setParam(addX, addY, distence, exp, fre);
update.setAge(patient.getAge()); String pyResutl = PythonUtil.getDcotorMatchListForHP(JSONUtil.toJsonStr(pydto));
guide.setPyResult(pyResutl); update.setPyResult(pyResutl);
this.updateById(update); update.setAge(patient.getAge());
} guide.setPyResult(pyResutl);
this.updateById(update);
if (JSONUtil.isJson(guide.getPyResult())) { if (JSONUtil.isJson(guide.getPyResult())) {
JSONObject obj = JSONUtil.parseObj(guide.getPyResult()); JSONObject obj = JSONUtil.parseObj(guide.getPyResult());
List<Long> articleIdList = JSON.parseArray(obj.getStr("atricle"), Long.class);
Map<String, Object> result = new HashMap<>();
if (CollUtil.isNotEmpty(articleIdList)) {
LambdaQueryWrapper<HphyArticle> articleWrapper = new LambdaQueryWrapper<>();
articleWrapper.in(HphyArticle::getId, articleIdList)
.select(HphyArticle.class, i -> (!i.getColumn().equals("content")))
.orderByDesc(HphyArticle::getCreateTime);
List<HphyArticle> articleList = hphyArticleService.list(articleWrapper);
result.put("articleList", articleList);
}
// indicator 0-字符串 1-json // indicator 0-字符串 1-json
if (Constant.STRING_YES.equals(obj.getStr("indicator"))) { if (Constant.STRING_YES.equals(obj.getStr("indicator"))) {
List<PythonResult> pythonList = JSON.parseArray(obj.getStr("data"), PythonResult.class); List<PythonResult> pythonList = JSON.parseArray(obj.getStr("data"), PythonResult.class);
List<DoctorMatchVO> resultList = hphyDoctorService.getRecommendList(guide, pythonList); List<DoctorMatchVO> resultList = hphyDoctorService.getRecommendList(guide, pythonList);
return new R(resultList).setBizCode(200); result.put("doctorList", resultList);
return new R(result).setBizCode(200);
} else { } else {
return new R(obj.getStr("data")).setBizCode(100); result.put("msg", obj.getStr("data"));
return new R(result).setBizCode(100);
} }
} else { } else {
return new R(guide.getPyResult()).setBizCode(100); return new R(guide.getPyResult()).setBizCode(100);
......
...@@ -21,7 +21,7 @@ public class PythonUtil { ...@@ -21,7 +21,7 @@ public class PythonUtil {
public static String getDcotorMatchListForHP(String params) throws UnsupportedEncodingException { public static String getDcotorMatchListForHP(String params) throws UnsupportedEncodingException {
log.error("py->syptomoList--->{}", params); log.error("py->syptomoList--->{}", params);
String url = "http://localhost:9003/hello?aa=" + params; String url = "http://173.18.1.63:9003/hello?aa=" + params;
String body = HttpRequest.post(url) String body = HttpRequest.post(url)
.setEncodeUrlParams(true) .setEncodeUrlParams(true)
.execute() .execute()
...@@ -40,7 +40,7 @@ public class PythonUtil { ...@@ -40,7 +40,7 @@ public class PythonUtil {
public static JSONArray getMatchLabel(String params) { public static JSONArray getMatchLabel(String params) {
log.error("getMatchLabel->params--->{}", params); log.error("getMatchLabel->params--->{}", params);
String url = "http://localhost:9004/hello?aa=" + params; String url = "http://173.18.1.63:9004/hello?aa=" + params;
String body = HttpRequest.post(url) String body = HttpRequest.post(url)
.setEncodeUrlParams(true) .setEncodeUrlParams(true)
.execute() .execute()
......
...@@ -25,9 +25,14 @@ public class PythonDTO { ...@@ -25,9 +25,14 @@ public class PythonDTO {
private String distence = "N"; private String distence = "N";
private String age = "N"; private String age = "N";
private String exp = "N"; private String exp = "N";
private List<String> add; private String fre = "N";
private List<String> appo; /**
* [纬度,经度]
*/
private List<String> add = new ArrayList<>();
private List<String> disease; private List<String> disease;
private List<String> reserve_list = new ArrayList<>();
private List<String> appo = new ArrayList<>();
private Object result; private Object result;
public PythonDTO(HphyPatientBase patient, List<String> disease) throws UnsupportedEncodingException { public PythonDTO(HphyPatientBase patient, List<String> disease) throws UnsupportedEncodingException {
...@@ -67,4 +72,22 @@ public class PythonDTO { ...@@ -67,4 +72,22 @@ public class PythonDTO {
}); });
} }
} }
public void setParam(String addX, String addY, String distence, String exp, String fre) {
if (StrUtil.isNotBlank(addX) && StrUtil.isNotBlank(addY)) {
List<String> list = new ArrayList<>();
list.add(addX);
list.add(addY);
this.add = list;
}
if(StrUtil.isNotBlank(distence)){
this.distence = distence;
}
if(StrUtil.isNotBlank(exp)){
this.exp = exp;
}
if(StrUtil.isNotBlank(fre)){
this.fre = fre;
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment