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

调整导医参数

调整导医返回结构
parent 9cd218f6
......@@ -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.R;
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.handler.WebSocketServer;
import cn.sh.stc.sict.theme.hphy.constant.PatientConstant;
......@@ -22,6 +21,7 @@ import cn.sh.stc.sict.theme.hphy.util.PythonUtil;
import cn.sh.stc.sict.theme.hphy.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.transaction.annotation.Transactional;
......@@ -144,11 +144,12 @@ public class HphyEvaController {
@ApiOperation("调用python程序")
@GetMapping("/python/result")
public R getPythonResult(@RequestParam("guideId") Long guideId,
@RequestParam("")String a,
@RequestParam("")String b,
@RequestParam("")String c,
@RequestParam("")String d) throws UnsupportedEncodingException {
return hphyGuideRecordService.getPythonResult(guideId);
@ApiParam("纬度") @RequestParam(value = "addX",required = false)String addX,
@ApiParam("经度") @RequestParam(value = "addY",required = false)String addY,
@ApiParam("是否距离优先 Y-是") @RequestParam(value = "distence", defaultValue = "N", required = false)String distence,
@ApiParam("是否高龄医生优先 H-是") @RequestParam(value = "exp",defaultValue = "N", required = false)String exp,
@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.*;
@RequestMapping("/hphy/c/patientbase")
@AllArgsConstructor
@Slf4j
@Api(tags = "[D]患者基本信息")
@Api(tags = "[C]患者基本信息")
public class HphyPatientBaseController {
private HphyPatientBaseService hphyPatientBaseService;
......
......@@ -17,24 +17,24 @@ import java.util.List;
@Component
public class RefreshJob {
@Scheduled(cron = "")
public void updateHosp(){
HosInfo hosInfo = new HosInfo();
List<HosInfo> list = WanDaHttpUtil.getHospitalInfo(hosInfo);
}
@Scheduled(cron = "")
public void updateDeptTop(){
}
@Scheduled(cron = "")
public void updateDeptTwo(){
}
@Scheduled(cron = "")
public void updateDocInfo(){
}
// @Scheduled(cron = "")
// public void updateHosp(){
// HosInfo hosInfo = new HosInfo();
// List<HosInfo> list = WanDaHttpUtil.getHospitalInfo(hosInfo);
// }
//
// @Scheduled(cron = "")
// public void updateDeptTop(){
//
// }
//
// @Scheduled(cron = "")
// public void updateDeptTwo(){
//
// }
//
// @Scheduled(cron = "")
// public void updateDocInfo(){
//
// }
}
......@@ -26,7 +26,7 @@ public interface HphyGuideRecordService extends IService<HphyGuideRecord> {
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);
}
......
......@@ -2,13 +2,14 @@ package cn.sh.stc.sict.theme.hphy.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
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.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.dao.HphyGuideRecordMapper;
import cn.sh.stc.sict.theme.hphy.model.HphyGuideRecord;
......@@ -29,10 +30,7 @@ import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
......@@ -44,6 +42,7 @@ public class HphyGuideRecordServiceImpl extends ServiceImpl<HphyGuideRecordMappe
private final HphyGuideRecordMapper hphyGuideRecordMapper;
private final HphyDoctorService hphyDoctorService;
private final HphyPatientBaseService hphyPatientBaseService;
private final HphyArticleService hphyArticleService;
/**
* 初始化导医记录
......@@ -247,33 +246,56 @@ public class HphyGuideRecordServiceImpl extends ServiceImpl<HphyGuideRecordMappe
return dtoList;
}
/**
* @param guideId
* @param addX
* @param addY
* @param distence
* @param exp
* @param fre
* @return
* @throws UnsupportedEncodingException
*/
@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程序分析
HphyGuideRecord guide = this.getById(guideId);
if (null == guide || NumberUtil.isNullOrZero(guide.getId())) {
return new R().error("未找到导医记录!");
}
if (StrUtil.isBlank(guide.getPyResult())) {
// if (StrUtil.isBlank(guide.getPyResult())) {
// }
HphyGuideRecord update = new HphyGuideRecord();
update.setId(guideId);
HphyPatientBase patient = hphyPatientBaseService.getById(guide.getPatientId());
PythonDTO pydto = new PythonDTO(patient, new ArrayList<>(Arrays.asList(guide.getDisease().split(StringPool.SEMICOLON))));
pydto.setParam(addX, addY, distence, exp, fre);
String pyResutl = PythonUtil.getDcotorMatchListForHP(JSONUtil.toJsonStr(pydto));
update.setPyResult(pyResutl);
update.setAge(patient.getAge());
guide.setPyResult(pyResutl);
this.updateById(update);
}
if (JSONUtil.isJson(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
if (Constant.STRING_YES.equals(obj.getStr("indicator"))) {
List<PythonResult> pythonList = JSON.parseArray(obj.getStr("data"), PythonResult.class);
List<DoctorMatchVO> resultList = hphyDoctorService.getRecommendList(guide, pythonList);
return new R(resultList).setBizCode(200);
result.put("doctorList", resultList);
return new R(result).setBizCode(200);
} else {
return new R(obj.getStr("data")).setBizCode(100);
result.put("msg", obj.getStr("data"));
return new R(result).setBizCode(100);
}
} else {
return new R(guide.getPyResult()).setBizCode(100);
......
......@@ -21,7 +21,7 @@ public class PythonUtil {
public static String getDcotorMatchListForHP(String params) throws UnsupportedEncodingException {
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)
.setEncodeUrlParams(true)
.execute()
......@@ -40,7 +40,7 @@ public class PythonUtil {
public static JSONArray getMatchLabel(String 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)
.setEncodeUrlParams(true)
.execute()
......
......@@ -25,9 +25,14 @@ public class PythonDTO {
private String distence = "N";
private String age = "N";
private String exp = "N";
private List<String> add;
private List<String> appo;
private String fre = "N";
/**
* [纬度,经度]
*/
private List<String> add = new ArrayList<>();
private List<String> disease;
private List<String> reserve_list = new ArrayList<>();
private List<String> appo = new ArrayList<>();
private Object result;
public PythonDTO(HphyPatientBase patient, List<String> disease) throws UnsupportedEncodingException {
......@@ -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