Explorar el Código

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

chenweida hace 7 años
padre
commit
b87bf7ef2b

+ 2 - 2
patient-co/patient-co-wlyy-job/src/main/resources/application.yml

@ -175,11 +175,11 @@ spring:
  datasource:
    wlyy:
      url: jdbc:mysql://59.61.92.94:3306/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: jkzl_root
      password: jkzlehr@321465
    health:
      url: jdbc:mysql://59.61.92.94:3306/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: wlyy
#      password: jkzlehr@321465
      username: jkzl_root

BIN
patient-co/patient-co-wlyy/doc/接口文档/对外接口文档/集美健康教育/集美健康教育对外接口文档.docx


+ 97 - 69
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/DoctorService.java

@ -1,10 +1,11 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.service.common.account;
import com.yihu.wlyy.entity.organization.Hospital;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -13,6 +14,8 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.persistence.DynamicSpecifications;
@ -36,72 +39,97 @@ import java.util.*;
@Component
@Transactional(rollbackFor = Exception.class)
public class DoctorService extends TokenService {
	@Autowired
	private DoctorDao doctorDao;
	private Clock clock = Clock.DEFAULT;
	public Doctor findDoctorByCode(String code) {
		return doctorDao.findByCode(code);
	}
	public Doctor findDoctorByMobile(String mobile) {
		return doctorDao.findByMobile(mobile);
	}
	public JSONObject registerDoctor(Doctor doctor, String imei) throws Exception {
		EncodesUtil.entryptPassword(doctor);
		doctor.setCode(getCode());
		doctor.setCzrq(clock.getCurrentDate());
		Doctor temp = doctorDao.save(doctor);
		if (temp != null) {
			//生成登录tokey
			Token token = newToken(doctor.getCode(), imei, 2);
			if (token != null) {
				//生成登录信息成功
				JSONObject json = new JSONObject();
				json.put("uid", doctor.getCode());
				json.put("token", token.getToken());
				return json;
			}
		}
		return null;
	}
	/**
	 * 修改医生密码
	 */
	public void updateDoctorPwd(Doctor doctor) {
		//EncodesUtil.entryptPassword(doctor);
		doctor.setIsPasswordPrompt("1");
		doctorDao.save(doctor);
	}
	public List<Doctor> famousDoctorList(String name) {
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		if (StringUtils.isNoneEmpty(name)) {
			name="%"+name+"%";
			return doctorDao.doctorFamousDoctorList(name);
		}else{
			return doctorDao.doctorFamousDoctorList();
		}
	}
	public List<Doctor> getDoctorFamousDoctorList(String name) {
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
		if (StringUtils.isNoneEmpty(name)) {
			name="%"+name+"%";
			return doctorDao.doctorFamousDoctorList(name);
		}else{
			return doctorDao.doctorFamousDoctorList();
		}
	}
	public Doctor findbyIdCard(String idcard) {
		return doctorDao.findbyIdCard(idcard);
	}
    @Autowired
    private DoctorDao doctorDao;
    private Clock clock = Clock.DEFAULT;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public Doctor findDoctorByCode(String code) {
        return doctorDao.findByCode(code);
    }
    public Doctor findDoctorByMobile(String mobile) {
        return doctorDao.findByMobile(mobile);
    }
    public JSONObject registerDoctor(Doctor doctor, String imei) throws Exception {
        EncodesUtil.entryptPassword(doctor);
        doctor.setCode(getCode());
        doctor.setCzrq(clock.getCurrentDate());
        Doctor temp = doctorDao.save(doctor);
        if (temp != null) {
            //生成登录tokey
            Token token = newToken(doctor.getCode(), imei, 2);
            if (token != null) {
                //生成登录信息成功
                JSONObject json = new JSONObject();
                json.put("uid", doctor.getCode());
                json.put("token", token.getToken());
                return json;
            }
        }
        return null;
    }
    /**
     * 修改医生密码
     */
    public void updateDoctorPwd(Doctor doctor) {
        //EncodesUtil.entryptPassword(doctor);
        doctor.setIsPasswordPrompt("1");
        doctorDao.save(doctor);
    }
    public List<Doctor> famousDoctorList(String name) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        if (StringUtils.isNoneEmpty(name)) {
            name = "%" + name + "%";
            return doctorDao.doctorFamousDoctorList(name);
        } else {
            return doctorDao.doctorFamousDoctorList();
        }
    }
    public List<Doctor> getDoctorFamousDoctorList(String name) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        if (StringUtils.isNoneEmpty(name)) {
            name = "%" + name + "%";
            return doctorDao.doctorFamousDoctorList(name);
        } else {
            return doctorDao.doctorFamousDoctorList();
        }
    }
    public Doctor findbyIdCard(String idcard) {
        return doctorDao.findbyIdCard(idcard);
    }
    public List<Doctor> findDoctors(String hospitalCode,String doctorName,Integer level, Integer page, Integer pagesize) {
        String sql = "select * from wlyy_doctor where del=1 and status=1   ";
        List<Object> args = new ArrayList<>();
        if (!org.springframework.util.StringUtils.isEmpty(hospitalCode)) {
            sql += " and hospital = ? ";
            args.add(hospitalCode);
        }
        if (!org.springframework.util.StringUtils.isEmpty(doctorName)) {
            sql += " and name like ? ";
            args.add("%"+doctorName+"%");
        }
        if (level!=null) {
            sql += " and level = ? ";
            args.add(level);
        }
        sql += " limit " + (page * pagesize) + "," + pagesize;
        List<Doctor> doctorList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Doctor.class));
        return doctorList;
    }
}

+ 24 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/doctor/GcDoctorController.java

@ -7,6 +7,7 @@ import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.web.gateway.vo.DoctorModel;
import com.yihu.wlyy.web.gateway.vo.PatientModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultOneModel;
import com.yihu.wlyy.web.gateway.vo.base.ResultPageListModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -17,6 +18,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 */
@ -41,6 +45,26 @@ public class GcDoctorController {
        return new ResultOneModel(doctorModel);
    }
    @RequestMapping(value = "/doctors", method = RequestMethod.GET)
    @ApiOperation("医生列表")
    public ResultPageListModel<DoctorModel> doctors(
            @ApiParam(name = "hospitalCode", value = "机构code", required = false) @RequestParam(value = "hospitalCode", required = false) String hospitalCode,
            @ApiParam(name = "name", value = "医生名称(支持模糊)", required = false) @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "level", value = "类型:1专科医生,2全科医生,3健康管理师", required = false) @RequestParam(value = "level", required = false) Integer level,
            @ApiParam(name = "page", value = "当前页(1开始)", required = false) @RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页大小", required = false) @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize
    ) {
        List<Doctor> doctors = doctorService.findDoctors(hospitalCode, name, level, page, pageSize);
        List<DoctorModel> doctorModelList = new ArrayList<>();
        doctors.stream().forEach(one -> {
            DoctorModel doctorModel = new DoctorModel();
            BeanUtils.copyProperties(one, doctorModel);
            doctorModelList.add(doctorModel);
        });
        return new ResultPageListModel(page, pageSize, doctorModelList);
    }
    @RequestMapping(value = "/patient", method = RequestMethod.GET)
    @ApiOperation("根据患者code查询患者信息")
    public ResultOneModel<PatientModel> patient(

+ 2 - 3
patient-co/patient-co-wlyy/src/main/resources/application.yml

@ -183,14 +183,13 @@ express:
##正式的配置
spring:
  profiles: prod
  datasource:
    wlyy:
      url: jdbc:mysql://59.61.92.94:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: jkzl_root
      password: jkzlehr@321465
    health:
      url: jdbc:mysql://59.61.92.94:3306/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:8079/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
#      username: wlyy
#      password: jkzlehr@321465
      username: jkzl_root