chenweida %!s(int64=7) %!d(string=hai) anos
pai
achega
2e8d0c981f

+ 0 - 124
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -103,12 +103,6 @@ public class ConsultTeamService extends ConsultService {
    private TalkGroupService talkGroupService;
    @Autowired
    private com.yihu.wlyy.service.common.account.DoctorService doctorService;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private MessageDao messageDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    WeiXinAccessTokenUtils accessTokenUtils;
@ -956,124 +950,6 @@ public class ConsultTeamService extends ConsultService {
            consultTeamDoctorDao.save(cd);
            //3、保存续方记录
            prescription.setConsult(ct.getConsult());
            prescriptionDao.save(prescription);
            // 保存医生咨询信息
            // 添加咨询转发记录
            // 添加医生咨询日志
            String content = addLogs(ct);
            return 1;
        }
    }
    /**
     * 添加续方咨询
     * @param jwCode
     * @param patient
     * @param agent
     * @param doctorCode
     * @param reason
     * @return
     */
    public Integer addPrescriptionConsult(String jwCode,String patient,String agent,String doctorCode,ConsultTeam ct,String reason) throws Exception {
        synchronized (jwCode.intern()){
            Doctor doctor = doctorDao.findByCode(doctorCode);
            // 查询患者信息
            Patient p = patientDao.findByCode(patient);
            //获取基位处方详情
            Prescription prescription = new Prescription();
            prescription.setCode(getCode());
            prescription.setHospitalName(doctor.getHospitalName());
            prescription.setHospital(doctor.getHospital());
            prescription.setAdminTeamId(ct.getAdminTeamId());
            prescription.setCreateTime(new Date());
            prescription.setDept(doctor.getDept());
            prescription.setDeptName(doctor.getDeptName());
            prescription.setDoctor(doctor.getCode());
            prescription.setDoctorName(doctor.getName());
            prescription.setJwCode(jwCode);
            prescription.setPatient(p.getCode());
            prescription.setPatientName(p.getName());
            prescription.setReason(reason);
            prescription.setType(2);
            prescription.setStatus(0);
            String symptoms = p.getName()+"申请续方\n体征信息:";
            //获取体征记录
            Iterable<PatientDevice> devices = patientDeviceDao.findByUser(patient);
            if(devices!=null||devices.iterator().hasNext()){
                int count = messageDao.findTzMessage(patient);
                symptoms +="最近七天有"+count+"条异常记录";
            }else{
                symptoms +="居民未绑定体征设备";
            }
            //获取上次续方时间:与平安的“智慧医保的审方系统”对接,判断居民上次续方时间,点击跳转上次续方记录。(此功能需与第三方系统对接,如果本次版本无法实现,则消息中不显示此条信息)
            //创建咨询
            JSONObject users = new JSONObject();//咨询参与者
            users.put(patient, 0);
            users.put(doctorCode, 0);
            if(patient.equals(agent)){
                agent = null;
            }
            ct.setDoctor(doctorCode);
            ct.setDoctorName(doctor.getName());
            // 设置患者信息
            ct.setPatient(patient);
            ct.setSymptoms(symptoms);
            // 设置患者姓名
            ct.setName(p.getName());
            // 设置患者生日
            ct.setBirthday(p.getBirthday());
            //新增性别
            ct.setSex(p.getSex());
            // 设置患者头像
            ct.setPhoto(p.getPhoto());
            // 设置操作日期
            ct.setCzrq(new Date());
            ct.setDel("1");
            ct.setStatus(0);
            // 医生未读数量为1
            ct.setDoctorRead(1);
            // 添加咨询记录
            Consult consult = addConsult(ct.getPatient(), null, ct.getSymptoms(), ct.getImages(), ct.getType());
            // 设置关联指导
            consult.setGuidance(ct.getGuidance());
            // 设置咨询标识
            ct.setConsult(consult.getCode());
            //推送给IM去创建议题,取得成员消息
            JSONObject messages = ImUtill.getCreateTopicMessage(patient, p.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages(),agent);
            //续方咨询的sessionid为居民code+续方code+咨询类型
            JSONObject obj = ImUtill.createTopics(patient + "_" + prescription.getCode() + "_" + ct.getType(), consult.getCode(), p.getName(), users, messages, ImUtill.SESSION_TYPE_PRESCRIPTION);
            if (obj == null) {
                throw new RuntimeException("IM消息发送异常!");
            }
            if(obj.getInt("status")==-1){//im议题创建失败
                throw new RuntimeException(obj.getString("message"));
            }
            ct.setStartMsgId(obj.get("start_msg_id").toString());
            consultTeamDao.save(ct);
            consultDao.save(consult);
            //记录咨询的医生详情
            ConsultTeamDoctor cd = new ConsultTeamDoctor();
            cd.setConsult(consult.getCode());
            cd.setDel("1");
            cd.setCzrq(new Date());
            cd.setTo(doctorCode);
            consultTeamDoctorDao.save(cd);
            //3、保存续方记录
            prescription.setConsult(ct.getConsult());
            prescriptionDao.save(prescription);

+ 1 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwSmjkService.java

@ -1048,10 +1048,9 @@ public class JwSmjkService {
     * 获取转诊预约医生列表
     * @param orgCode   机构编码
     * @param deptCode  科室编码
     * @param strCredential 身份证据
     * @return
     */
    public String getRegDeptSpeDoctorList(String orgCode, String deptCode, String strCredential) {
    public String getRegDeptSpeDoctorList(String orgCode, String deptCode) {
        String url = jwUrl + "/third/smjk/RegDeptSpeDoctorList";
        List<NameValuePair> params = new ArrayList<>();
@ -1064,7 +1063,6 @@ public class JwSmjkService {
        params.add(new BasicNameValuePair("deptCode", deptCode));
        params.add(new BasicNameValuePair("strStart", strStart));
        params.add(new BasicNameValuePair("strEnd", strEnd));
        params.add(new BasicNameValuePair("strCredential", strCredential));
        String response = HttpClientUtil.post(url, params, "UTF-8");
        return response;

+ 142 - 143
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java

@ -25,15 +25,15 @@ import java.util.*;
@RestController
@RequestMapping(value = "/wlyy_service")
@Api(description = "卫计委签约接口调试")
public class WlyySerivceController extends BaseController {
public class WlyySerivceController extends BaseController{
    @Autowired
    private GuahaoXMService guahaoXM;
    @Autowired
    private JwSmjkService jwSmjkService;
    @Autowired
    HttpUtil HttpUtil;
    private HttpUtil HttpUtil;
    /**
     * 检查是否签约
@ -41,19 +41,19 @@ public class WlyySerivceController extends BaseController {
     * @param idcard
     * @return
     */
    @RequestMapping(value = "/third/sign/CheckSignFamily", method = RequestMethod.POST)
    @RequestMapping(value = "/third/sign/CheckSignFamily",method = RequestMethod.POST)
    @ApiOperation("检查是否签约")
    public String checkSignFamily(@RequestParam("idcard") String idcard) {
        try {
    public String checkSignFamily(@RequestParam("idcard") String idcard){
        try{
            String checkUrl = SystemConf.getInstance().getJwUrl();
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/CheckSignFamily?idcard=" + idcard, "");
            if (StringUtils.isEmpty(jsonString)) {
                return write(-1, "调用失败");
            } else {
                return write(200, "调用成功", "data", jsonString);
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
            }else{
                return write(200,"调用成功","data",jsonString);
            }
        } catch (Exception e) {
            return error(-1, "调用失败");
        }catch (Exception e){
            return error(-1,"调用失败");
        }
    }
@ -63,20 +63,20 @@ public class WlyySerivceController extends BaseController {
     * @param code
     * @return
     */
    @RequestMapping(value = "/third/sign/UploadSignFamily", method = RequestMethod.POST)
    @RequestMapping(value = "/third/sign/UploadSignFamily",method = RequestMethod.POST)
    @ApiOperation("上传签约数据")
    public String uploadSignFamily(@RequestParam("code") String code) {
        try {
    public String uploadSignFamily(@RequestParam("code")String code){
        try{
            String checkUrl = SystemConf.getInstance().getJwUrl();
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/UploadSignFamily?code=" + code, "");
            if (StringUtils.isEmpty(jsonString)) {
                return write(-1, "调用失败");
            } else {
                return write(200, "调用成功", "data", jsonString);
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
            }else{
                return write(200,"调用成功","data",jsonString);
            }
        } catch (Exception e) {
        }catch (Exception e){
            e.printStackTrace();
            return error(-1, "调用失败");
            return error(-1,"调用失败");
        }
    }
@ -86,19 +86,19 @@ public class WlyySerivceController extends BaseController {
     * @param start_time
     * @return
     */
    @RequestMapping(value = "/third/sign/LoadAllSignFamily", method = RequestMethod.POST)
    @RequestMapping(value = "/third/sign/LoadAllSignFamily",method = RequestMethod.POST)
    @ApiOperation("初次采集签约接口")
    public String loadAllSignFamily(@RequestParam("start_time") String start_time) {
        try {
    public String loadAllSignFamily(@RequestParam("start_time")String start_time){
        try{
            String checkUrl = SystemConf.getInstance().getJwUrl();
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/LoadAllSignFamily?start_time=" + start_time, "");
            if (StringUtils.isEmpty(jsonString)) {
                return write(-1, "调用失败");
            } else {
                return write(200, "调用成功", "data", jsonString);
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
            }else{
                return write(200,"调用成功","data",jsonString);
            }
        } catch (Exception e) {
            return error(-1, "调用失败");
        }catch (Exception e){
            return error(-1,"调用失败");
        }
    }
@ -108,20 +108,20 @@ public class WlyySerivceController extends BaseController {
     * @param idcard
     * @return
     */
    @RequestMapping(value = "/third/sign/LoadSignFamily", method = RequestMethod.POST)
    @RequestMapping(value = "/third/sign/LoadSignFamily",method = RequestMethod.POST)
    @ApiOperation("单条采集签约接口")
    public String loadSingleSignFamily(@RequestParam("idcard") String idcard) {
        try {
    public String loadSingleSignFamily(@RequestParam("idcard")String idcard){
        try{
            String checkUrl = SystemConf.getInstance().getJwUrl();
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/LoadSignFamily?idcard=" + idcard, "");
            if (StringUtils.isEmpty(jsonString)) {
                return write(-1, "调用失败");
            } else {
                return write(200, "调用成功", "data", jsonString);
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
            }else{
                return write(200,"调用成功","data",jsonString);
            }
        } catch (Exception e) {
        }catch (Exception e){
            e.printStackTrace();
            return error(-1, "调用失败");
            return error(-1,"调用失败");
        }
    }
@ -132,19 +132,19 @@ public class WlyySerivceController extends BaseController {
     * @param end_time
     * @return
     */
    @RequestMapping(value = "/third/sign/LoadSignFamilyBatch", method = RequestMethod.POST)
    @RequestMapping(value = "/third/sign/LoadSignFamilyBatch",method = RequestMethod.POST)
    @ApiOperation("时间范围采集签约接口")
    public String loadSignFamilyBatch(@RequestParam("start_time") String start_time, @RequestParam("end_time") String end_time) {
        try {
    public String loadSignFamilyBatch(@RequestParam("start_time")String start_time,@RequestParam("end_time")String end_time){
        try{
            String checkUrl = SystemConf.getInstance().getJwUrl();
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/LoadSignFamilyBatch?start_time=" + start_time + "&end_time=" + end_time, "");
            if (StringUtils.isEmpty(jsonString)) {
                return write(-1, "调用失败");
            } else {
                return write(200, "调用成功", "data", jsonString);
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
            }else{
                return write(200,"调用成功","data",jsonString);
            }
        } catch (Exception e) {
            return error(-1, "调用失败");
        }catch (Exception e){
            return error(-1,"调用失败");
        }
    }
@ -153,19 +153,19 @@ public class WlyySerivceController extends BaseController {
     *
     * @return
     */
    @RequestMapping(value = "/third/sign/ReUploadSignFamily", method = RequestMethod.POST)
    public String reuploadSignFamily() {
        try {
    @RequestMapping(value = "/third/sign/ReUploadSignFamily",method = RequestMethod.POST)
    public String reuploadSignFamily(){
        try{
            String checkUrl = SystemConf.getInstance().getJwUrl();
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/ReUploadSignFamily", "");
            if (StringUtils.isEmpty(jsonString)) {
                return write(-1, "调用失败");
            } else {
                return write(200, "调用成功", "data", jsonString);
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
            }else{
                return write(200,"调用成功","data",jsonString);
            }
        } catch (Exception e) {
        }catch (Exception e){
            e.printStackTrace();
            return error(-1, "调用失败");
            return error(-1,"调用失败");
        }
    }
@ -174,37 +174,36 @@ public class WlyySerivceController extends BaseController {
     *
     * @return
     */
    @RequestMapping(value = "/third/sign/ReUpdateSignFamily", method = RequestMethod.POST)
    public String reupdateSignFamily() {
        try {
    @RequestMapping(value = "/third/sign/ReUpdateSignFamily",method = RequestMethod.POST)
    public String reupdateSignFamily(){
        try{
            String checkUrl = SystemConf.getInstance().getJwUrl();
            String jsonString = HttpUtil.sendPost(checkUrl + "/third/sign/ReUpdateSignFamily", "");
            if (StringUtils.isEmpty(jsonString)) {
                return write(-1, "调用失败");
            } else {
                return write(200, "调用成功", "data", jsonString);
            if(StringUtils.isEmpty(jsonString)){
                return write(-1,"调用失败");
            }else{
                return write(200,"调用成功","data",jsonString);
            }
        } catch (Exception e) {
            return error(-1, "调用失败");
        }catch (Exception e){
            return error(-1,"调用失败");
        }
    }
    /**
     * 转诊预约医生特殊号源获取
     *
     * @param OrgCode  医院编号
     * @param OrgCode 医院编号
     * @param DeptCode 科室编号
     * @param DocCode  医生编号
     * @param DocCode 医生编号
     * @return
     */
    @RequestMapping(value = "/third/smjk/RegDeptSpeDoctorSectionList", method = RequestMethod.POST)
    @RequestMapping(value = "/third/smjk/RegDeptSpeDoctorSectionList",method = RequestMethod.POST)
    @ApiOperation("转诊预约获取特殊号源接口")
    public String getSpeDoctorSectionList(@RequestParam("OrgCode") String OrgCode,
                                          @RequestParam("DeptCode") String DeptCode,
                                          @RequestParam("DocCode") String DocCode) {
        try {
            List<Map<String, Object>> list = guahaoXM.GetDoctorArrangeTenDay(OrgCode, DeptCode, DocCode);
                                          @RequestParam("DocCode") String DocCode){
        try{
            List<Map<String,Object>> list = guahaoXM.GetDoctorArrangeTenDay(OrgCode,DeptCode,DocCode);
            return write(200, "获取医生排班成功!", "data", list);
           /* *//*****modify by linz 暂时把号源转换成普通号源****//*
@ -214,107 +213,107 @@ public class WlyySerivceController extends BaseController {
                map.put("date",date.replaceAll("-","/"));
            }
            return write(200, "获取医生排班成功!", "data", list);*/
        } catch (Exception e) {
        }catch (Exception e){
            e.printStackTrace();
            return error(-1, "医生排班时间获取失败");
            return error(-1,"医生排班时间获取失败");
        }
    }
    /**
     * 获取转诊预约医生列表
     *
     * @param orgCode       机构编码
     * @param deptCode      科室编码
     * @param strCredential 身份证据
     * @param orgCode   机构编码
     * @param deptCode  科室编码
     * @return
     */
    @RequestMapping(value = "/third/smjk/RegDeptSpeDoctorList", method = RequestMethod.POST)
    @RequestMapping(value = "/third/smjk/RegDeptSpeDoctorList",method = RequestMethod.POST)
    @ApiOperation("获取转诊预约医生列表")
    @ResponseBody
    public String getRegDeptSpeDoctorList(
            @ApiParam(name = "orgCode", value = "机构编码") @RequestParam(name = "orgCode", required = true) String orgCode,
            @ApiParam(name = "deptCode", value = "科室编码") @RequestParam(name = "deptCode", required = true) String deptCode,
            @ApiParam(name = "strCredential", value = "身份证据") @RequestParam(name = "strCredential", required = true) String strCredential) {
            @ApiParam(name="orgCode",value="机构编码") @RequestParam(name="orgCode",required = true) String orgCode,
            @ApiParam(name="deptCode",value="科室编码") @RequestParam(name="deptCode",required = true) String deptCode){
        try {
            String list = jwSmjkService.getRegDeptSpeDoctorList(orgCode, deptCode, strCredential);
            //10天排班的医生列表
            //String list  = jwSmjkService.getRegDeptSpeDoctorList(orgCode,deptCode);
            //7天排班的医生列表
            String list = jwSmjkService.GetDoctorList(orgCode,deptCode);
            return write(200, "获取转诊预约医生列表成功!", "data", list);
        } catch (Exception ex) {
            ex.printStackTrace();
            return error(-1, "获取转诊预约医生列表列表失败");
            return error(-1,"获取转诊预约医生列表列表失败");
        }
    }
    /**
     * 转诊预约医生号源转换
     *
     * @param xml
     * @return
     */
    private List<Map<String, Object>> parseXmlForSpe(String xml) {
        List<Map<String, Object>> re = new ArrayList<>();
        Document document = null;
        try {
            document = DocumentHelper.parseText(xml);
        } catch (Exception e) {
            throw new RuntimeException("解析数据失败!");
        }
        Element root = document.getRootElement();
        List<?> child = root.elements();//取出root的子集合
        for (Object o : child) {
            List<?> dataList = ((Element) o).elements();
            for (Object dataElement : dataList) {
    private List<Map<String,Object>>  parseXmlForSpe(String xml) {
            List<Map<String,Object>> re = new ArrayList<>();
            Document document = null;
            try{
                 document = DocumentHelper.parseText(xml);
             }catch (Exception e){
                throw new RuntimeException("解析数据失败!");
            }
            Element root = document.getRootElement();
            List<?> child = root.elements();//取出root的子集合
            for (Object o : child) {
                List<?> dataList = ((Element) o).elements();
                for(Object dataElement:dataList) {
                Element e = (Element) dataElement;
                // 日期
                String date = e.attributeValue("date");
                // a或者p
                String time = e.attributeValue("time");
                // 限号
                String max = e.attributeValue("max");
                // 已使用的号
                String used = e.attributeValue("used");
                // 1正常、2满号、3已过期
                String status = e.attributeValue("status");
                Map<String, Object> map = new HashMap<>();
                map.put("date", date);
                map.put("time", time);
                map.put("max", max);
                map.put("used", used);
                map.put("status", status);
                // 排班信息
                List<?> sections = e.elements();
                List<Map<String, String>> arrangeList = new ArrayList<>();
                for (Object s : sections) {
                    Element section = (Element) s;
                    Element e = (Element) dataElement;
                    // 日期
                    String date = e.attributeValue("date");
                    // a或者p
                    String time = e.attributeValue("time");
                    // 限号
                    String s_max = section.attributeValue("max");
                    String max = e.attributeValue("max");
                    // 已使用的号
                    String s_used = section.attributeValue("used");
                    // 一次专家坐诊时间段的开始时间
                    String start_time = section.attributeValue("start_time");
                    // 结束时间
                    String end_time = section.attributeValue("end_time");
                    String used = e.attributeValue("used");
                    // 1正常、2满号、3已过期
                    String status = e.attributeValue("status");
                    Map<String, Object> map = new HashMap<>();
                    map.put("date", date);
                    map.put("time", time);
                    map.put("max", max);
                    map.put("used", used);
                    map.put("status", status);
                    // 排班信息
                    List<?> sections = e.elements();
                    List<Map<String, String>> arrangeList = new ArrayList<>();
                    for (Object s : sections) {
                        Element section = (Element) s;
                        // 限号
                        String s_max = section.attributeValue("max");
                        // 已使用的号
                        String s_used = section.attributeValue("used");
                        // 一次专家坐诊时间段的开始时间
                        String start_time = section.attributeValue("start_time");
                        // 结束时间
                        String end_time = section.attributeValue("end_time");
                    Map<String, String> item = new HashMap<>();
                    item.put("max", s_max);
                    item.put("used", s_used);
                    item.put("startTime", start_time);
                    item.put("endTime", end_time);
                    arrangeList.add(item);
                        Map<String, String> item = new HashMap<>();
                        item.put("max", s_max);
                        item.put("used", s_used);
                        item.put("startTime", start_time);
                        item.put("endTime", end_time);
                        arrangeList.add(item);
                    }
                    map.put("sections", arrangeList);
                    re.add(map);
                }
                map.put("sections", arrangeList);
                re.add(map);
            }
            return  re;
        }
        return re;
    }
    public static Date getDateAfter(Date d, int day) {
        Calendar now = Calendar.getInstance();
        now.setTime(d);
        now.set(Calendar.DATE, now.get(Calendar.DATE) + day);
        return now.getTime();
    }
        public static Date getDateAfter(Date d, int day) {
            Calendar now = Calendar.getInstance();
            now.setTime(d);
            now.set(Calendar.DATE, now.get(Calendar.DATE) + day);
            return now.getTime();
      }
}

+ 59 - 55
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -4,8 +4,11 @@ import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.ConsultTeamLog;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.consult.DoctorCommentService;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
@ -18,6 +21,7 @@ import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -57,20 +61,18 @@ public class ConsultController extends WeixinBaseController {
    @Autowired
    private DoctorWorkTimeService doctorWorkTimeService;
    @Autowired
    private  PatientDao patientDao;
    private PatientDao patientDao;
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private ImUtill ImUtill;
    @Autowired
    private HttpUtil httpUtil; @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private DoctorDao doctorDao;
    private HttpUtil httpUtil;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private DoctorDao doctorDao;
    /**
     * 患者咨询记录查询
     *
@ -263,14 +265,15 @@ public class ConsultController extends WeixinBaseController {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "isPrescriptionConsult",method = RequestMethod.GET)
    @RequestMapping(value = "isPrescriptionConsult", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("是否可以续方咨询")
    public String isPrescriptConsult(String patient){
        try{
    public String isPrescriptConsult(String patient) {
        try {
            SignFamily signFamily = signFamilyDao.findByPatient(patient);
            if(signFamily==null){
                return error(-1,"您还未签约,不能发起续方咨询!");
            if (signFamily == null) {
                return error(-1, "您还未签约,不能发起续方咨询!");
            }
            //点击后判断,如果用户当前存在可申请续方的处方记录,则进入续方申请流程,若不存在可续方记录,alert“当前没有可以申请续方的处方记录”
@ -278,21 +281,21 @@ public class ConsultController extends WeixinBaseController {
            Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
            JSONObject json = new JSONObject();
            json.put("doctor",doctor.getCode());
            json.put("doctorName",doctor.getName());
            json.put("adminTeamId",signFamily.getAdminTeamId());
            json.put("hospital",doctor.getHospital());
            json.put("hospitalName",doctor.getHospitalName());
            json.put("doctor", doctor.getCode());
            json.put("doctorName", doctor.getName());
            json.put("adminTeamId", signFamily.getAdminTeamId());
            json.put("hospital", doctor.getHospital());
            json.put("hospitalName", doctor.getHospitalName());
            return write(200, "查询成功!", "data", json);
        }catch (Exception e){
        } catch (Exception e) {
            error(e);
            return error(-1,"查询失败");
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "addPrescriptionConsult",method = RequestMethod.POST)
    @RequestMapping(value = "addPrescriptionConsult", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("添加续方咨询")
    public String addPrescriptionConsult(@ApiParam(name = "patient", value = "居民code", defaultValue = "1")
@ -304,14 +307,14 @@ public class ConsultController extends WeixinBaseController {
                                         @ApiParam(name = "adminTeamId", value = "签约行政团队id", defaultValue = "224")
                                         @RequestParam(value = "adminTeamId", required = true) Long adminTeamId,
                                         @ApiParam(name = "reason", value = "续方说明", defaultValue = "续方申请")
                                         @RequestParam(value = "reason", required = false) String reason){
        try{
                                         @RequestParam(value = "reason", required = false) String reason) {
        try {
            ConsultTeam consult = new ConsultTeam();
            consult.setType(8);//续方咨询
            consult.setAdminTeamId(adminTeamId);
            // 保存到数据库
            int res = consultTeamService.addPrescriptionConsult(jwCode, "a663d0cf7f8c4d38a8327cedc921e65f","a663d0cf7f8c4d38a8327cedc921e65f",doctor,consult,reason);
//            int res = consultTeamService.addPrescriptionConsult(jwCode, getRepUID(),getUID(),doctor,consult,reason);
            // int res = consultTeamService.addPrescriptionConsult(jwCode, "a663d0cf7f8c4d38a8327cedc921e65f", "a663d0cf7f8c4d38a8327cedc921e65f", doctor, consult, reason);
            int res = consultTeamService.addPrescriptionConsult(jwCode, getRepUID(), getUID(), doctor, consult, reason);
            if (res == -1) {
                return error(-1, "家庭签约信息不存在或已过期,无法进行家庭医生咨询!");
            }
@ -327,9 +330,9 @@ public class ConsultController extends WeixinBaseController {
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getRepUID(), getUID(), new JSONObject(consult));
            return write(200, "提交成功", "data", consult);
        }catch (Exception e){
        } catch (Exception e) {
            error(e);
            return error(-1,"添加失败");
            return error(-1, "添加失败");
        }
    }
@ -352,8 +355,8 @@ public class ConsultController extends WeixinBaseController {
                      @RequestParam(required = false) String voice,
                      @RequestParam(required = false) Long guidance) {
        try {
            System.out.println("guidance1="+guidance);
            System.out.println("symptoms="+symptoms);
            System.out.println("guidance1=" + guidance);
            System.out.println("symptoms=" + symptoms);
            if (type == null) {
                type = 1;
            }
@ -397,9 +400,9 @@ public class ConsultController extends WeixinBaseController {
                consult.setGuidance(guidance);
            }
            System.out.println("guidance2="+guidance);
            System.out.println("guidance2=" + guidance);
            // 保存到数据库
            int res = consultTeamService.addTeamConsult(consult, getRepUID(),getUID());
            int res = consultTeamService.addTeamConsult(consult, getRepUID(), getUID());
            if (res == -1) {
                return error(-1, "家庭签约信息不存在或已过期,无法进行家庭医生咨询!");
            } else if (res == -2) {
@ -428,23 +431,23 @@ public class ConsultController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "intoTopic",method = RequestMethod.POST)
    @RequestMapping(value = "intoTopic", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("进入咨询")
    public String intoTopic(@RequestParam(required = true) String consult){
        try{
            int result = consultTeamService.intoTopic(consult,getRepUID(),getUID());
            if(result==-1){
                return error(-1,"该咨询不是进行中");
    public String intoTopic(@RequestParam(required = true) String consult) {
        try {
            int result = consultTeamService.intoTopic(consult, getRepUID(), getUID());
            if (result == -1) {
                return error(-1, "该咨询不是进行中");
            }
            JSONObject json = new JSONObject();
            json.put("consult",consult);
            json.put("content","进入咨询");
            json.put("consult", consult);
            json.put("content", "进入咨询");
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getUID(), getRepUID(), json);
            return success("进入成功");
        }catch (Exception e){
        } catch (Exception e) {
            error(e);
            return error(-1,"请求失败");
            return error(-1, "请求失败");
        }
    }
@ -507,9 +510,9 @@ public class ConsultController extends WeixinBaseController {
            consult.setVoice(voice);
            consult.setDoctor(doctorCode);//设置专科医生
            // 保存到数据库
            JSONObject object  = consultTeamService.famousConsult(consult, getRepUID(), "1",getUID());
            JSONObject resultConsult =  new JSONObject(consult);
            resultConsult.put("session_id",object.getString("session_id"));
            JSONObject object = consultTeamService.famousConsult(consult, getRepUID(), "1", getUID());
            JSONObject resultConsult = new JSONObject(consult);
            resultConsult.put("session_id", object.getString("session_id"));
            //名医咨询次数减一
            doctorWorkTimeService.setDoctorCurrentConsultTimesRemain(doctorCode);
            // 推送消息给医生
@ -775,10 +778,10 @@ public class ConsultController extends WeixinBaseController {
            int i = 0;
            List<String> failed = new ArrayList<>();
            String agent = getUID()==getRepUID()?null:getUID();
            String agent = getUID() == getRepUID() ? null : getUID();
            for (ConsultTeamLog log : logs) {
//                String response = ImUtill.sendTopicIM(getUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent());
                String response = ImUtill.sendTopicIM(getRepUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent(),agent);
                String response = ImUtill.sendTopicIM(getRepUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent(), agent);
                if (StringUtils.isNotEmpty(response)) {
                    JSONObject resObj = new JSONObject(response);
                    if (resObj.getInt("status") == -1) {
@ -813,7 +816,7 @@ public class ConsultController extends WeixinBaseController {
            JSONObject messageObj = ImUtill.getTopicMessage(consultModel.getConsult(), consultModel.getStartMsgId(), consultModel.getEndMsgId(), page, pagesize, getRepUID());
            //过滤续签
            consultTeamService.removeRenewPerson(messageObj,getRepUID());
            consultTeamService.removeRenewPerson(messageObj, getRepUID());
            return write(200, "查询成功", "list", messageObj);
        } catch (Exception e) {
@ -830,7 +833,7 @@ public class ConsultController extends WeixinBaseController {
     */
    @RequestMapping(value = "logs")
    @ResponseBody
    public String logs(@RequestParam String sessionId,@RequestParam(required = false) String startMsgId,@RequestParam(required = false) String endMsgId, @RequestParam int page, @RequestParam int pagesize) {
    public String logs(@RequestParam String sessionId, @RequestParam(required = false) String startMsgId, @RequestParam(required = false) String endMsgId, @RequestParam int page, @RequestParam int pagesize) {
        try {
            JSONArray messageArray = ImUtill.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getRepUID());
            return write(200, "查询成功", "list", messageArray);
@ -847,7 +850,7 @@ public class ConsultController extends WeixinBaseController {
            JSONArray participants = ImUtill.getSessions(sessionId);
            //过滤续签
            consultTeamService.removeRenewPerson(participants,getRepUID());
            consultTeamService.removeRenewPerson(participants, getRepUID());
            return write(200, "查询成功", "list", participants);
        } catch (Exception e) {
@ -874,7 +877,7 @@ public class ConsultController extends WeixinBaseController {
            String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
                    + "api/v1/chats/message";
            String reG = HttpUtil.sendGet(url, "id=" + logId + "&type=" + msgType);
            String reG = httpUtil.sendGet(url, "id=" + logId + "&type=" + msgType);
            JSONObject obj = null;
            if (!org.springframework.util.StringUtils.isEmpty(reG)) {
                obj = new JSONObject(new String(reG.getBytes(), "utf-8"));
@ -958,21 +961,22 @@ public class ConsultController extends WeixinBaseController {
    @RequestMapping(value = "getTopic")
    @ResponseBody
    public String getTopic(String consult){
        try{
    public String getTopic(String consult) {
        try {
            return success(ImUtill.getTopic(consult).get("data").toString());
        }catch (Exception e){
            return error(-1,e.getMessage());
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "getConsult")
    @ResponseBody
    public String getConsult(String consult){
        try{
    public String getConsult(String consult) {
        try {
            ConsultTeam consultTeam = consultTeamService.findByConsultCode(consult);
            return write(200, "查询成功", "data", consultTeam);
        }catch (Exception e){
            return error(-1,e.getMessage());
        } catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }
}

+ 4 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -194,7 +194,10 @@ public class BookingController extends WeixinBaseController {
                                @RequestParam(value = "pageSize", required = false) Integer pageSize) {
        try {
//            List<GuahaoDoctor> list = getService(city).GetDoctorList(hospitalId, hosDeptId, filter, pageIndex, pageSize);
            String list = jwSmjkService.GetDoctorList(hospitalId,hosDeptId);
            //String list = jwSmjkService.GetDoctorList(hospitalId,hosDeptId);
            //huangwenjie--2017.07.28--修改成基卫获取10天排班的医生列表接口
            String list  = jwSmjkService.getRegDeptSpeDoctorList(hospitalId,hosDeptId);
            return list;
        } catch (Exception e) {
            return error(-1, e.getMessage());