浏览代码

Merge branch 'dev' of lyr/patient-co-management into dev

lyr 8 年之前
父节点
当前提交
1a911b27d9
共有 16 个文件被更改,包括 85 次插入29 次删除
  1. 39 5
      patient-co-wlyy/src/main/java/com/yihu/wlyy/logs/BusinessLogs.java
  2. 17 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/logs/InterfaceCallLogs.java
  3. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/archives/PatientEventService.java
  4. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  5. 8 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  6. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  7. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/archives/DoctorArchivesController.java
  8. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java
  9. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  10. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthGuidanceController.java
  11. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java
  12. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java
  13. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/archives/PatientArchivesController.java
  14. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java
  15. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/BookingController.java
  16. 4 4
      patient-co-wlyy/src/main/resources/logback.xml

+ 39 - 5
patient-co-wlyy/src/main/java/com/yihu/wlyy/logs/BusinessLogs.java

@ -1,10 +1,14 @@
package com.yihu.wlyy.logs;
import com.yihu.wlyy.util.DateUtil;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * 业务日志输出
 * <p>
@ -31,10 +35,12 @@ public class BusinessLogs {
        , appointment
        // 标签
        , label
        // 签约
        // 注册
        , register
        // 健康档案
        , archive
        // 签约
        , sign
    }
    /**
@ -43,9 +49,23 @@ public class BusinessLogs {
     * @param type 业务类别
     * @param info 日志信息
     */
    public static void info(BusinessType type, String user, JSONObject info) {
    public static void info(BusinessType type, String caller,String user, JSONObject info) {
        try {
            logger.info(type.ordinal() + " - " + user + " - " + info.toString());
            JSONObject log = new JSONObject();
            log.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()));
            log.put("logType", 2);
            log.put("caller", caller);
            JSONObject data = new JSONObject();
            data.put("businessType", type.ordinal());
            data.put("patient", user);
            data.put("data", info);
            log.put("data", data);
            logger.info(log.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
@ -57,9 +77,23 @@ public class BusinessLogs {
     * @param type 业务类别
     * @param info 日志信息
     */
    public static void info(BusinessType type, String user, JSONArray info) {
    public static void info(BusinessType type,String caller, String user, JSONArray info) {
        try {
            logger.info(type.ordinal() + " - " + user + " - " + info.toString());
            JSONObject log = new JSONObject();
            log.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()));
            log.put("logType", 2);
            log.put("caller", caller);
            JSONObject data = new JSONObject();
            data.put("businessType", type.ordinal());
            data.put("patient", user);
            data.put("data", info);
            log.put("data", data);
            logger.info(log.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }

+ 17 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/logs/InterfaceCallLogs.java

@ -4,6 +4,9 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * Created by lyr-pc on 2017/1/22.
 */
@ -18,7 +21,20 @@ public class InterfaceCallLogs {
     */
    public static void info(long time, String url, String user, String info) {
        try {
            logger.info(user + " - " + url + " - " + time + " - " + info.toString());
            JSONObject log = new JSONObject();
            log.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()));
            log.put("logType", 1);
            log.put("caller", user);
            JSONObject data = new JSONObject();
            data.put("responseTime", time);
            data.put("url", url);
            data.put("params", info);
            log.put("data", data);
            logger.info(log.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/archives/PatientEventService.java

@ -72,7 +72,7 @@ public class PatientEventService {
     * 保存就诊事件详情
     */
    @Transactional
    public void saveEventDetail(String data) throws Exception {
    public void saveEventDetail(String data,String caller) throws Exception {
        JSONObject json = new JSONObject(data);
        PatientEvent event = new PatientEvent();
        if (!StringUtils.isEmpty(json.optString("id"))) {
@ -128,7 +128,7 @@ public class PatientEventService {
            }
            patientEventImgDao.save(imgList);
        }
        BusinessLogs.info(BusinessLogs.BusinessType.archive, es.getPatient(), new JSONObject(es));
        BusinessLogs.info(BusinessLogs.BusinessType.archive, caller, es.getPatient(), new JSONObject(es));
    }
    /**

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

@ -929,7 +929,7 @@ public class SignPatientLabelInfoService extends BaseService {
     * @param custom      自定义标签
     * @return
     */
    public int setPatientLabels(String patient, String idcard, String patientName, String health, String disease, String custom, String doctor) {
    public int setPatientLabels(String patient, String idcard, String patientName, String health, String disease, String custom, String doctor, String caller) {
        Patient p = patientDao.findByCode(patient);
        if (p == null && (StringUtils.isEmpty(idcard) || StringUtils.isEmpty(patientName))) {
@ -1141,7 +1141,7 @@ public class SignPatientLabelInfoService extends BaseService {
            }
        }
        BusinessLogs.info(BusinessLogs.BusinessType.label, patient, logArray);
        BusinessLogs.info(BusinessLogs.BusinessType.label, caller, patient, logArray);
        return 1;
    }

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

@ -15,6 +15,7 @@ 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.entity.patient.SignFamilyCode;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.consult.ConsultTeamDao;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.doctor.*;
@ -969,7 +970,7 @@ public class FamilyContractService extends BaseService {
        // 患者标签设置
        if (!(labelInfoService.setPatientLabels(patient.getCode(), patient.getIdcard(),
                patient.getName(), healthLabel, disease, customLabel, sf.getDoctor()) == 1)) {
                patient.getName(), healthLabel, disease, customLabel, sf.getDoctor(), signDoctorCode) == 1)) {
            throw new Exception("patient sign label settting error:" + patient.getIdcard());
        }
@ -993,6 +994,7 @@ public class FamilyContractService extends BaseService {
            PushMsgTask.getInstance().putWxMsg(access_token, 1, sf.getOpenid(), sf.getName(), json);
            new Thread(new SignUploadTask(sf.getCode())).start();
        }
        BusinessLogs.info(BusinessLogs.BusinessType.sign, signDoctorCode, sf.getPatient(), new JSONObject(sf));
        return temp;
    }
@ -1018,6 +1020,7 @@ public class FamilyContractService extends BaseService {
                                 String healthLabel, String customLabel, String disease,
                                 String expenses, long adminTeamCode) throws Exception {
        JSONObject result = new JSONObject();
        String caller = "";
        if (type != 1 && type != 2) {
            result.put("status", -1);
            return result;
@ -1114,10 +1117,12 @@ public class FamilyContractService extends BaseService {
                //设置全科医生
                sf.setDoctor(doctor);
                sf.setDoctorName(doctorName);
                caller = sf.getDoctorHealth();
            } else {
                // 更新健康管理师
                sf.setDoctorHealth(healthDoctor);
                sf.setDoctorHealthName(healthDoctorName);
                caller = sf.getDoctor();
            }
            AdminTeam team = doctorAdminTeamDao.findOne(adminTeamCode);
@ -1200,7 +1205,7 @@ public class FamilyContractService extends BaseService {
        // 患者标签设置
        if (!(labelInfoService.setPatientLabels(p.getCode(), p.getIdcard(),
                p.getName(), healthLabel, disease, customLabel, sf.getDoctor()) == 1)) {
                p.getName(), healthLabel, disease, customLabel, sf.getDoctor(), caller) == 1)) {
            throw new Exception("patient sign label settting error:" + p.getIdcard());
        }
@ -1226,6 +1231,7 @@ public class FamilyContractService extends BaseService {
            new Thread(new SignUploadTask(sf.getCode())).start();
        }
        result.put("status", 1);
        BusinessLogs.info(BusinessLogs.BusinessType.sign, caller, sf.getPatient(), new JSONObject(sf));
        return result;
    }

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

@ -312,7 +312,7 @@ public class WechatController extends WeixinBaseController {
            if (json != null) {
                try {
                    Patient p = patientDao.findByIdcard(idcard);
                    BusinessLogs.info(BusinessLogs.BusinessType.register, p.getCode(), new JSONObject(p));
                    BusinessLogs.info(BusinessLogs.BusinessType.register, p.getCode(), p.getCode(), new JSONObject(p));
                } catch (Exception e) {
                    e.printStackTrace();
                }

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/archives/DoctorArchivesController.java

@ -154,7 +154,7 @@ public class DoctorArchivesController extends BaseController {
                                 @RequestParam(value="data",required = true) String data)
    {
        try {
            patientEventService.saveEventDetail(data);
            patientEventService.saveEventDetail(data, getUID());
            return write(200, "保存就诊事件成功!");
        } catch (Exception e) {

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

@ -116,7 +116,7 @@ public class DoctorFollowUpController extends BaseController {
            if (followups != null) {
                for (Followup followup : followups) {
                    BusinessLogs.info(BusinessLogs.BusinessType.followup, followup.getPatientCode(), new JSONObject(followup));
                    BusinessLogs.info(BusinessLogs.BusinessType.followup, getUID(), followup.getPatientCode(), new JSONObject(followup));
                }
            }

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

@ -419,7 +419,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                }
                for (HealthEduArticlePatient heap : list) {
                    BusinessLogs.info(BusinessLogs.BusinessType.article, heap.getPatient(), new JSONObject(heap));
                    BusinessLogs.info(BusinessLogs.BusinessType.article, getUID(), heap.getPatient(), new JSONObject(heap));
                }
                // 推送消息给患者

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

@ -151,7 +151,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", p.getName());
					BusinessLogs.info(BusinessLogs.BusinessType.guidance, patient, new JSONObject(guidance));
					BusinessLogs.info(BusinessLogs.BusinessType.guidance, getUID(), patient, new JSONObject(guidance));
					return success("保存成功!");
				} else {
					return error(-1, "保存失败!");
@ -189,7 +189,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", p.getName());
					BusinessLogs.info(BusinessLogs.BusinessType.guidance, patient, new JSONObject(guidance));
					BusinessLogs.info(BusinessLogs.BusinessType.guidance, getUID(), patient, new JSONObject(guidance));
					//发送成功记录模板发送次数
					doctorGuidanceTempService.countSend(modelCode);
					return success("保存成功!");

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -246,7 +246,7 @@ public class SignPatientLabelInfoController extends BaseController {
                return error(-1, "健康情况标签不能为空");
            }
            int result = labelInfoService.setPatientLabels(patient, "", "", health, disease, custom ,getUID());
            int result = labelInfoService.setPatientLabels(patient, "", "", health, disease, custom ,getUID(), getUID());
            if (result == 0) {
                return error(-1, "查不到患者信息");

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

@ -318,7 +318,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            } else {
                try {
                    Patient p = patientService.findByIdcard(idcard);
                    BusinessLogs.info(BusinessLogs.BusinessType.register, p.getCode(), new JSONObject(p));
                    BusinessLogs.info(BusinessLogs.BusinessType.register, getUID(), p.getCode(), new JSONObject(p));
                } catch (Exception e) {
                    e.printStackTrace();
                }

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/archives/PatientArchivesController.java

@ -157,7 +157,7 @@ public class PatientArchivesController extends WeixinBaseController {
                                 @RequestParam(value="data",required = true) String data)
    {
        try {
            patientEventService.saveEventDetail(data);
            patientEventService.saveEventDetail(data, getUID());
            return write(200, "保存就诊事件成功!");
        } catch (Exception e) {

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

@ -329,7 +329,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));
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getUID(), getUID(), new JSONObject(consult));
            return write(200, "提交成功", "data", consult);
        } catch (Exception ex) {
            error(ex);
@ -401,7 +401,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));
            BusinessLogs.info(BusinessLogs.BusinessType.consult, getUID(), getUID(), new JSONObject(consult));
            return write(200, "提交成功", "data", consult);
        } catch (Exception ex) {
            error(ex);

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

@ -312,7 +312,7 @@ public class BookingController extends WeixinBaseController {
//				} else {
//					//发送成功,保存到数据库
//				}
                BusinessLogs.info(BusinessLogs.BusinessType.appointment, p.getCode(), new JSONObject(obj));
                BusinessLogs.info(BusinessLogs.BusinessType.appointment, getUID(), p.getCode(), new JSONObject(obj));
                return write(200, "创建挂号单成功!");
            } else {
                return error(-1, "创建挂号单失败!");
@ -463,7 +463,7 @@ public class BookingController extends WeixinBaseController {
                    else{
                        des +=" 微信提醒失败,患者无绑定微信!";
                    }
                    BusinessLogs.info(BusinessLogs.BusinessType.appointment, p.getCode(), new JSONObject(obj));
                    BusinessLogs.info(BusinessLogs.BusinessType.appointment, getUID(), p.getCode(), new JSONObject(obj));
                }
                catch (Exception ex)
                {

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

@ -22,7 +22,7 @@
			<fileNamePattern>/usr/local/wlyy_logs/rolling/business_m.%d{yyyy-MM-dd_HH-mm}.log</fileNamePattern>
		</rollingPolicy>
		<encoder>
			<pattern>%date{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern>
			<pattern>%msg%n</pattern>
		</encoder>
	</appender>
	<appender name="business_d" class="ch.qos.logback.core.rolling.RollingFileAppender">
@ -31,7 +31,7 @@
			<fileNamePattern>/usr/local/wlyy_logs/dayLogs/business.%d{yyyy-MM-dd}.log</fileNamePattern>
		</rollingPolicy>
		<encoder>
			<pattern>%date{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern>
			<pattern>%msg%n</pattern>
		</encoder>
	</appender>
	<appender name="interface_call_m" class="ch.qos.logback.core.rolling.RollingFileAppender">
@ -40,7 +40,7 @@
			<fileNamePattern>/usr/local/wlyy_logs/rolling/interface_call_m.%d{yyyy-MM-dd_HH-mm}.log</fileNamePattern>
		</rollingPolicy>
		<encoder>
			<pattern>%date{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern>
			<pattern>%msg%n</pattern>
		</encoder>
	</appender>
	<appender name="interface_call_d" class="ch.qos.logback.core.rolling.RollingFileAppender">
@ -49,7 +49,7 @@
			<fileNamePattern>/usr/local/wlyy_logs/dayLogs/interface_call.%d{yyyy-MM-dd}.log</fileNamePattern>
		</rollingPolicy>
		<encoder>
			<pattern>%date{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern>
			<pattern>%msg%n</pattern>
		</encoder>
	</appender>