Explorar o código

计划免疫-医生端接口

huangwenjie %!s(int64=7) %!d(string=hai) anos
pai
achega
5047ad24b1

+ 146 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/imm/ChildImmuneVaccin.java

@ -0,0 +1,146 @@
package com.yihu.wlyy.entity.imm;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 儿童可预约疫苗
 * @author huangwenjie
 * @date 2018/6/21 08:24
 */
@Entity
@Table(name = "wlyy_child_immune_vaccin")
public class ChildImmuneVaccin extends IdEntity {
	private String code;
	private String name;                    //儿童姓名
	private String idcard;                  //儿童身份证号
	private String ssc;                     //儿童社保卡号
	private String barcode;                 //儿童免疫条码
	private String ymkc;                    //true:可约,false:不可约
	private String ymmc;                    //疫苗名称
	private String ymkcsm;                  //疫苗库存说明(库存充足,可以预约/库存不足,不能预约)
	private String ymbm;                    //疫苗编码
	private String jzzc;                    //接种针次
	private Integer alert_tag;              //0待提醒,1已提醒
	private Date alert_time;                //提醒时间
	private Date create_time;               //创建时间
	private Date update_time;               //创建时间
	
	public String getCode() {
		return code;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getIdcard() {
		return idcard;
	}
	
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	
	public String getSsc() {
		return ssc;
	}
	
	public void setSsc(String ssc) {
		this.ssc = ssc;
	}
	
	public String getBarcode() {
		return barcode;
	}
	
	public void setBarcode(String barcode) {
		this.barcode = barcode;
	}
	
	public String getYmkc() {
		return ymkc;
	}
	
	public void setYmkc(String ymkc) {
		this.ymkc = ymkc;
	}
	
	public String getYmmc() {
		return ymmc;
	}
	
	public void setYmmc(String ymmc) {
		this.ymmc = ymmc;
	}
	
	public String getYmkcsm() {
		return ymkcsm;
	}
	
	public void setYmkcsm(String ymkcsm) {
		this.ymkcsm = ymkcsm;
	}
	
	public String getYmbm() {
		return ymbm;
	}
	
	public void setYmbm(String ymbm) {
		this.ymbm = ymbm;
	}
	
	public String getJzzc() {
		return jzzc;
	}
	
	public void setJzzc(String jzzc) {
		this.jzzc = jzzc;
	}
	
	public Integer getAlert_tag() {
		return alert_tag;
	}
	
	public void setAlert_tag(Integer alert_tag) {
		this.alert_tag = alert_tag;
	}
	
	public Date getCreate_time() {
		return create_time;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}
	
	public Date getUpdate_time() {
		return update_time;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public void setUpdate_time(Date update_time) {
		this.update_time = update_time;
	}
	
	public Date getAlert_time() {
		return alert_time;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public void setAlert_time(Date alert_time) {
		this.alert_time = alert_time;
	}
}

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildImmuneVaccinDao.java

@ -0,0 +1,16 @@
package com.yihu.wlyy.repository.imm;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author huangwenjie
 * @date 2018/6/21 09:38
 */
public interface ChildImmuneVaccinDao extends PagingAndSortingRepository<ChildImmuneVaccin, Long>,
		JpaSpecificationExecutor<ChildImmuneVaccin> {
	@Query("select p from ChildImmuneVaccin p where p.barcode=?1")
	ChildImmuneVaccin getChildImmuneVaccinByBarcode(String barcode);
}

+ 31 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java

@ -1,8 +1,10 @@
package com.yihu.wlyy.service.imm;
import com.yihu.wlyy.entity.imm.ChildFamilyImmune;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import com.yihu.wlyy.entity.imm.ChildInfo;
import com.yihu.wlyy.repository.imm.ChildFamilyImmuneDao;
import com.yihu.wlyy.repository.imm.ChildImmuneVaccinDao;
import com.yihu.wlyy.repository.imm.ChildInfoDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang.StringUtils;
@ -32,6 +34,8 @@ public class ChildFamilyImmuneService extends BaseService {
	private ChildInfoDao childInfoDao;
	@Autowired
	JdbcTemplate jdbcTemplate;
	@Autowired
	private ChildImmuneVaccinDao childImmuneVaccinDao;
	
	/**
	 * 绑定家庭成员免疫关系
@ -89,4 +93,31 @@ public class ChildFamilyImmuneService extends BaseService {
		List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql);
		return rs;
	}
	
	/**
	 * 获取签约居民待接种疫苗列表
	 * @param doctorcode
	 * @return
	 */
	public List<Map<String,Object>> getImmVaccinList(String doctorcode) {
		String sql = "select t.*,m.family_name,m.child_name,m.birthday from wlyy_child_immune_vaccin t " +
				" inner join ( " +
				" select a.*,b.name as family_name ,c.name as child_name,c.barcode as barcode ,c.birthday as birthday from  wlyy_child_family_immune a " +
				" inner join (select patient,name from wlyy_sign_family where type in (1,2) and `status` = 1 and expenses_status = 1 and doctor = '"+doctorcode+"') b " +
				" on a.family_code = b.patient " +
				" left join wlyy_child_info c on c.`code` = a.child_code " +
				") m on m.barcode = t.barcode ";
		
		List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql);
		return rs;
	}
	
	/**
	 * 根据免疫条码获取待接种免疫记录
	 * @param barcode
	 * @return
	 */
	public ChildImmuneVaccin getChildImmuneVaccinByBarcode(String barcode){
		return childImmuneVaccinDao.getChildImmuneVaccinByBarcode(barcode);
	}
}

+ 77 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.imm;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import com.yihu.wlyy.entity.imm.ChildInfoVO;
import com.yihu.wlyy.service.imm.ChildFamilyImmuneService;
import com.yihu.wlyy.service.imm.ChildInfoService;
@ -7,6 +8,7 @@ import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -77,4 +79,79 @@ public class DoctorImmController extends BaseController {
			return error(-1, e.getMessage());
		}
	}
	
	@RequestMapping(value = "/getImmVaccinList", method = RequestMethod.GET)
	@ApiOperation(value = "获取签约居民待接种疫苗列表")
	public String getImmVaccinList(@ApiParam(name = "doctorcode", value = "医生CODE", defaultValue = "")
	                               @RequestParam(value = "doctorcode", required = false) String doctorcode){
		
		try {
			
			if(StringUtils.isBlank(doctorcode)){
				doctorcode = getUID();
			}
			
			List<Map<String, Object>> immrs = childFamilyImmuneService.getImmVaccinList(doctorcode);
			JSONArray jsonArray = new JSONArray();
			if (immrs != null) {
				for (Map<String, Object> map : immrs) {
					JSONObject json = new JSONObject();
					json.put("child_code", map.get("child_code"));//儿童编码
					json.put("name", map.get("name"));//儿童姓名
					json.put("photo", map.get("photo"));//头像
					json.put("idcard", map.get("idcard"));//新生儿身份证号
					json.put("barcode", map.get("barcode"));//新生儿条码
					json.put("family_code", map.get("family_code"));//家人CODE
					json.put("relation", map.get("relation"));//---1父亲 2母亲 3老公 4老婆 5儿子 6女儿 7其他
					json.put("del", map.get("del"));//0为有效,1为删除状态
					jsonArray.put(json);
				}
			}
			return write(200, "查询成功", "data", jsonArray);
		} catch (Exception e) {
			e.printStackTrace();
			return error(-1, "查询失败");
		}
	}
	@RequestMapping(value = "/alertImmVacclinByDoctor", method = RequestMethod.POST)
	@ApiOperation(value = "医生批量提醒待接种疫苗接种")
	public String alertImmVacclinByDoctor(@ApiParam(name = "doctorcode", value = "医生CODE", defaultValue = "")
	                                      @RequestParam(value = "doctorcode", required = true) String doctorcode){
		try {
			// TODO: 2018/6/21
			return write(200, "请求成功");
		} catch (Exception e) {
			e.printStackTrace();
			return error(-1, "查询失败");
		}
	}
	
	@RequestMapping(value = "/alertImmVacclinByPatient", method = RequestMethod.POST)
	@ApiOperation(value = "医生提醒单个居民疫苗接种")
	public String alertImmVacclinByPatient(@ApiParam(name = "code", value = "待接种记录CODE", defaultValue = "")
	                                      @RequestParam(value = "待接种记录CODE", required = true) String code){
		try {
			// TODO: 2018/6/21
			return write(200, "请求成功");
		} catch (Exception e) {
			e.printStackTrace();
			return error(-1, "查询失败");
		}
	}
	
	@RequestMapping(value = "/getPatientImmVacclin", method = RequestMethod.GET)
	@ApiOperation(value = "根据儿童免疫条码获取待接种疫苗")
	public String getPatientImmVacclin(@ApiParam(name = "barcode", value = "儿童免疫编码", defaultValue = "")
	                                       @RequestParam(value = "儿童免疫编码", required = true) String barcode){
		try {
			ChildImmuneVaccin childImmuneVaccin = childFamilyImmuneService.getChildImmuneVaccinByBarcode(barcode);
			return write(200, "请求成功","data",childImmuneVaccin);
		} catch (Exception e) {
			e.printStackTrace();
			return error(-1, "查询失败");
		}
	}
	
	
}

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.family;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import com.yihu.wlyy.entity.imm.ChildInfo;
import com.yihu.wlyy.entity.imm.ChildInfoVO;
import com.yihu.wlyy.entity.patient.Patient;
@ -543,4 +544,17 @@ public class FamilyMemberController extends WeixinBaseController {
            return error(-1, e.getMessage());
        }
    }
    
    @RequestMapping(value = "/getPatientImmVacclin", method = RequestMethod.GET)
    @ApiOperation(value = "根据儿童免疫条码获取待接种疫苗")
    public String getPatientImmVacclin(@ApiParam(name = "barcode", value = "儿童免疫编码", defaultValue = "")
                                       @RequestParam(value = "儿童免疫编码", required = true) String barcode){
        try {
            ChildImmuneVaccin childImmuneVaccin = childFamilyImmuneService.getChildImmuneVaccinByBarcode(barcode);
            return write(200, "请求成功","data",childImmuneVaccin);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
}