Browse Source

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

lyr 8 years ago
parent
commit
fbc68a71ec

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

@ -23,8 +23,10 @@ import com.yihu.wlyy.repository.doctor.DoctorPatientDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.health.PatientHealthGuidanceService;
import com.yihu.wlyy.util.HttpUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
@ -72,6 +74,8 @@ public class ConsultTeamService extends ConsultService {
    private DoctorTeamMemberDao doctorTeamDoctor;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private PatientHealthGuidanceService guidanceService;
    /**
     * 查询患者是否还有未结束的三师咨询
@ -596,7 +600,17 @@ public class ConsultTeamService extends ConsultService {
        List<ConsultTeamLog> logs = new ArrayList<ConsultTeamLog>();
        // 添加问题咨询日志
        String content = "";
        content = "咨询问题:" + (StringUtils.isEmpty(ct.getSymptoms()) ? "无" : ct.getSymptoms());
        if(ct.getGuidance() > 0){
            JSONObject json = guidanceService.findById(ct.getGuidance());
            if(json == null){
                throw new Exception("guidance not exist");
            }
            content += "医生" + (json.get("doctorName") != null? json.get("doctorName").toString():"")
                    + "发出的指导:" + (json.getString("content") != null ? json.getString("content").toString() :"") + "<br/>";
        }
        content += "咨询问题:" + (StringUtils.isEmpty(ct.getSymptoms()) ? "无" : ct.getSymptoms());
        // 生成提问日志,并推送相关消息
        ConsultTeamLog infoLog = new ConsultTeamLog();

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthGuidanceService.java

@ -50,7 +50,7 @@ public class PatientHealthGuidanceService extends BaseService {
			obj.put("patientName",p.getName());
			return obj;
		}else{
			return new JSONObject();
			return null;
		}
	}

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

@ -109,20 +109,37 @@ public class SignPatientLabelInfoService extends BaseService {
            args = new Object[]{doctor, teamCode};
        } else {
            if (labelCode.equals("0")) {
                sql = "select a.*" +
                        " from" +
                        "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 and admin_team_code = ?) a" +
                        " left join" +
                        "     (select * from wlyy_sign_patient_label_info where label_type = ? and status = 1) b" +
                        " on a.patient = b.patient where b.patient is null limit " + start + "," + pagesize;
                args = new Object[]{doctor, teamCode, labelType};
                sql = "SELECT " +
                        "    t1.* " +
                        " FROM " +
                        "    wlyy_sign_family t1 " +
                        " left join " +
                        "    wlyy_sign_patient_label_info t2 " +
                        " on t1.patient = t2.patient " +
                        " WHERE " +
                        "    t2.label_type = ? " +
                        "    AND t2.status = 1 " +
                        "    AND t2.patient is null " +
                        "    AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? limit " + start + "," + pagesize;
                args = new Object[]{labelType, doctor, teamCode};
            } else {
                sql = "select a.*" +
                        " from" +
                        "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 and admin_team_code = ?) a" +
                        " join" +
                        "     (select * from wlyy_sign_patient_label_info where label = ? and label_type = ? and status = 1) b" +
                        " on a.patient = b.patient limit " + start + "," + pagesize;
                sql = "SELECT " +
                        "    t1.* " +
                        " FROM " +
                        "    wlyy_sign_family t1, " +
                        "    wlyy_sign_patient_label_info t2 " +
                        " WHERE " +
                        "    t2.label = ? " +
                        "    AND t2.label_type = ? " +
                        "    AND t2.status = 1 " +
                        "    AND t1.patient = t2.patient " +
                        "    AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                        "    AND t1.status > 0 " +
                        "    AND t1.admin_team_code = ? limit " + start + "," + pagesize;
                args = new Object[]{doctor, teamCode, labelCode, labelType};
            }
        }
@ -347,30 +364,45 @@ public class SignPatientLabelInfoService extends BaseService {
                    }
                } else {
                    if (label.getLabelCode().equals("0")) {
                        sql = "select count(DISTINCT a.patient) count" +
                                " from" +
                                "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
                                (teamCode > 0 ? "and admin_team_code = ?" : "") + ") a " +
                                " left join" +
                                "     (select * from wlyy_sign_patient_label_info where label_type = ? and status = 1) b" +
                                " on a.patient = b.patient where b.patient is null ";
                        sql = " SELECT " +
                                "     count(DISTINCT t1.patient) count " +
                                " FROM" +
                                "     wlyy_sign_family t1 " +
                                " left join " +
                                "    wlyy_sign_patient_label_info t2 " +
                                " on t1.patient = t2.patient " +
                                " WHERE" +
                                "     t2.label_type = ? " +
                                "     AND t2.status = 1 " +
                                "     AND t2.patient is null " +
                                "     AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                                "     AND t1.status > 0 " +
                                (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "");
                        if (teamCode > 0) {
                            args = new Object[]{doctor, teamCode, labelType};
                        } else {
                            args = new Object[]{doctor, labelType};
                        }
                    } else {
                        sql = "select count(DISTINCT a.patient) count" +
                                " from" +
                                "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
                                (teamCode > 0 ? "and admin_team_code = ?" : "") + ") a " +
                                " join" +
                                "     (select * from wlyy_sign_patient_label_info where label = ? and label_type = ? and status = 1) b" +
                                " on a.patient = b.patient ";
                        sql = " SELECT " +
                                "     count(DISTINCT t1.patient) count " +
                                " FROM" +
                                "     wlyy_sign_family t1, " +
                                "     wlyy_sign_patient_label_info t2 " +
                                " WHERE" +
                                "     t1.patient = t2.patient " +
                                "     AND t2.label = ? " +
                                "     AND t2.label_type = ? " +
                                "     AND t2.status = 1 " +
                                "     AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                                "     AND t1.status > 0 " +
                                (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "");
                        if (teamCode > 0) {
                            args = new Object[]{doctor, teamCode, label.getLabelCode(), labelType};
                            args = new Object[]{label.getLabelCode(), labelType, doctor, teamCode};
                        } else {
                            args = new Object[]{doctor, label.getLabelCode(), labelType};
                            args = new Object[]{label.getLabelCode(), labelType, doctor};
                        }
                    }
                }
@ -587,22 +619,30 @@ public class SignPatientLabelInfoService extends BaseService {
        Map<String, JSONObject> result = new HashMap<>();
        List<Map<String, Object>> signList = new ArrayList<>();
        page = page*pagesize;
        page = page * pagesize;
        Object[] args = null;
        String sql = "select a.*" +
                " from" +
                "     (select * from wlyy_sign_family where " + (doc.getLevel() == 2 ? " doctor" : "doctor_health") + " = ? and status > 0 " +
                (teamCode > 0 ? (" and admin_team_code = " + teamCode) : "") + " ) a" +
                (StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ? " join " : " left join ")+
                "     (select * from wlyy_sign_patient_label_info where status = 1 " +
                (StringUtils.isNotEmpty(labelCode) ? " and label = ? " : "") +
                (StringUtils.isNotEmpty(labelType) ? " and label_type = ? " : "") + ") b" +
                " on a.patient = b.patient where a.name like ? or b.label_name like ? limit " + page + "," + pagesize;
        String sql = "SELECT " +
                        "    t1.* " +
                        " FROM " +
                        "    wlyy_sign_family t1 " +
                        (StringUtils.isNotEmpty(labelCode) || StringUtils.isNotEmpty(labelType) ?
                                " join " : " left join ") +
                        "    wlyy_sign_patient_label_info t2 " +
                        " ON t1.patient = t2.patient " +
                        " WHERE " +
                        (StringUtils.isNotEmpty(labelCode) ? " t2.label = ? " : "") +
                        (StringUtils.isNotEmpty(labelType) ? " and t2.label_type = ? " : "") +
                        "    AND t2.status = 1 " +
                        "    AND t1." + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                        "    AND t1.status > 0 " +
                        "    AND (t1.name like ? OR t2.label_name like ?) " +
                        (teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "")
                        + " limit " + page + "," + pagesize;
        if (StringUtils.isNotEmpty(labelCode)) {
            args = new Object[]{doctor, labelCode, labelType, "%" + filter + "%", "%" + filter + "%"};
            args = new Object[]{labelCode, labelType, doctor, "%" + filter + "%", "%" + filter + "%"};
        } else if (StringUtils.isEmpty(labelCode) && StringUtils.isNotEmpty(labelType)) {
            args = new Object[]{doctor, labelType, "%" + filter + "%", "%" + filter + "%"};
            args = new Object[]{labelType, doctor, "%" + filter + "%", "%" + filter + "%"};
        } else {
            args = new Object[]{doctor, "%" + filter + "%", "%" + filter + "%"};
        }

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

@ -37,6 +37,7 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
	 * @return
	 */
	@RequestMapping(value = "/id")
	@ResponseBody
	public String getHealthGuidance(Long id){
		try{
			if(id == null || id < 1){

+ 1 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/PatientHealthGuidanceController.java

@ -51,6 +51,7 @@ public class PatientHealthGuidanceController extends BaseController {
	 * @return
	 */
	@RequestMapping(value = "/id")
	@ResponseBody
	public String getHealthGuidance(Long id){
		try{
			if(id == null || id < 1){