Browse Source

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

wujunjie 8 years ago
parent
commit
f43c9cd00b
25 changed files with 385 additions and 87 deletions
  1. 38 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  2. 30 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java
  3. 30 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/UserInterceptor.java
  4. 31 14
      patient-co-wlyy/src/main/java/com/yihu/wlyy/logs/BusinessLogs.java
  5. 26 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/logs/InterfaceCallLogs.java
  6. 4 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  7. 35 17
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  8. 4 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java
  9. 9 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  10. 5 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  11. 14 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  12. 29 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java
  13. 2 6
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/WeixinBaseController.java
  14. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java
  15. 9 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  16. 1 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  17. 6 13
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  18. 8 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java
  19. 11 4
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  20. 2 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthGuidanceController.java
  21. 7 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java
  22. 15 13
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java
  23. 50 7
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java
  24. 14 2
      patient-co-wlyy/src/main/resources/logback.xml
  25. 4 0
      patient-co-wlyy/src/main/resources/system.properties

+ 38 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -5,6 +5,7 @@ import javax.servlet.http.HttpServletResponse;
import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.entity.url.CudUrl;
import com.yihu.wlyy.logs.InterfaceCallLogs;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
@ -17,6 +18,7 @@ import org.springframework.web.servlet.ModelAndView;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
@ -32,13 +34,24 @@ public class DoctorInterceptor extends BaseInterceptor {
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        boolean flag = true;
        try {
            request.setAttribute("log-start", new Date().getTime());
            response.setCharacterEncoding("UTF-8");
            JSONObject json = getAgent(request);
            if (json == null) {
                // 未登录
                response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
                return false;
            }
            if (json.has("uid") && json.has("admin_token") && StringUtils.isNotEmpty(json.getString("admin_token"))) {
                String adminToken = SystemConf.getInstance().getSystemProperties().getProperty("admin_token");
                String adminUid = SystemConf.getInstance().getSystemProperties().getProperty("admin_uid");
                if (json.getString("uid").equals(adminUid) && json.getString("admin_token").equals(adminToken)) {
                    return true;
                }
            }
            String tokenStr = json.has("token") ? json.getString("token") : "";
            String uid = json.has("uid") ? json.getString("uid") : "";
            String imei = json.has("imei") ? json.getString("imei") : "";
@ -125,7 +138,32 @@ public class DoctorInterceptor extends BaseInterceptor {
    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        long start = (long) request.getAttribute("log-start");
        long end = new Date().getTime();
        Class cls = ((HandlerMethod) handler).getBeanType();
        RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
        Method method = ((HandlerMethod) handler).getMethod();
        RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
        String url = "";
        String urlCls = "";
        String urlMth = "";
        if (clsRm.value() != null && clsRm.value().length > 0) {
            urlCls = clsRm.value()[0];
        }
        if (mthRm.value() != null && mthRm.value().length > 0) {
            urlMth = mthRm.value()[0];
        }
        if (StringUtils.isNotEmpty(urlCls)) {
            url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
        }
        if (StringUtils.isNotEmpty(urlMth)) {
            url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
        }
        url = url.replace("\\", "/").replace("//", "/");
        JSONObject json = getAgent(request);
        String uid = json.has("uid") ? json.getString("uid") : "";
        InterfaceCallLogs.info(end - start, url, uid, new JSONObject(request.getParameterMap()).toString());
    }
    @Override

+ 30 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java

@ -1,12 +1,16 @@
package com.yihu.wlyy.interceptors;
import java.lang.reflect.Method;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.yihu.wlyy.logs.InterfaceCallLogs;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import com.yihu.wlyy.entity.security.Token;
@ -25,6 +29,7 @@ public class PatientInterceptor extends BaseInterceptor {
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		boolean flag = true;
		try {
			request.setAttribute("log-start", new Date().getTime());
			if(request.getRequestURI().contains("/patient/hosptail/getHositalByTownCode")){
				return true;
			}
@ -92,7 +97,32 @@ public class PatientInterceptor extends BaseInterceptor {
	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
		long start = (long) request.getAttribute("log-start");
		long end = new Date().getTime();
		Class cls = ((HandlerMethod) handler).getBeanType();
		RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
		Method method = ((HandlerMethod) handler).getMethod();
		RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
		String url = "";
		String urlCls = "";
		String urlMth = "";
		if (clsRm.value() != null && clsRm.value().length > 0) {
			urlCls = clsRm.value()[0];
		}
		if (mthRm.value() != null && mthRm.value().length > 0) {
			urlMth = mthRm.value()[0];
		}
		if (StringUtils.isNotEmpty(urlCls)) {
			url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
		}
		if (StringUtils.isNotEmpty(urlMth)) {
			url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
		}
		url = url.replace("\\", "/").replace("//", "/");
		JSONObject json = getAgent(request);
		String uid = json.has("uid") ? json.getString("uid") : "";
		InterfaceCallLogs.info(end - start, url, uid, new JSONObject(request.getParameterMap()).toString());
	}
	@Override

+ 30 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/UserInterceptor.java

@ -1,12 +1,16 @@
package com.yihu.wlyy.interceptors;
import java.lang.reflect.Method;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.yihu.wlyy.logs.InterfaceCallLogs;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.ModelAndView;
import com.yihu.wlyy.entity.security.Token;
@ -24,6 +28,7 @@ public class UserInterceptor extends BaseInterceptor {
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		try {
			request.setAttribute("log-start", new Date().getTime());
			response.setCharacterEncoding("UTF-8");
			JSONObject json = getAgent(request);
			if (json == null) {
@ -97,7 +102,32 @@ public class UserInterceptor extends BaseInterceptor {
	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
		long start = (long) request.getAttribute("log-start");
		long end = new Date().getTime();
		Class cls = ((HandlerMethod) handler).getBeanType();
		RequestMapping clsRm = (RequestMapping) cls.getAnnotation(RequestMapping.class);
		Method method = ((HandlerMethod) handler).getMethod();
		RequestMapping mthRm = method.getAnnotation(RequestMapping.class);
		String url = "";
		String urlCls = "";
		String urlMth = "";
		if (clsRm.value() != null && clsRm.value().length > 0) {
			urlCls = clsRm.value()[0];
		}
		if (mthRm.value() != null && mthRm.value().length > 0) {
			urlMth = mthRm.value()[0];
		}
		if (StringUtils.isNotEmpty(urlCls)) {
			url += urlCls.startsWith("/") ? urlCls : ("/" + urlCls);
		}
		if (StringUtils.isNotEmpty(urlMth)) {
			url += urlMth.startsWith("/") ? urlMth : ("/" + urlMth);
		}
		url = url.replace("\\", "/").replace("//", "/");
		JSONObject json = getAgent(request);
		String uid = json.has("uid") ? json.getString("uid") : "";
		InterfaceCallLogs.info(end - start, url, uid, new JSONObject(request.getParameterMap()).toString());
	}
	@Override

+ 31 - 14
patient-co-wlyy/src/main/java/com/yihu/wlyy/logs/BusinessLogs.java

@ -1,12 +1,13 @@
package com.yihu.wlyy.logs;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * 业务日志输出
 *
 * <p>
 * Created by lyr-pc on 2017/1/19.
 */
public class BusinessLogs {
@ -18,22 +19,20 @@ public class BusinessLogs {
     * 业务类型
     */
    public enum BusinessType {
        //注册
        register
        //签约
        , sign
        //咨询
        , consult
        //指导
        // 咨询
        consult
        // 指导
        , guidance
        //健康教育
        // 健康教育
        , article
        //随访
        // 随访
        , followup
        //预约
        // 预约
        , appointment
        //标签
        // 标签
        , label
        // 签约
        , register
    }
    /**
@ -42,7 +41,25 @@ public class BusinessLogs {
     * @param type 业务类别
     * @param info 日志信息
     */
    public static void info(BusinessType type, JSONObject info) {
        logger.info(type.ordinal() + " - " + info.toString());
    public static void info(BusinessType type, String user, JSONObject info) {
        try {
            logger.info(type.ordinal() + " - " + user + " - " + info.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 业务日志输出
     *
     * @param type 业务类别
     * @param info 日志信息
     */
    public static void info(BusinessType type, String user, JSONArray info) {
        try {
            logger.info(type.ordinal() + " - " + user + " - " + info.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

+ 26 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/logs/InterfaceCallLogs.java

@ -0,0 +1,26 @@
package com.yihu.wlyy.logs;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * Created by lyr-pc on 2017/1/22.
 */
public class InterfaceCallLogs {
    // 日志输出
    private static Logger logger = LoggerFactory.getLogger(InterfaceCallLogs.class);
    /**
     * 接口调用日志输出
     *
     * @param info 日志信息
     */
    public static void info(long time, String url, String user, String info) {
        try {
            logger.info(user + " - " + url + " - " + time + "ms - " + info.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

+ 4 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -35,6 +35,7 @@ import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.apache.commons.lang3.StringUtils;
@ -879,6 +880,7 @@ public class DoctorInfoService extends BaseService {
        Integer error = 0;//转移失败
        for (int i = 0; i < patiensString.length; i++) {
            try {
                ImUtill.deleteMucUser(newDoctorCode,oldDoctorCode,patiensString[i]+"_consult_2");
                updateTeamHealthDoctor(newDoctorCode, oldDoctorCode, patiensString[i]);
                successs++;
            } catch (Exception e) {
@ -911,6 +913,7 @@ public class DoctorInfoService extends BaseService {
                    if (updateTeamHealthDoctorAll(newDoctorCode, patient) == -1) {
                        hasNoTeam = true;
                    }
                    ImUtill.deleteMucUser(newDoctorCode,doctor,patient+"_consult_2");
                } catch (Exception e) {
                    e.printStackTrace();
                }
@ -1083,6 +1086,7 @@ public class DoctorInfoService extends BaseService {
        for (int i = 0; i < patiensString.length; i++) {
            try {
                ImUtill.deleteMucUser(newDoctorCode,oldDoctorCode,patiensString[i]+"_consult_2");
                updateTeamDoctor(newDoctorCode, oldDoctorCode, patiensString[i]);
                successs++;
            } catch (Exception e) {

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

@ -703,7 +703,7 @@ public class ConsultTeamService extends ConsultService {
            DoctorTeamMember doctorTeamMember = doctorTeamDoctor.findDoctorJiating2ByTeam(doctorTeam.getCode(), 2);
            if (doctorTeamMemberHealthy == null) {
                ct.setDoctor(doctorTeamMember.getMemberCode());
                users.put(doctorTeamMemberHealthy.getMemberCode(),0);
                users.put(doctorTeamMember.getMemberCode(),0);
            }else{
                users.put(doctorTeamMemberHealthy.getMemberCode(),0);
                if(doctorTeamMember!=null){
@ -1492,6 +1492,7 @@ public class ConsultTeamService extends ConsultService {
        // 设置患者信息
        ct.setPatient(uid);
        Doctor doctorTemp = doctorDao.findByCode(uid);
        Doctor doctor = doctorDao.findByCode(ct.getDoctor());
        // 设置医生姓名
        ct.setName(doctorTemp.getName());
        // 设置医生生日
@ -1520,28 +1521,45 @@ public class ConsultTeamService extends ConsultService {
        cd.setTo(ct.getDoctor());
        // 添加医生咨询日志
        String content = addLogs(ct);
        JSONObject messages  = ImUtill.getCreateTopicMessage(doctorTemp.getCode(),doctorTemp.getName(),consult.getTitle(),content,consult.getImages());
        JSONObject jsonObject = new JSONObject();
        jsonObject.put(ct.getPatient(),0);
        jsonObject.put(ct.getDoctor(),0);
        //设置消息ID
        JSONObject obj = ImUtill.createTopics(null,consult.getCode(),doctorTemp.getName(),jsonObject,messages,"2");
        if(obj==null||obj.getInt("status")==-1){
            throw new RuntimeException("im消息创建异常!"+obj==null?"":obj.getString("message"));
        }
        ct.setStartMsgId(obj.get("start_msg_id").toString());
        //转发咨询问题
        if(StringUtils.isNotBlank(oldConsultCode)){
        if(StringUtils.isBlank(oldConsultCode)) {
            JSONObject messages = ImUtill.getCreateTopicMessage(doctorTemp.getCode(), doctorTemp.getName(), consult.getTitle(), content, consult.getImages());
            JSONObject jsonObject = new JSONObject();
            jsonObject.put(ct.getPatient(), 0);
            jsonObject.put(ct.getDoctor(), 0);
            //设置消息ID
            JSONObject obj = ImUtill.createTopics(null, consult.getCode(), doctorTemp.getName(), jsonObject, messages, "2");
            if (obj == null || obj.getInt("status") == -1) {
                throw new RuntimeException("im消息创建异常!" + obj == null ? "" : obj.getString("message"));
            }
            ct.setStartMsgId(obj.get("start_msg_id").toString());
        }else{
            //转发咨询问题
            Consult oldConsult = consultDao.findByCode(oldConsultCode);
            ct.setTeam(oldConsultCode);
            if(oldConsult!=null&&isSend==1){
                ImUtill.sendTopicIM(doctorTemp.getCode(),doctorTemp.getName(),consult.getCode(),"6",oldConsult.getSymptoms());
                if(StringUtils.isNotBlank(oldConsult.getImages())){
                    String imgs[] = oldConsult.getImages().split(",");
                JSONObject messages = ImUtill.getCreateTopicMessage(doctorTemp.getCode(), doctorTemp.getName(), consult.getTitle(), oldConsult.getSymptoms(), oldConsult.getImages());
                JSONObject jsonObject = new JSONObject();
                jsonObject.put(ct.getPatient(), 0);
                jsonObject.put(ct.getDoctor(), 0);
                JSONObject obj = ImUtill.createTopics(null, consult.getCode(), doctorTemp.getName(), jsonObject, messages, "2");
                if (obj == null || obj.getInt("status") == -1) {
                    throw new RuntimeException("im消息创建异常!" + obj == null ? "" : obj.getString("message"));
                }
                ct.setStartMsgId(obj.get("start_msg_id").toString());
                ImUtill.sendTopicIM(doctorTemp.getCode(),doctorTemp.getName(),consult.getCode(),"6",content);
                if(StringUtils.isNotBlank(consult.getImages())){
                    String imgs[] = consult.getImages().split(",");
                    for(String url :imgs)
                        ImUtill.sendTopicIM(doctorTemp.getCode(),doctorTemp.getName(),consult.getCode(),"2",url);
                }
            }
            JSONObject qiuzuObj = new JSONObject();
            qiuzuObj.put("session_id",oldConsult.getPatient()+"_consult_"+consult.getType());
            qiuzuObj.put("patient",ct.getPatient());
            qiuzuObj.put("old_consult_code",oldConsultCode);
            qiuzuObj.put("doctor",ct.getDoctor());
            qiuzuObj.put("doctor_name",doctor.getName());
            ImUtill.sendTopicIM(doctorTemp.getCode(),doctorTemp.getName(),oldConsultCode,"5",qiuzuObj.toString());
        }
        consultTeamDao.save(ct);  // 保存医生咨询信息
        consultTeamDoctorDao.save(cd);
@ -1567,7 +1585,7 @@ public class ConsultTeamService extends ConsultService {
            throw new RuntimeException("IM消息结束异常!");
        }
        if(obj.getInt("status")==-1){
            throw new RuntimeException(obj.getString("message"));
            throw new RuntimeException(String.valueOf(obj.get("message")));
        }
        consultTeam.setType(endType);
        consultTeam.setEndMsgId(obj.getString("id"));

+ 4 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -255,7 +255,7 @@ public class FollowUpService extends BaseService {
     * 新增随访计划(批量)
     */
    @Transactional
    public void addFollowupPlan(String doctorCode, String patientCode, String data) throws Exception {
    public Iterable<Followup> addFollowupPlan(String doctorCode, String patientCode, String data) throws Exception {
        //批量随访计划
        JavaType javaType = objectMapper.getTypeFactory().constructParametricType(List.class, Map.class);
        List<Map<String, String>> list = objectMapper.readValue(data, javaType);
@ -299,8 +299,10 @@ public class FollowUpService extends BaseService {
                followupPlan.add(followup);
            }
            followupDao.save(followupPlan);
            return followupDao.save(followupPlan);
        }
        return null;
    }

+ 9 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -9,6 +9,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientDisease;
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.doctor.DoctorPatientGroupInfoDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
@ -954,6 +955,7 @@ public class SignPatientLabelInfoService extends BaseService {
            }
        }
        JSONArray logArray = new JSONArray();
        JSONArray teams = adminTeamService.findPatientDoctorTeam(patient, doctor);
        List<String> teamCodes = new ArrayList<>();
@ -991,6 +993,7 @@ public class SignPatientLabelInfoService extends BaseService {
                healthLabel.setCzrq(new Date());
                labelInfoDao.save(healthLabel);
                logArray.put(new JSONObject(label));
            }
        } else {
            return -2;
@ -1034,6 +1037,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    disLabel.setCzrq(new Date());
                    labelInfoDao.save(disLabel);
                    logArray.put(new JSONObject(label));
                }
            }
        } else {
@ -1081,6 +1085,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    cusLabel.setCzrq(new Date());
                    labelInfoDao.save(cusLabel);
                    logArray.put(new JSONObject(label));
                }
            }
        }
@ -1103,6 +1108,7 @@ public class SignPatientLabelInfoService extends BaseService {
                disLabel.setCzrq(new Date());
                labelInfoDao.save(disLabel);
                logArray.put(new JSONObject("{\"labelCode\":\"1\",\"labelName\":\"慢病人群\",\"labelType\":\"1\"}"));
            }
        } else {
            int age = IdCardUtil.getAgeForIdcard(idcard);
@ -1131,9 +1137,12 @@ public class SignPatientLabelInfoService extends BaseService {
                disLabel.setLabelName(lbName);
                labelInfoDao.save(disLabel);
                logArray.put(new JSONObject("{\"labelCode\":\"" + lbCode + "\",\"labelName\":\"" + lbName + "\",\"labelType\":\"1\"}"));
            }
        }
        BusinessLogs.info(BusinessLogs.BusinessType.label, patient, logArray);
        return 1;
    }

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

@ -334,9 +334,7 @@ public class MessageService extends BaseService {
                map.put("type", type);
                map.put("read", String.valueOf(item.getRead()));
                map.put("sex", String.valueOf(item.getSex()));
                map.put("value1", String.valueOf(item.getValue1()));
                String value2 = String.valueOf(item.getValue2().intValue());
                map.put("value2",value2);
                map.put("czrq", DateUtil.dateToStrLong(item.getCzrq()));
                DevicePatientHealthIndex data =devicePatientHealthIndexDao.findOne(Long.valueOf(item.getTzCode()));
@ -345,6 +343,10 @@ public class MessageService extends BaseService {
                    //记录时间
                    map.put("recordDate",DateUtil.dateToStrLong(data.getRecordDate()));
                    //指标数据
                    map.put("value1", data.getValue1());
                    String value2 = Integer.valueOf(data.getValue2()).toString();
                    map.put("value2",value2);
                    /*//获取上次血糖值
                    if("1".equals(type))
                    {

+ 14 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -1739,7 +1739,13 @@ public class FamilyContractService extends BaseService {
                    result.put("msg", "与当前健管师有未结束的咨询");
                    return result;
                }
                try{
                    ImUtill.deleteMucUser(healthDoctor,signFamily.getDoctorHealth(),patient+"_consult_2");
                }catch (Exception e){
                    result.put("status", -1);
                    result.put("msg", e.getMessage());
                    return result;
                }
                DoctorTeamMember teamMember = doctorTeamDoctor.findMemberByTeamAndCode(signFamily.getTeamCode(), signFamily.getDoctorHealth());
                if (teamMember != null) {
@ -1817,7 +1823,13 @@ public class FamilyContractService extends BaseService {
            String oldDoctorName = signFamily.getDoctorName();
            if (StringUtils.isNotEmpty(signFamily.getDoctor())) {
                DoctorTeamMember teamMember = doctorTeamDoctor.findMemberByTeamAndQkCode(signFamily.getTeamCode(), signFamily.getDoctor());
                 try{
                    ImUtill.deleteMucUser(doctor,signFamily.getDoctor(),patient+"_consult_2");
                }catch (Exception e){
                    result.put("status", -1);
                    result.put("msg", e.getMessage());
                    return result;
                }
                if (teamMember != null) {
                    teamMember.setDel("0");
                    teamMember.setCzrq(new Date());

+ 29 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -169,4 +169,33 @@ public class ImUtill {
        }
    }
    /**
     * 删除对应的成员信息在MUC模式中
     * @param userId
     * @param oldUserId
     * @param sessionId
     * @return
     */
    public static JSONObject deleteMucUser(String userId,String oldUserId,String sessionId) throws  Exception{
        String url = SystemConf.getInstance().getSystemProperties().getProperty("im_list_get")
                + "api/v2/sessions/"+sessionId+"/participant/update";
        try{
            JSONObject params = new JSONObject();
            params.put("user_id", userId);
            params.put("old_user_id", oldUserId);
            params.put("session_id", sessionId);
            String ret = HttpClientUtil.postBody(url,params);
            JSONObject obj = new JSONObject(ret);
            if(obj.getInt("status")==-1){
                throw new RuntimeException("人员更换失败!");
            }else{
                return obj;
            }
        }catch (Exception e){
           throw new RuntimeException("人员更换失败!");
        }
    }
}

+ 2 - 6
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/WeixinBaseController.java

@ -12,6 +12,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import com.yihu.wlyy.util.*;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -23,11 +24,6 @@ import com.yihu.wlyy.entity.security.Token;
import com.yihu.wlyy.service.common.account.AccessTokenService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.ImageCompress;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
public class WeixinBaseController extends BaseController {
@ -424,7 +420,7 @@ public class WeixinBaseController extends BaseController {
		// 拼接年月日路径
		String datePath = DateUtil.getStringDate("yyyy") + File.separator + DateUtil.getStringDate("MM") + File.separator + DateUtil.getStringDate("dd") + File.separator;
		// 重命名文件
		String newFileName = DateUtil.dateToStr(new Date(), DateUtil.YYYYMMDDHHMMSS) + "_" + new Random().nextInt(1000) + ".wav";
		String newFileName = DateUtil.dateToStr(new Date(), DateUtil.YYYYMMDDHHMMSS) + "_" + new Random().nextInt(1000) + ".mp3";
		// 保存路径
		File uploadFile = new File(tempPath + datePath + newFileName);

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java

@ -188,7 +188,7 @@ public class FileUploadController extends BaseController {
                fileName = mf.getOriginalFilename();
                String fileExt = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
                if("3".equals(type)){
                    fileExt ="wav";
                    fileExt ="mp3";
                }
                ObjectNode objectNode = fastDFSUtil.upload(mf.getInputStream() ,fileExt,"");
                tempPaths.add(fastUrl + objectNode.get("groupName").toString().replaceAll("\"","")

+ 9 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java

@ -9,6 +9,7 @@ import java.util.UUID;
import com.yihu.wlyy.entity.login.LoginLog;
import com.yihu.wlyy.entity.patient.SocialSecurityInfo;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SocialSecurityInfoDao;
import com.yihu.wlyy.service.app.family.FamilyService;
@ -302,13 +303,19 @@ public class WechatController extends WeixinBaseController {
            password = StringUtils.reverse(password);
            patient.setPassword(MD5.GetMD5Code(password + salt));
            patient.setSsc(ssc);
            if(!org.springframework.util.StringUtils.isEmpty(openid)){
            if (!org.springframework.util.StringUtils.isEmpty(openid)) {
                patient.setOpenid(openid);
                patient.setOpenidTime(new Date());
            }
            JSONObject json = patientService.register(idcard, ssc, name, mobile, MD5.GetMD5Code(password + salt)
                    , salt, openid, 3);
            if (json != null) {
                try {
                    Patient p = patientDao.findByIdcard(idcard);
                    BusinessLogs.info(BusinessLogs.BusinessType.register, p.getCode(), new JSONObject(p));
                } catch (Exception e) {
                    e.printStackTrace();
                }
                // 注册成功
                return write(200, "注册成功!", "data", json);
            } else {
@ -336,7 +343,7 @@ public class WechatController extends WeixinBaseController {
            @RequestParam(required = false) String captcha,
            @RequestParam(required = false) String password,
            String openid) {
        System.out.println("login openid : " + openid );
        System.out.println("login openid : " + openid);
        String errorMessage;
        LoginLog loginLog = new LoginLog();
        loginLog.setCreateTime(new Date());

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

@ -1575,6 +1575,7 @@ public class DoctorController extends BaseController {
                return error(-2, "正在分配,请勿重复操作");
            }
            if (StringUtils.isNotEmpty(isAll) && isAll.equals("1")) {
                int result = doctorInfoService.updateTeamHealthDoctorsAll(newDoctorCode, getUID());
                redisTemplate.opsForValue().set("jianguanshifenpei:" + getUID(), "0");
                redisTemplate.expire("jianguanshifenpei:" + getUID(), 10, TimeUnit.MINUTES);

+ 6 - 13
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -660,7 +660,7 @@ public class DoctorConsultController extends WeixinBaseController {
                }
            }
            if (StringUtils.isEmpty(voice)) {
            if (StringUtils.isNotEmpty(voice)) {
                voice = fetchWxVoices();
            }
            if (StringUtils.isNotEmpty(voice)) {
@ -875,26 +875,19 @@ public class DoctorConsultController extends WeixinBaseController {
                json.put("isCommonTeam", 1);
                return write(200, "查询成功", "data", json);
            }
            List<ConsultTeam>  ls = consultTeamService.hasUnfinished(doctorCode, curDoc);
            if(ls!=null && ls.size() > 0){
                ConsultTeam ct =  ls.get(0);
                json.put("consult", ct.getConsult());
                //是否是医生求助医生
                if(ct.getType()==10){
                    List<WlyyTalkGroup> wlyyTalkGroups = talkGroupService.findAllConsultTalkGroup(ct.getTeam());
                    if(wlyyTalkGroups!=null && wlyyTalkGroups.size()>0){
                        for (WlyyTalkGroup g : wlyyTalkGroups){
                            if(g.getType()==1){
                                json.put("zxGroupCode", g.getCode());
                                json.put("from", ct.getPatient());
                                break;
                            }
                        }
                    }
                    ConsultTeam consultTeam = consultTeamService.findByConsultCode(ct.getTeam());
                    Patient patient = patientService.findByCode(consultTeam.getPatient());
                    json.put("zxGroupCode",consultTeam.getPatient()+"_consult_"+consultTeam.getType());
                    json.put("from", ct.getPatient());
                    json.put("patient_name", patient.getName());
                }
            }
            return write(200, "查询成功", "data", json);
        } catch (Exception ex) {
            error(ex);

+ 8 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.doctor.followup;
import java.util.*;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.service.app.followup.FollowUpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -116,7 +117,13 @@ public class DoctorFollowUpController extends BaseController {
                                  @ApiParam(name = "data", value = "随访计划列表json", defaultValue = "[{\"date\":\"2016-12-16 20:00:00\",\"type\":\"10\",\"doctor\":\"64de9952-5b15-11e6-8344-fa163e8aee56\"},{\"date\":\"2016-12-17 15:00:00\",\"type\":\"3\",\"doctor\":\"64de9952-5b15-11e6-8344-fa163e8aee56\"}]")
                                  @RequestParam(value = "data", required = true) String data) {
        try {
            followUpService.addFollowupPlan(getUID(), patient, data);
            Iterable<Followup> followups = followUpService.addFollowupPlan(getUID(), patient, data);
            if (followups != null) {
                for (Followup followup : followups) {
                    BusinessLogs.info(BusinessLogs.BusinessType.followup, followup.getPatientCode(), new JSONObject(followup));
                }
            }
            return write(200, "新增随访计划成功!");
        } catch (Exception e) {

+ 11 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -5,6 +5,7 @@ import java.util.*;
import com.yihu.wlyy.entity.education.*;
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.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.app.health.*;
@ -75,6 +76,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
    @Autowired
    ConsultService consultService;
    /**
     * 查询
     *
@ -383,7 +385,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                    // 行政团队
                    heap.setAdminTeamCode(signFamily.getAdminTeamId());
                    list.add(heap);
                    consultService.sendMucMessageBySingnType(doctor.getCode(),doctor.getName(), p, "{\"title\":\"" + temp.getTitle() + "\",\"id\":\"" + temp.getCode() + "\",\"img\":\"" + temp.getUrl() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4","医生:"+doctor.getName()+"给患者:"+patientTemp.getName()+"发送了健康教育文章!");
                    consultService.sendMucMessageBySingnType(doctor.getCode(), doctor.getName(), p, "{\"title\":\"" + temp.getTitle() + "\",\"id\":\"" + temp.getCode() + "\",\"img\":\"" + temp.getUrl() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", "医生:" + doctor.getName() + "给患者:" + patientTemp.getName() + "发送了健康教育文章!");
                    if (StringUtils.isNotEmpty(patientTemp.getOpenid())) {
                        // 推送消息给微信端
                        JSONObject json = new JSONObject();
@ -408,11 +410,16 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                return error(-1, "发送失败!");
            } else {
                for (String key : msgs.keySet()) {
                    Map<String,Object> map = msgs.get(key);
                    Map<String, Object> map = msgs.get(key);
                    PushMsgTask.getInstance().putWxMsg(getAccessToken(), 9,
                            map.get("openid") == null ? "":map.get("openid").toString(),
                            map.get("name") == null ? "":map.get("name").toString(),
                            map.get("openid") == null ? "" : map.get("openid").toString(),
                            map.get("name") == null ? "" : map.get("name").toString(),
                            (JSONObject) map.get("json"));
                    JSONObject json = (JSONObject) map.get("json");
                }
                for (HealthEduArticlePatient heap : list) {
                    BusinessLogs.info(BusinessLogs.BusinessType.article, heap.getPatient(), new JSONObject(heap));
                }
                // 推送消息给患者

+ 2 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthGuidanceController.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.web.doctor.health;
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.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
@ -98,6 +99,7 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
			if (patientHealthGuidanceService.add(guidance, getAccessToken()) != null) {
				Patient p = patientService.findByCode(patient);
				consultService.sendMucMessageBySingnType(getUID(),doctor.getName(),patient,content,"1","医生:"+doctor.getName()+"给患者:"+p.getName()+"发送了健康指导!");
				BusinessLogs.info(BusinessLogs.BusinessType.guidance, patient, new JSONObject(guidance));
				return success("保存成功!");
			} else {
				return error(-1, "保存失败!");

+ 7 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -10,6 +10,7 @@ import java.util.concurrent.TimeUnit;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.message.MessageService;
import com.yihu.wlyy.service.app.sign.PatientRemindService;
@ -315,6 +316,12 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            if (sf == null) {
                return error(-1, "代理签约失败!");
            } else {
                try {
                    Patient p = patientService.findByIdcard(idcard);
                    BusinessLogs.info(BusinessLogs.BusinessType.register, p.getCode(), new JSONObject(p));
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return success("代理签约成功!");
            }
        } catch (Exception e) {

+ 15 - 13
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -10,6 +10,7 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.schedule.WlyyDoctorWorkTime;
import com.yihu.wlyy.entity.doctor.schedule.WlyyDoctorWorkWeek;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.util.*;
@ -326,7 +327,7 @@ public class ConsultController extends WeixinBaseController {
            // 推送消息给医生
            PushMsgTask.getInstance().put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.D_CT_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.指定咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_CONSULT_TEAM.您有新的指定咨询.name(), consult.getConsult());
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getUID(), new JSONObject(consult));
            return write(200, "提交成功", "data", consult);
        } catch (Exception ex) {
            error(ex);
@ -398,6 +399,7 @@ public class ConsultController extends WeixinBaseController {
            doctorWorkTimeService.setDoctorCurrentConsultTimesRemain(doctorCode);
            // 推送消息给医生
            PushMsgTask.getInstance().put(consult.getDoctor(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.D_CT_03.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.名医咨询.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_FAMOUS_CONSULT_TEAM.您有新的名医咨询.name(), consult.getConsult());
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getUID(), new JSONObject(consult));
            return write(200, "提交成功", "data", consult);
        } catch (Exception ex) {
            error(ex);
@ -591,7 +593,7 @@ public class ConsultController extends WeixinBaseController {
     */
    @RequestMapping(value = "append")
    @ResponseBody
    public String append(@RequestParam String consult, @RequestParam String content, @RequestParam int type,@RequestParam(required = false,defaultValue = "0") Integer times) {
    public String append(@RequestParam String consult, @RequestParam String content, @RequestParam int type, @RequestParam(required = false, defaultValue = "0") Integer times) {
        try {
            List<ConsultTeamLog> logs = new ArrayList<ConsultTeamLog>();
            ConsultTeam consultModel = consultTeamService.findByCode(consult);
@ -605,14 +607,14 @@ public class ConsultController extends WeixinBaseController {
            }
            String[] arr = null;
            if(type==3){
               String path =  fetchWxVoices();
               JSONObject obj = new JSONObject();
            if (type == 3) {
                String path = fetchWxVoices();
                JSONObject obj = new JSONObject();
                // 将临时语音拷贝到正式存储路径下
                if (StringUtils.isNotEmpty(path)) {
                    content = CommonUtil.copyTempVoice(path);
                    obj.put("path",content);
                    obj.put("times",times);
                    obj.put("path", content);
                    obj.put("times", times);
                    content = obj.toString();
                }
                ConsultTeamLog log = new ConsultTeamLog();
@ -622,9 +624,9 @@ public class ConsultController extends WeixinBaseController {
                log.setChatType(type);
                log.setType(3);
                logs.add(log);
            }else if (type == 2) {
            } else if (type == 2) {
                // 图片消息
                content =  fetchWxImages();
                content = fetchWxImages();
                // 将临时图片拷贝到正式存储路径下
                if (StringUtils.isNotEmpty(content)) {
                    content = CommonUtil.copyTempImage(content);
@ -658,11 +660,11 @@ public class ConsultController extends WeixinBaseController {
            List<String> failed = new ArrayList<>();
            for (ConsultTeamLog log : logs) {
                String response = ImUtill.sendTopicIM(getUID(),patient.getName(),consult,String.valueOf(log.getType()),log.getContent());
                String response = ImUtill.sendTopicIM(getUID(), patient.getName(), consult, String.valueOf(log.getType()), log.getContent());
                if (StringUtils.isNotEmpty(response)) {
                    JSONObject resObj = new JSONObject(response);
                    if(resObj.getInt("status")==-1){
                        return invalidUserException(new RuntimeException(resObj.getString("message")), -1, "追问失败!"+resObj.getString("message"));
                    if (resObj.getInt("status") == -1) {
                        return invalidUserException(new RuntimeException(resObj.getString("message")), -1, "追问失败!" + resObj.getString("message"));
                    }
                    failed.add(String.valueOf(resObj.get("data")));
                }
@ -690,7 +692,7 @@ public class ConsultController extends WeixinBaseController {
            if (consultModel == null) {
                return error(-1, "咨询记录不存在!");
            }
            JSONObject messageObj =  ImUtill.getTopicMessage(consultModel.getConsult(),consultModel.getStartMsgId(),consultModel.getEndMsgId(),page,pagesize,getUID());
            JSONObject messageObj = ImUtill.getTopicMessage(consultModel.getConsult(), consultModel.getStartMsgId(), consultModel.getEndMsgId(), page, pagesize, getUID());
            return write(200, "查询成功", "list", messageObj);
        } catch (Exception e) {
            error(e);

+ 50 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java

@ -2,8 +2,8 @@ package com.yihu.wlyy.web.third;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.service.app.reservation.PatientReservationService;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.guahao.GuahaoDoctor;
@ -57,8 +57,6 @@ public class BookingController extends WeixinBaseController {
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private SMSService smsService;
    /**
     * 根据城市编码获取相应挂号服务
     *
@ -75,7 +73,7 @@ public class BookingController extends WeixinBaseController {
    /**
     * 发送短信参数
     */
    private static List<NameValuePair> buildSmsParams(String content, String mobile) {
    private List<NameValuePair> buildSmsParams(String content, String mobile) {
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair("SpCode", SystemConf.getInstance().getSmsCode()));
        params.add(new BasicNameValuePair("LoginName", SystemConf.getInstance().getSmsName()));
@ -88,6 +86,24 @@ public class BookingController extends WeixinBaseController {
        return params;
    }
    private JSONObject toJson(String result) {
        JSONObject json = new JSONObject();
        try {
            String[] temps = result.split("&");
            for (String temp : temps) {
                if (temp.split("=").length != 2) {
                    continue;
                }
                String key = temp.split("=")[0];
                String value = temp.split("=")[1];
                json.put(key, value);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return json;
    }
    /**
     * 获取时间
     */
@ -296,6 +312,7 @@ public class BookingController extends WeixinBaseController {
//				} else {
//					//发送成功,保存到数据库
//				}
                BusinessLogs.info(BusinessLogs.BusinessType.appointment, p.getCode(), new JSONObject(obj));
                return write(200, "创建挂号单成功!");
            } else {
                return error(-1, "创建挂号单失败!");
@ -355,6 +372,29 @@ public class BookingController extends WeixinBaseController {
    /****************************************** 内网预约 ***************************************************************/
/*    @RequestMapping(value = "sendMessage", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("发送短信测试")
    public String sendMessage()
    {
        try {
            //发送短信消息,调用总部发送信息的接口
            String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams("测试", "13559207522"), "GBK");
            System.out.print(result);
            *//*JSONObject json = toJson(result);
            JSONObject result = smsService.sendMsg("13559207522", "测试");
            if (result != null && result.getInt("result") != 0) {
                System.out.print("短信提醒失败!(原因:" + result.getString("description") + ")");
            }*//*
            return error(-1, "创建挂号单失败!"+result);
        }
        catch (Exception e) {
            return error(-1, e.getMessage());
        }
    }*/
    @RequestMapping(value = "CreateOrderByDoctor", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("(内网)转诊预约挂号")
@ -397,9 +437,11 @@ public class BookingController extends WeixinBaseController {
                            obj.getDeptName() + obj.getDeptName() + "医生的号源。您可直接前往医院就诊。";
                    //发送短信消息,调用总部发送信息的接口
                    JSONObject result = smsService.sendMsg(patientPhone, msg);
                    if (result != null && result.getInt("result") != 0) {
                        des = "短信提醒失败!(原因:"+result.getString("description")+")";
                    String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, patientPhone), "GBK");
                    System.out.print(result);
                    JSONObject resultJson = toJson(result);
                    if (resultJson != null && resultJson.getInt("result") != 0) {
                        des = "短信提醒失败!(原因:"+resultJson.getString("description")+")";
                    }
                    // 推送消息给微信端
@ -421,6 +463,7 @@ public class BookingController extends WeixinBaseController {
                    else{
                        des +=" 微信提醒失败,患者无绑定微信!";
                    }
                    BusinessLogs.info(BusinessLogs.BusinessType.appointment, p.getCode(), new JSONObject(obj));
                }
                catch (Exception ex)
                {

+ 14 - 2
patient-co-wlyy/src/main/resources/logback.xml

@ -17,9 +17,18 @@
	</appender>
	<appender name="business" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>D:\business.log</file>
		<file>/usr/local/wlyy_logs/business.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>D:\business.%d{yyyy-MM-dd}.log</fileNamePattern>
			<fileNamePattern>/usr/local/wlyy_logs/business.%d{yyyy-MM-dd}.log</fileNamePattern>
		</rollingPolicy>
		<encoder>
			<pattern>%date{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern>
		</encoder>
	</appender>
	<appender name="interface_call" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/usr/local/wlyy_logs/interface_call.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<fileNamePattern>/usr/local/wlyy_logs/interface_call.%d{yyyy-MM-dd}.log</fileNamePattern>
		</rollingPolicy>
		<encoder>
			<pattern>%date{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern>
@ -35,6 +44,9 @@
	<logger name="com.yihu.wlyy.logs.BusinessLogs" level="INFO" additivity="false">
		<appender-ref ref="business" />
	</logger>
	<logger name="com.yihu.wlyy.logs.InterfaceCallLogs" level="INFO" additivity="false">
		<appender-ref ref="interface_call" />
	</logger>
	<root level="WARN">
		<appender-ref ref="console" />

+ 4 - 0
patient-co-wlyy/src/main/resources/system.properties

@ -42,6 +42,10 @@ image_path=/var/local/upload/images
voice_path=/var/local/upload/voice
chat_file_path=/var/local/upload/chat
#系统管理员token
admin_uid=admin
admin_token=0a5c5258-8863-4b07-a3f9-88c768528ab4
#-------------------------开发环境配置-------------------------#
# 服务器基本配置
server_ip=weixin.xmtyw.cn