Переглянути джерело

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

liuwenbin 7 роки тому
батько
коміт
940aa904ef

+ 1 - 1
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/message/HealthMessageJob.java

@ -95,7 +95,7 @@ public class HealthMessageJob implements Job {
                String teamLeader=jdbcTemplate.queryForObject(sql,String.class,entry.getKey());
                String teamLeader=jdbcTemplate.queryForObject(sql,String.class,entry.getKey());
                Message message=new Message();
                Message message=new Message();
                message.setType(3);
                message.setType(3);
                message.setRead(0);
                message.setRead(1);
                message.setOver("0");
                message.setOver("0");
                message.setDel("1");
                message.setDel("1");
                message.setSender("system");
                message.setSender("system");

Різницю між файлами не показано, бо вона завелика
+ 11 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/message/Message.java


+ 14 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/patient/prescription/PrescriptionLog.java

@ -24,12 +24,24 @@ public class PrescriptionLog extends IdEntity {
        static public Integer expressage = 6;   //配送
        static public Integer expressage = 6;   //配送
        static public Integer finish = 7;   //已完成
        static public Integer finish = 7;   //已完成
    }
    }
    public final static class PrescriptionLogStatus {
        static public Integer no_reviewed =-1; //审核不通过
        static public Integer revieweding = 0;  //审核中
        static public Integer reviewed_success = 10;   //审核通过/待支付
        static public Integer pay_success = 20;  //支付成功/配药中
        static public Integer pay_error  = 21;    //21支付失败
        static public Integer wait_expressage = 30;   //配药成功/等待领药
        static public Integer expressageing = 31;   //配送中
        static public Integer expressageing_error = 32;   //配送失败
        static public Integer finish = 100;   //结束
    }
    private String code;                    //业务流程
    private String code;                    //业务流程
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private String prescriptionCode;      //处方code 关联表wlyy_prescription code
    private Date createTime;               //处方创建时间
    private Date createTime;               //处方创建时间
    private Integer status;                  //状态 (-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成)
    private Integer type;                //类型: 1智业对接 2易联众对接  3创建处方 4 审核  5付款 6 配送 7完成
    private Integer status;                  //状态 (-1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,20 配药中/支付成功  , 21支付失败  , 30 配药成功/等待领药 ,31 配送中 32 配送失败,100配送成功/已完成)
    private Integer type;                   //类型: 1智业对接 2易联众对接  3创建处方 4 审核  5付款 6 配送 7完成
    private String userCode;                  //医生或者患者code
    private String userCode;                  //医生或者患者code
    private String userName;                  //医生或者患者name
    private String userName;                  //医生或者患者name
    private Integer userType;                 //1 患者 2医生
    private Integer userType;                 //1 患者 2医生

+ 7 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -6,6 +6,7 @@
package com.yihu.wlyy.repository.message;
package com.yihu.wlyy.repository.message;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.message.Message;
import io.swagger.models.auth.In;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Pageable;
@ -51,10 +52,13 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("update Message a set a.read = 0 where a.receiver = ?1 and a.sender=?2 and a.tzType=?3")
    @Query("update Message a set a.read = 0 where a.receiver = ?1 and a.sender=?2 and a.tzType=?3")
    int updateHealthIndexMessageByPatient(String doctor,String patient,String type);
    int updateHealthIndexMessageByPatient(String doctor,String patient,String type);
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2) order by a.czrq desc")
    @Query("select a from Message a where a.read= 1 and a.receiver = ?1 and a.type not in (1,2,6) order by a.czrq desc")
    List<Message> getSystemMessageUnread(String doctor);
    List<Message> getSystemMessageUnread(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2)")
    @Query("select a from Message a where a.receiver = ?1 and a.read=?2 and a.type=?3 order by a.createTime desc")
    List<Message> getSysTemMessageByTypeAndRead(String doctor, Integer read, Integer type);
    @Query("select a from Message a where a.receiver = ?1 and a.type not in (1,2,6)")
    List<Message> getSystemMessage(String doctor,Pageable pageRequest);
    List<Message> getSystemMessage(String doctor,Pageable pageRequest);
@ -66,7 +70,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Modifying
    @Modifying
    int setMessageReaded(String doctor,Integer type);
    int setMessageReaded(String doctor,Integer type);
    @Query("update Message a set a.read = 0,a.over = '0' where a.receiver = ?1 and a.type not in (1,2)")
    @Query("update Message a set a.read = 0,a.over = '0' where a.receiver = ?1 and a.type not in (1,2,6)")
    @Modifying
    @Modifying
    int setSysMessageReaded(String doctor);
    int setSysMessageReaded(String doctor);

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

@ -10,6 +10,7 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientFamilyMember;
import com.yihu.wlyy.entity.patient.PatientFamilyMember;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamily;
@ -882,18 +883,20 @@ public class ConsultTeamService extends ConsultService {
            Prescription prescription = new Prescription();
            Prescription prescription = new Prescription();
            savePrescription(prescription,jwCode,doctor,p,ct,reason);
            savePrescription(prescription,jwCode,doctor,p,ct,reason);
            String symptoms = p.getName()+"申请续方\n体征信息:";
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("title",p.getName()+"申请续方");
            //获取体征记录
            //获取体征记录
            Iterable<PatientDevice> devices = patientDeviceDao.findByUser(patient);
            Iterable<PatientDevice> devices = patientDeviceDao.findByUser(patient);
            if(devices!=null||devices.iterator().hasNext()){
            if(devices!=null||devices.iterator().hasNext()){
                int count = messageDao.findTzMessage(patient);
                int count = messageDao.findTzMessage(patient);
                symptoms +="最近七天有"+count+"条异常记录";
                jsonObject.put("tzMsg","最近七天有"+count+"条异常记录");
            }else{
            }else{
                symptoms +="居民未绑定体征设备";
                jsonObject.put("tzMsg","居民未绑定体征设备");
            }
            }
            //获取上次续方时间:与平安的“智慧医保的审方系统”对接,判断居民上次续方时间,点击跳转上次续方记录。(此功能需与第三方系统对接,如果本次版本无法实现,则消息中不显示此条信息)
            //获取上次续方时间:与平安的“智慧医保的审方系统”对接,判断居民上次续方时间,点击跳转上次续方记录。(此功能需与第三方系统对接,如果本次版本无法实现,则消息中不显示此条信息)
            jsonObject.put("lastTime","");
            String symptoms = jsonObject.toString();
            //创建咨询
            //创建咨询
            JSONObject users = new JSONObject();//咨询参与者
            JSONObject users = new JSONObject();//咨询参与者
@ -956,6 +959,9 @@ public class ConsultTeamService extends ConsultService {
            cd.setTo(doctorCode);
            cd.setTo(doctorCode);
            consultTeamDoctorDao.save(cd);
            consultTeamDoctorDao.save(cd);
            //发送系统消息提示团队长有未审核的消息
            addCheckMessage(prescription,p);
            // 保存医生咨询信息
            // 保存医生咨询信息
            // 添加咨询转发记录
            // 添加咨询转发记录
            // 添加医生咨询日志
            // 添加医生咨询日志
@ -965,6 +971,32 @@ public class ConsultTeamService extends ConsultService {
        }
        }
    }
    }
    /**
     * 保存审核提醒消息
     * @param prescription
     * @param patient
     */
    public void addCheckMessage(Prescription prescription,Patient patient){
        Message message = new Message();
        message.setCzrq(new Date());
        message.setCreateTime(new Date());
        message.setRead(1);//设置未读
        message.setOver("1");
        message.setReceiver(prescription.getDoctor());
        message.setSender(prescription.getPatient());
        message.setCode(getCode());
        message.setSex(patient.getSex());
        message.setSenderName(patient.getName());
        message.setSenderPhoto(patient.getPhoto());
        message.setTitle("续方申请");
        message.setContent("您有一条新的续方申请待处理!");
        message.setType(6);//续方咨询待审核提醒
        message.setReadonly(1);//是否只读消息
        message.setDel("1");
        message.setRelationCode(prescription.getConsult());
        messageDao.save(message);
    }
    /**
    /**
     * 保存续方信息
     * 保存续方信息
     * @param prescription
     * @param prescription

+ 17 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -11,7 +11,6 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.SystemConf;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -152,11 +151,28 @@ public class MessageService extends BaseService {
            systemJson.put("amount", 0);
            systemJson.put("amount", 0);
        }
        }
        //获取续方消息
        List<Message> prescriptionMessage = messageDao.getSysTemMessageByTypeAndRead(doctor,1,6);
        JSONObject prescriptionJson = new JSONObject();
        if (prescriptionMessage != null && prescriptionMessage.size() > 0) {
            prescriptionJson.put("amount", prescriptionMessage.size());
            JSONObject msgJson = new JSONObject();
            msgJson.put("title", systemMessage.get(0).getTitle());
            msgJson.put("type", systemMessage.get(0).getType());
            msgJson.put("msg", systemMessage.get(0).getContent());
            msgJson.put("msgTime", DateUtil.dateToStrLong(systemMessage.get(0).getCreateTime()));
            prescriptionJson.put("lastMessage", msgJson);
        } else {
            prescriptionJson.put("amount", 0);
        }
        JSONObject json = new JSONObject();
        JSONObject json = new JSONObject();
        json.put("imMsgCount", getImMsgAmount(doctor));//IM消息数量
        json.put("imMsgCount", getImMsgAmount(doctor));//IM消息数量
        json.put("sign", signJson);//签约数
        json.put("sign", signJson);//签约数
        json.put("healthIndex", indexJson);//健康指标
        json.put("healthIndex", indexJson);//健康指标
        json.put("system", systemJson);//系统消息
        json.put("system", systemJson);//系统消息
        json.put("prescription", prescriptionJson);//续方消息
        return json;
        return json;
    }
    }

+ 24 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -58,25 +58,45 @@ public class PrescriptionExpressageService {
            prescriptionLog.setFlag(1);
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setUserType(2);
            prescriptionLog.setType(42);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error);
            prescriptionLog.setRemark("配送失败,处方编码不存在");
            prescriptionLog.setRemark("配送失败,处方编码不存在");
            prescriptionLogDao.save(prescriptionLog);
            prescriptionLogDao.save(prescriptionLog);
            return -1;
            return -1;
        }
        }
        //判断是否是取药码
        if (prescriptionDispensaryCode.getType() != 2) {
            //保存取药失败的日志
            PrescriptionLog prescriptionLog = new PrescriptionLog();
            prescriptionLog.setCode(UUID.randomUUID().toString());
            prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            prescriptionLog.setCreateTime(new Date());
            prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage);
            prescriptionLog.setFlag(1);
            prescriptionLog.setUserCode(userCode);
            prescriptionLog.setUserType(2);
            prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.expressageing_error);
            prescriptionLog.setRemark("配送失败,处方编码不是取药码");
            prescriptionLogDao.save(prescriptionLog);
            return -1;
        }
        //修改处方状态为完成
        //修改处方状态为完成
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(),100);
        prescriptionDao.updateStatus(prescriptionDispensaryCode.getPrescriptionCode(), 100);
        //保存配送成功的日志
        //保存配送成功的日志
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        PrescriptionLog prescriptionLog = new PrescriptionLog();
        prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionLog.setPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setCode(UUID.randomUUID().toString());
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.expressage);
        prescriptionLog.setType(PrescriptionLog.PrescriptionLogType.finish);
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setCreateTime(new Date());
        prescriptionLog.setFlag(1);
        prescriptionLog.setFlag(1);
        prescriptionLog.setUserCode(userCode);
        prescriptionLog.setUserCode(userCode);
        prescriptionLog.setUserType(2);
        prescriptionLog.setUserType(2);
        prescriptionLog.setType(100);
        prescriptionLog.setStatus(PrescriptionLog.PrescriptionLogStatus.finish);
        prescriptionLogDao.save(prescriptionLog);
        prescriptionLogDao.save(prescriptionLog);
        //修改取药码code为已经使用
        prescriptionDispensaryCode.setIsUse(1);
        return 1;
        return 1;
    }
    }
}
}

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/message/DoctorMessageController.java

@ -210,6 +210,7 @@ public class DoctorMessageController extends BaseController {
            return write(200, "获取超标指标消息成功", "data", list);
            return write(200, "获取超标指标消息成功", "data", list);
        } catch (Exception ex) {
        } catch (Exception ex) {
            ex.printStackTrace();
            return invalidUserException(ex, -1, "查询失败");
            return invalidUserException(ex, -1, "查询失败");
        }
        }
    }
    }

+ 24 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionCodeController.java

@ -25,6 +25,8 @@ public class PrescriptionCodeController extends BaseController{
    @Autowired
    @Autowired
    private PrescriptionDispensaryCodeService prescriptionDispensaryCodeService;
    private PrescriptionDispensaryCodeService prescriptionDispensaryCodeService;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    /**
    /**
     * 显示健管师(配送员)所有的取药码列表
     * 显示健管师(配送员)所有的取药码列表
     * @param status 处方状态
     * @param status 处方状态
@ -78,4 +80,26 @@ public class PrescriptionCodeController extends BaseController{
    }
    }
    /**
     * 确认配送 二维码方式
     * 根据处方code获取处方流程
     *
     * @param code wlyy_prescription_dispensary_code的code
     * @return
     */
    @RequestMapping(value = "/expressage", method = RequestMethod.POST)
    @ApiOperation(value = "确认配送")
    public String expressage(
            @RequestParam(required = true) @ApiParam(value = "wlyy_prescription_dispensary_code的code", name = "code") String code) {
        try {
            Integer status = prescriptionExpressageService.expressage(code, getUID());
            if (status == -1) {
                return error(-1, "编码不存在");
            }
            return write(200, "配送成功");
        } catch (Exception e) {
            return error(-1, "失败");
        }
    }
}
}

+ 2 - 24
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.prescription;
package com.yihu.wlyy.web.doctor.prescription;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageService;
import com.yihu.wlyy.service.app.prescription.PrescriptionExpressageService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.service.app.prescription.PrescriptionInfoService;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.BaseController;
@ -20,30 +21,6 @@ public class PrescriptionInfoController extends BaseController{
    @Autowired
    @Autowired
    private PrescriptionInfoService prescriptionInfoService;
    private PrescriptionInfoService prescriptionInfoService;
    @Autowired
    private PrescriptionExpressageService prescriptionExpressageService;
    /**
     * 确认配送 二维码方式
     * 根据处方code获取处方流程
     *
     * @param code wlyy_prescription_dispensary_code的code
     * @return
     */
    @RequestMapping(value = "/expressage", method = RequestMethod.POST)
    @ApiOperation(value = "确认配送")
    public String expressage(
            @RequestParam(required = true) @ApiParam(value = "wlyy_prescription_dispensary_code的code", name = "code") String code) {
        try {
            Integer status = prescriptionExpressageService.expressage(code, getUID());
            if (status == -1) {
                return error(-1, "编码不存在");
            }
            return write(200, "配送成功");
        } catch (Exception e) {
            return error(-1, "失败");
        }
    }
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
    @RequestMapping(value = "/getPrescriptionFilter", method = RequestMethod.GET)
    @ResponseBody
    @ResponseBody
@ -103,6 +80,7 @@ public class PrescriptionInfoController extends BaseController{
    @RequestMapping(value = "/updatePresInfo", method = RequestMethod.POST)
    @RequestMapping(value = "/updatePresInfo", method = RequestMethod.POST)
    @ResponseBody
    @ResponseBody
    @ApiOperation(value = "调整处方")
    @ApiOperation(value = "调整处方")
    @ObserverRequired
    public String updatePresInfo(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
    public String updatePresInfo(@RequestParam(required = true)@ApiParam(value = "续方CODE", name = "code") String code,
                                 @RequestParam(required = true)@ApiParam(value = "续方药品JSON", name = "infos") String infos){
                                 @RequestParam(required = true)@ApiParam(value = "续方药品JSON", name = "infos") String infos){
        try {
        try {

+ 20 - 16
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.consult;
package com.yihu.wlyy.web.patient.consult;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.consult.ConsultTeamLog;
import com.yihu.wlyy.entity.consult.ConsultTeamLog;
@ -13,7 +14,6 @@ import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyServerDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.consult.DoctorCommentService;
import com.yihu.wlyy.service.app.consult.DoctorCommentService;
@ -162,7 +162,7 @@ public class ConsultController extends WeixinBaseController {
            return write(200, "查询成功!", "data", result);
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败!");
            return error(-1, "查询失败!");
        }
        }
    }
    }
@ -181,7 +181,7 @@ public class ConsultController extends WeixinBaseController {
            return write(200, "查询成功!", "data", result);
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败!");
            return error(-1, "查询失败!");
        }
        }
    }
    }
@ -199,7 +199,7 @@ public class ConsultController extends WeixinBaseController {
            JSONObject result = doctorWorkTimeService.isDoctorWorking(doctor);
            JSONObject result = doctorWorkTimeService.isDoctorWorking(doctor);
            return write(200, result.getString("msg"), "data", result.getString("status"));
            return write(200, result.getString("msg"), "data", result.getString("status"));
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");
        }
        }
    }
    }
@ -217,7 +217,7 @@ public class ConsultController extends WeixinBaseController {
            JSONObject result = doctorWorkTimeService.isFamousDoctorWorking(doctor);
            JSONObject result = doctorWorkTimeService.isFamousDoctorWorking(doctor);
            return write(200, result.getString("msg"), "data", result.getString("status"));
            return write(200, result.getString("msg"), "data", result.getString("status"));
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");
        }
        }
    }
    }
@ -235,7 +235,7 @@ public class ConsultController extends WeixinBaseController {
            int result = doctorWorkTimeService.getDoctorConsultTimesRemain(doctor);
            int result = doctorWorkTimeService.getDoctorConsultTimesRemain(doctor);
            return write(200, "查询成功", "data", result);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");
        }
        }
    }
    }
@ -254,7 +254,7 @@ public class ConsultController extends WeixinBaseController {
            JSONArray result = new JSONArray(unfinishedConsult);
            JSONArray result = new JSONArray(unfinishedConsult);
            return write(200, "查询成功!", "data", result);
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败!");
            return error(-1, "查询失败!");
        }
        }
    }
    }
@ -278,7 +278,7 @@ public class ConsultController extends WeixinBaseController {
                return write(200, "查询成功", "data", "");
                return write(200, "查询成功", "data", "");
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");
        }
        }
    }
    }
@ -920,6 +920,7 @@ public class ConsultController extends WeixinBaseController {
        try{
        try{
            return success(ImUtill.getTopic(consult).get("data").toString());
            return success(ImUtill.getTopic(consult).get("data").toString());
        }catch (Exception e){
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
            return error(-1,e.getMessage());
        }
        }
    }
    }
@ -930,6 +931,7 @@ public class ConsultController extends WeixinBaseController {
            ConsultTeam consultTeam = consultTeamService.findByConsultCode(consult);
            ConsultTeam consultTeam = consultTeamService.findByConsultCode(consult);
            return write(200, "查询成功", "data", consultTeam);
            return write(200, "查询成功", "data", consultTeam);
        }catch (Exception e){
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
            return error(-1,e.getMessage());
        }
        }
    }
    }
@ -940,7 +942,7 @@ public class ConsultController extends WeixinBaseController {
    @RequestMapping(value = "isPrescriptionConsult",method = RequestMethod.GET)
    @RequestMapping(value = "isPrescriptionConsult",method = RequestMethod.GET)
    @ResponseBody
    @ResponseBody
    @ApiOperation("是否可以续方咨询")
    @ApiOperation("是否可以续方咨询")
    public String isPrescriptConsult(String patient){
    public String isPrescriptConsult(@ApiParam(name = "patient", value = "居民code") @RequestParam(value = "patient", required = true)String patient){
        try{
        try{
            SignFamily signFamily = signFamilyDao.findByPatient(patient);
            SignFamily signFamily = signFamilyDao.findByPatient(patient);
            if(signFamily==null){
            if(signFamily==null){
@ -968,6 +970,7 @@ public class ConsultController extends WeixinBaseController {
    @RequestMapping(value = "addPrescriptionConsult",method = RequestMethod.POST)
    @RequestMapping(value = "addPrescriptionConsult",method = RequestMethod.POST)
    @ResponseBody
    @ResponseBody
    @ObserverRequired
    @ApiOperation("添加续方咨询")
    @ApiOperation("添加续方咨询")
    public String addPrescriptionConsult(@ApiParam(name = "jwCode", value = "基位处方code", defaultValue = "10")
    public String addPrescriptionConsult(@ApiParam(name = "jwCode", value = "基位处方code", defaultValue = "10")
                                         @RequestParam(value = "jwCode", required = true) String jwCode,
                                         @RequestParam(value = "jwCode", required = true) String jwCode,
@ -982,8 +985,8 @@ public class ConsultController extends WeixinBaseController {
            consult.setType(8);//续方咨询
            consult.setType(8);//续方咨询
            consult.setAdminTeamId(adminTeamId);
            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) {
            if (res == -1) {
                return error(-1, "该处方存在未审核的续方,无法进行续方咨询!");
                return error(-1, "该处方存在未审核的续方,无法进行续方咨询!");
            }
            }
@ -1008,12 +1011,13 @@ public class ConsultController extends WeixinBaseController {
    @RequestMapping(value = "getPreConsultList",method = RequestMethod.GET)
    @RequestMapping(value = "getPreConsultList",method = RequestMethod.GET)
    @ResponseBody
    @ResponseBody
    @ApiOperation("获取续方咨询列表")
    @ApiOperation("获取续方咨询列表")
    public String getPreConsultList(@RequestParam(required = false) String title,
                                    @RequestParam(required = true) long id,@RequestParam(required = true) int pagesize){
    public String getPreConsultList(@ApiParam(name = "title", value = "咨询标题") @RequestParam(required = false) String title,
                                    @ApiParam(name = "id", value = "第几页") @RequestParam(required = true) long id,
                                    @ApiParam(name = "pagesize", value = "页面大小") @RequestParam(required = true) int pagesize){
        try {
        try {
            JSONArray array = new JSONArray();
            JSONArray array = new JSONArray();
            Page<Object> data = consultTeamService.findConsultRecordByType("a663d0cf7f8c4d38a8327cedc921e65f", id, pagesize,8, title);//8表示续方咨询
//            Page<Object> data = consultTeamService.findConsultRecordByType(getRepUID(), id, pagesize,8, title);//8表示续方咨询
//            Page<Object> data = consultTeamService.findConsultRecordByType("a663d0cf7f8c4d38a8327cedc921e65f", id, pagesize,8, title);//8表示续方咨询
            Page<Object> data = consultTeamService.findConsultRecordByType(getRepUID(), id, pagesize,8, title);//8表示续方咨询
            if (data != null) {
            if (data != null) {
                for (Object consult : data.getContent()) {
                for (Object consult : data.getContent()) {
                    if (consult == null) {
                    if (consult == null) {
@ -1055,7 +1059,7 @@ public class ConsultController extends WeixinBaseController {
    @RequestMapping(value = "prescriptionDetail",method = RequestMethod.GET)
    @RequestMapping(value = "prescriptionDetail",method = RequestMethod.GET)
    @ResponseBody
    @ResponseBody
    @ApiOperation("获取续方信息")
    @ApiOperation("获取续方信息")
    public String prescriptionDetail(@RequestParam(required = true) String consult){
    public String prescriptionDetail(@ApiParam(name = "consult", value = "咨询code") @RequestParam(required = true) String consult){
        try {
        try {
            JSONObject json = new JSONObject();
            JSONObject json = new JSONObject();