瀏覽代碼

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

huangwenjie 7 年之前
父節點
當前提交
aec1112152

+ 133 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/vaccin/Vaccin.java

@ -0,0 +1,133 @@
package com.yihu.wlyy.entity.vaccin;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * 国家疫苗表
 * @author zhangdan
 * @date 2018/08/15 14:17
 */
@Entity
@Table(name = "wlyy_vaccin")
public class Vaccin extends IdEntity implements Serializable {
	
	private static final long serialVersionUID = 8358924836164389434L;
	
	// 业务主键
	private String code;
	//识别码
	private String discriminateCode;
	//疫苗名称
	private String name;
	//疫苗类型 1一类  2二类
	private int type;
	//副标题
	private String subtitle;
	//简介
	private String summary;
	//不良反应
	private String untowardEffect;
	//禁忌症
	private String contraindication;
	//接种反应
	private String vaccinEffect;
	//注意事项
	private String useWarn;
	//温馨提示
	private String hint;
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getDiscriminateCode() {
		return discriminateCode;
	}
	public void setDiscriminateCode(String discriminateCode) {
		this.discriminateCode = discriminateCode;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public String getSubtitle() {
		return subtitle;
	}
	public void setSubtitle(String subtitle) {
		this.subtitle = subtitle;
	}
	public String getSummary() {
		return summary;
	}
	public void setSummary(String summary) {
		this.summary = summary;
	}
	public String getUntowardEffect() {
		return untowardEffect;
	}
	public void setUntowardEffect(String untowardEffect) {
		this.untowardEffect = untowardEffect;
	}
	public String getContraindication() {
		return contraindication;
	}
	public void setContraindication(String contraindication) {
		this.contraindication = contraindication;
	}
	public String getVaccinEffect() {
		return vaccinEffect;
	}
	public void setVaccinEffect(String vaccinEffect) {
		this.vaccinEffect = vaccinEffect;
	}
	public String getUseWarn() {
		return useWarn;
	}
	public void setUseWarn(String useWarn) {
		this.useWarn = useWarn;
	}
	public String getHint() {
		return hint;
	}
	public void setHint(String hint) {
		this.hint = hint;
	}
}

+ 103 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/vaccin/VaccinPlan.java

@ -0,0 +1,103 @@
package com.yihu.wlyy.entity.vaccin;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * 国家疫苗计划表
 * @author zhangdan
 * @date 2018/08/15
 */
@Entity
@Table(name = "wlyy_vaccin_plan")
public class VaccinPlan extends IdEntity implements Serializable {
	
	private static final long serialVersionUID = 8358924836164389434L;
	
	// 业务主键
	private String code;
	//识别码
	private String vaccinCode;
	//接种年纪
	// (0:0月龄、1:1月龄、2:2月龄、3 4 5 6 7 8 18(同理以上等于相同的月龄)
	// 24:18~24月龄、25:2岁、26:3岁、27:4岁、28:6岁、29:6~12岁)
	private String inoculationAge;
	//是否间隔打疫苗 0否1是
	private int isInterval;
	//间隔时间(月份)
	private int intervalTime;
	//是否特定人群 0否 1是
	private int specificPopulation;
	//特定人群年纪
	private String specificAge;
	//备注
	private String remark;
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getVaccinCode() {
		return vaccinCode;
	}
	public void setVaccinCode(String vaccinCode) {
		this.vaccinCode = vaccinCode;
	}
	public String getInoculationAge() {
		return inoculationAge;
	}
	public void setInoculationAge(String inoculationAge) {
		this.inoculationAge = inoculationAge;
	}
	public int getIsInterval() {
		return isInterval;
	}
	public void setIsInterval(int isInterval) {
		this.isInterval = isInterval;
	}
	public int getIntervalTime() {
		return intervalTime;
	}
	public void setIntervalTime(int intervalTime) {
		this.intervalTime = intervalTime;
	}
	public int getSpecificPopulation() {
		return specificPopulation;
	}
	public void setSpecificPopulation(int specificPopulation) {
		this.specificPopulation = specificPopulation;
	}
	public String getSpecificAge() {
		return specificAge;
	}
	public void setSpecificAge(String specificAge) {
		this.specificAge = specificAge;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
}

+ 3 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/common/SystemConfig.java

@ -69,6 +69,9 @@ public class SystemConfig {
        return  getSystemProperties().getProperty("gateway_licence");
    }
    public String getAccId(){
        return  getSystemProperties().getProperty("accId");
    }
    public String getPublicKey() { return  getSystemProperties().getProperty("gateway_public_key"); }
    public String getJwHospital()

+ 337 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java

@ -0,0 +1,337 @@
package com.yihu.wlyy.service.controller;
import com.yihu.wlyy.service.common.model.Result;
import com.yihu.wlyy.service.entity.PatientReservation;
import com.yihu.wlyy.service.service.JMService;
import com.yihu.wlyy.service.service.guahao.GuahaoDoctor;
import com.yihu.wlyy.service.service.guahao.GuahaoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 计划免疫接口
 * */
@Controller
@RequestMapping(value = "/third/jm/")
@Api(description = "计划免疫接口")
public class JMController {
	@Autowired
	JMService jmService;
	@RequestMapping(value = "/imm/GetChildrenInfo",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取免疫接种儿童信息")
	public Result GetChildrenInfo(@ApiParam(name="barCode",value="条形编码",defaultValue = "0052248552")
								@RequestParam String barCode)
	{
		try {
			
			String data = jmService.GetChildrenInfo(barCode);
			
			return Result.success("获取儿童信息成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	
	@RequestMapping(value = "/imm/GetOrgImmuneList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取免疫接种机构列表")
	public Result GetOrgImmuneList()
	{
		try {
			
			String data = jmService.GetOrgImmuneList();
			
			return Result.success("获取免疫接种机构列表!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	
	@RequestMapping(value = "/imm/GetOrgNumberList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取免疫接种号源")
	public Result GetOrgNumberList(@ApiParam(name="orgId",value="机构编码",defaultValue = "350206")
	                               @RequestParam String orgId,
	                               @ApiParam(name="ScheduleId",value="排班ID",defaultValue = "350211B10402017080901")
	                               @RequestParam String ScheduleId)
	{
		try {
			
			String data = jmService.GetOrgNumberList(orgId,ScheduleId);
			
			return Result.success("获取免疫接种号源!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	
	@RequestMapping(value = "/imm/get/GetOrgNumberList",method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("计免:获取免疫接种号源")
	public Result GetOrgNumberListGet(@ApiParam(name="orgId",value="机构编码",defaultValue = "350206")
	                               @RequestParam String orgId,
	                               @ApiParam(name="ScheduleId",value="排班ID",defaultValue = "350211B10402017080901")
	                               @RequestParam String ScheduleId)
	{
		try {
			
			String data = jmService.GetOrgNumberList(orgId,ScheduleId);
			
			return Result.success("获取免疫接种号源!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	
	@RequestMapping(value = "/imm/GetOrgScheduleList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取免疫接种排班信息")
	public Result GetOrgScheduleList(@ApiParam(name="OrgCode",value="机构编码",defaultValue = "350211B1040")
	                               @RequestParam String OrgCode,
	                               @ApiParam(name="StartTime",value="开始日期",defaultValue = "2017-08-09")
	                               @RequestParam String StartTime,
	                               @ApiParam(name="EndTime",value="结束日期",defaultValue = "2017-08-10")
	                               @RequestParam String EndTime)
	{
		try {
			
			String data = jmService.GetOrgScheduleList(OrgCode,StartTime,EndTime);
			
			return Result.success("获取免疫接种排班信息!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	
	@RequestMapping(value = "/imm/get/GetOrgScheduleList",method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("计免:获取免疫接种排班信息")
	public Result GetOrgScheduleListGet(@ApiParam(name="OrgCode",value="机构编码",defaultValue = "350211B1040")
	                                 @RequestParam String OrgCode,
	                                 @ApiParam(name="StartTime",value="开始日期",defaultValue = "2017-08-09")
	                                 @RequestParam String StartTime,
	                                 @ApiParam(name="EndTime",value="结束日期",defaultValue = "2017-08-10")
	                                 @RequestParam String EndTime)
	{
		try {
			
			String data = jmService.GetOrgScheduleList(OrgCode,StartTime,EndTime);
			
			return Result.success("获取免疫接种排班信息!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	
	@RequestMapping(value = "/imm/GetOrgScheduleAndNumberList",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取免疫接种排班信息和号源信息")
	public Result GetOrgScheduleAndNumberList(@ApiParam(name="OrgCode",value="机构编码",defaultValue = "")
	                                          @RequestParam String OrgCode)
	{
		try {
			
			String data = jmService.GetOrgScheduleAndNumberList(OrgCode);
			
			return Result.success("获取免疫接种排班信息和号源信息!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	
	@RequestMapping(value = "/imm/get/GetOrgScheduleAndNumberList",method = RequestMethod.GET)
	@ResponseBody
	@ApiOperation("计免:获取免疫接种排班信息和号源信息")
	public Result GetOrgScheduleAndNumberListGet(@ApiParam(name="OrgCode",value="机构编码",defaultValue = "")
	                                          @RequestParam String OrgCode)
	{
		try {
			
			String data = jmService.GetOrgScheduleAndNumberList(OrgCode);
			
			return Result.success("获取免疫接种排班信息和号源信息!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	
	@RequestMapping(value = "/imm/GetResImmuneListWithBarCode",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:根据条形码获取预约记录")
	public Result GetResImmuneListWithBarCode(@ApiParam(name="BarCode",value="条形编码",defaultValue = "")
	                                 @RequestParam String BarCode)
	{
		try {
			
			String data = jmService.GetResImmuneListWithBarCode(BarCode);
			
			return Result.success("根据条形码获取预约记录!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	
	@RequestMapping(value = "/imm/RegisterImmune",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:免疫接种确认预约")
	public Result RegisterImmune(@ApiParam(name="BarCode",value="条形编码",defaultValue = "")
	                             @RequestParam String BarCode,
	                             @ApiParam(name="OrgCode",value="机构编码",defaultValue = "")
	                             @RequestParam String OrgCode,
	                             @ApiParam(name="SectionType",value="坐诊类型",defaultValue = "")
	                             @RequestParam String SectionType,
	                             @ApiParam(name="strStart",value="日期:第一次坐诊开始日期",defaultValue = "")
	                             @RequestParam String strStart,
	                             @ApiParam(name="SSID",value="市民社保卡号",defaultValue = "")
	                             @RequestParam String SSID,
	                             @ApiParam(name="PatientName",value="儿童姓名",defaultValue = "")
	                             @RequestParam String PatientName,
	                             @ApiParam(name="PatientID",value="儿童身份证号",defaultValue = "")
	                             @RequestParam String PatientID,
	                             @ApiParam(name="PatientPhone",value="市民手机号",defaultValue = "")
	                             @RequestParam String PatientPhone)
	{
		try {
			
			String data = jmService.RegisterImmune(BarCode,OrgCode,SectionType,strStart,SSID,PatientName,PatientID,PatientPhone);
			
			return Result.success("免疫接种确认预约成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	
	@RequestMapping(value = "/imm/UnResRegisterImmune",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:免疫接种取消预约")
	public Result UnResRegisterImmune(@ApiParam(name="BarCode",value="条形编码",defaultValue = "")
	                             @RequestParam String BarCode,
	                             @ApiParam(name="OrgCode",value="机构编码",defaultValue = "")
	                             @RequestParam String OrgCode,
	                             @ApiParam(name="SectionType",value="坐诊类型",defaultValue = "")
	                             @RequestParam String SectionType,
	                             @ApiParam(name="strStart",value="日期:第一次坐诊开始日期",defaultValue = "")
	                             @RequestParam String strStart,
	                             @ApiParam(name="SSID",value="市民社保卡号",defaultValue = "")
	                             @RequestParam String SSID,
	                             @ApiParam(name="PatientName",value="儿童姓名",defaultValue = "")
	                             @RequestParam String PatientName,
	                             @ApiParam(name="PatientID",value="儿童身份证号",defaultValue = "")
	                             @RequestParam String PatientID,
	                             @ApiParam(name="PatientPhone",value="市民手机号",defaultValue = "")
	                             @RequestParam String PatientPhone)
	{
		try {
			
			String data = jmService.UnResRegisterImmune(BarCode,OrgCode,SectionType,strStart,SSID,PatientName,PatientID,PatientPhone);
			
			return Result.success("免疫接种取消预约成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "/imm/getToken",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取口令")
	public Result getToken()
	{
		try {
			String data = jmService.getToken();
			return Result.success("获取口令成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "/imm/ymjsAll",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取社区疫苗字典")
	public Result ymjsAll()
	{
		try {
			String data = jmService.ymjsAll();
			return Result.success("获取社区疫苗字典成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "/imm/findWzymBymykh",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取计划免疫接种记录")
	public Result findWzymBymykh()
	{
		try {
			String data = jmService.findWzymBymykh();
			return Result.success("获取计划免疫接种记录成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "/imm/findMyVaccin",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:查询儿童可预约疫苗")
	public Result findMyVaccin(@RequestParam(value = "deptNum")String deptNum,
							   @RequestParam(value = "etmykh")String etmykh)
	{
		try {
			String data = jmService.findMyVaccin(deptNum,etmykh);
			return Result.success("查询儿童可预约疫苗成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "/imm/findDept",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取接种门诊")
	public Result findMyVaccin(@RequestParam(value = "etmykh")String etmykh)
	{
		try {
			String data = jmService.findDept(etmykh);
			return Result.success("获取接种门诊成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
}

+ 527 - 0
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/JMService.java

@ -0,0 +1,527 @@
package com.yihu.wlyy.service.service;
import cn.com.zoe.crypto.jna.CryptoKey;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.service.common.SystemConfig;
import com.yihu.wlyy.service.common.http.HttpApiException;
import com.yihu.wlyy.service.common.util.DateUtil;
import com.yihu.wlyy.service.common.util.SOAPUtil;
import com.yihu.wlyy.service.dao.*;
import com.yihu.wlyy.service.entity.Patient;
import com.yihu.wlyy.service.entity.PatientReservation;
import com.yihu.wlyy.service.entity.SignFamily;
import com.yihu.wlyy.service.service.guahao.GuahaoDoctor;
import com.zoe.phip.ssp.sdk.ApiException;
import net.sf.json.JSON;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
 * Created by hzp on 2016/8/13.
 * 厦门市民健康网挂号服务
 */
@Service
public class JMService {
    private String GET_TOKEN="getToken";
    private String FIND_MY_VACCIN="findMyVaccin";
    private String FIND_CHILDREN = "findChildren";
    private String FIND_DEPT="findDept";//获取接种门诊
    private String redis_key ="imm:imm_token_key";
    private String accId = SystemConfig.getInstance().getAccId();
    @Autowired
    private PatientDao patientDao;
    @Autowired
    public DoctorDao doctorDao;
    @Autowired
    private HospitalMappingDao hospitalMappingDao;
    @Autowired
    private PatientReservationDao patientReservationDao;
    @Autowired
    SignFamilyDao signFamilyDao;
    @Autowired
    private LogService logService;
    @Autowired
    private StringRedisTemplate redisTemplate;
    
    @Value("${zyapi.openCrypto}")
    private Boolean openCrypto;
    
    @Value("${imm.url}")
    private String immUrl;
    
    @Value("${imm.credential}")
    private String immcredential;
    /***********************************************************************************************************************************************/
    
    /**
     * 计免预约Post接口
     */
    private String immPostSecond(String apistr,String content, Map<String,String> params) throws Exception
    {
        String re = "";
    
        ZysoftApi api = ZysoftApi.getSingleton();
        CryptoKey key = api.buildCryptoKey();
        if(!params.containsKey("Credential")&&!params.containsKey("Key")) {
            //strCredential和strKey设置
            params.put("Credential", api.encodeParam(key,immcredential));
            params.put("Key", key.getKey());
        }
        
        String msgBody = net.sf.json.JSONObject.fromObject(params).toString();
        //System.out.print("params:"+msgBody+"\r\n");
        //新增日志
        String method = "POST";
        Boolean isSuccess = true;
        String error = "";
        
        int times = 0;
        try {
//            re = api.post("jhmy/"+apistr, params, null,false);
            re = api.post(immUrl+"/"+apistr, params, null,false);
    
            //---结果验证,并保存日志 ---START
            if (StringUtils.isEmpty(re)) {
                // 请求失败
                //保存http日志
                logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,"接口返回的结果为空");
                throw new Exception("接口返回的结果为空");
            } else if (StringUtils.startsWith(re, "System-Error")) {
                // 调用失败
                //保存http日志
                error = re.substring(re.indexOf(":") + 1, re.length());
                logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
                throw new Exception(error);
            } else if (StringUtils.startsWith(re, "Error")) {
                // 调用失败
                //保存http日志
                error = re.substring(re.indexOf(":") + 1, re.length());
                logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
                throw new Exception(error);
            }
            //---结果验证,并保存日志 ---END
            
            //保存http日志
            logService.saveHttpLog(isSuccess,apistr,content,method,apistr, net.sf.json.JSONObject.fromObject(params).toString(),re,error);
        }
        catch (Exception ex)
        {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
            isSuccess = false;
            
            //保存http日志
            logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
            
            if(ex instanceof ApiException)
            {
                ApiException apiEx = (ApiException) ex;
                throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
            }
            else{
                throw new HttpApiException(-1,ex.getMessage());
            }
        }
        
        return re;
    }
    
    
    /**
     * 计免请求结果验证,并保存日志
     * @param url
     * @param content
     * @param method
     * @param msgBody
     * @param res
     */
    private void  verificationImmResult(String result,String title,String url,String content,String method,String msgBody,String res) throws Exception{
        String error = "";
        Boolean isSuccess = false;
        if (StringUtils.isEmpty(result)) {
            // 请求失败
            //保存http日志
            error = title;
            logService.saveHttpLog(isSuccess,url,content,method,null,msgBody,res,error,logService.archiveType);
            throw new Exception(error);
        } else if (StringUtils.startsWith(result, "System-Error")) {
            // 调用失败
            //保存http日志
            error = result.substring(result.indexOf(":") + 1, result.length());
            logService.saveHttpLog(isSuccess,url,content,method,null,msgBody,res,error,logService.archiveType);
            throw new Exception(error);
        } else if (StringUtils.startsWith(result, "Error")) {
            // 调用失败
            //保存http日志
            error = result.substring(result.indexOf(":") + 1, result.length());
            logService.saveHttpLog(isSuccess,url,content,method,null,msgBody,res,error,logService.archiveType);
            throw new Exception(error);
        }
    }
    
    /**
     * 获取免疫接种儿童信息
     * @param credential 条形编码
     * @return
     */
    public String GetChildrenInfo(String credential)throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("etmykh", credential);
        result = immPostSecond(FIND_CHILDREN,"计免预约-获取儿童信息成功",params);
    
        if (StringUtils.startsWith(result, "OK")) {
            // 调用失败
            //保存http日志
            result = result.substring(result.indexOf(":") + 1, result.length());
        }
    
        com.alibaba.fastjson.JSONObject data = com.alibaba.fastjson.JSONObject.parseObject(result);
    
        if(data.containsKey("OK")){
            result = data.getString("OK");
        }
        
        return result;
    }
    /**
     * 获取免疫接种机构列表
     * @return
     */
    public String GetOrgImmuneList()throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
    
        String condition = "<root><zone>350203</zone><zone>350206</zone><zone>350205</zone><zone>350211</zone><zone>350212</zone><zone>350213</zone></root>";
        String[] values = SOAPUtil.getCredential(condition, true);
//        System.out.println(condition);
    
        ZysoftApi api =  ZysoftApi.getSingleton();
        CryptoKey key = api.buildCryptoKey();
        params.put("Condition", api.encodeParam(key,condition));
        params.put("Credential", api.encodeParam(key,immcredential));
        params.put("Key", key.getKey());
        return immPostSecond("GetOrgImmuneList","计免预约-获取免疫接种机构列表",params);
    }
    /**
     * 获取免疫接种号源
     * @param orgId 机构编码
     * @param scheduleId 排班ID
     * @return
     */
    public String GetOrgNumberList(String orgId, String scheduleId) throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("OrgId", orgId);
        params.put("ScheduleId", scheduleId);
        return immPostSecond("GetOrgNumberList","计免预约-获取免疫接种号源",params);
    }
    
    /**
     * 获取免疫接种排班信息
     * @param orgCode 机构编码
     * @param strStart 开始时间
     * @param strEnd 结束时间
     * @return
     * @throws Exception
     */
    public String GetOrgScheduleList(String orgCode, String strStart, String strEnd) throws Exception {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("OrgCode", orgCode);
        params.put("StartTime", strStart);
        params.put("EndTime", strEnd);
        return immPostSecond("GetOrgScheduleList","计免预约-获取免疫接种排班信息",params);
    }
    
    /**
     * 根据条形编码获取预约记录
     * @param barCode
     * @return
     * @throws Exception
     */
    public String GetResImmuneListWithBarCode(String barCode) throws Exception{
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("BarCode", barCode);
        return immPostSecond("GetResImmuneListWithBarCode","计免预约-根据条形编码获取预约记录",params);
    }
    
    /**
     * 获取免疫接种排班信息和号源信息
     * @param orgCode
     * @return
     * @throws Exception
     */
    public String GetOrgScheduleAndNumberList(String orgCode)throws Exception {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("OrgCode", orgCode);
        return immPostSecond("GetOrgScheduleAndNumberList","计免预约-获取免疫接种排班信息和号源信息",params);
    }
    
    /**
     *免疫接种确认预约
     * @param barCode
     * @param orgCode
     * @param sectionType
     * @param strStart
     * @param ssid
     * @param patientName
     * @param patientID
     * @param patientPhone
     * @return
     */
    public String RegisterImmune(String barCode,
                                 String orgCode,
                                 String sectionType,
                                 String strStart,
                                 String ssid,
                                 String patientName,
                                 String patientID,
                                 String patientPhone)throws Exception {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("BarCode", barCode);
        params.put("OrgCode", orgCode);
        params.put("SectionType", sectionType);
        params.put("StartTime", strStart);
        params.put("SSID", ssid);
        params.put("PatientName", patientName);
        params.put("PatientID", patientID);
        params.put("PatientPhone", patientPhone);
        result = immPostSecond("RegisterImmune","计免预约-免疫接种确认预约",params);
    
        if (StringUtils.startsWith(result, "OK")){
            result = "OK";
        }
    
        return result;
    }
    
    /**
     * 免疫接种取消预约
     * @param barCode
     * @param orgCode
     * @param sectionType
     * @param strStart
     * @param ssid
     * @param patientName
     * @param patientID
     * @param patientPhone
     * @return
     * @throws Exception
     */
    public String UnResRegisterImmune(String barCode,
                                      String orgCode,
                                      String sectionType,
                                      String strStart,
                                      String ssid,
                                      String patientName,
                                      String patientID,
                                      String patientPhone) throws Exception {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("BarCode", barCode);
        params.put("OrgCode", orgCode);
        params.put("SectionType", sectionType);
        params.put("StartTime", strStart);
        params.put("SSID", ssid);
        params.put("PatientName", patientName);
        params.put("PatientID", patientID);
        params.put("PatientPhone", patientPhone);
        result = immPostSecond("UnResRegisterImmune","计免预约-免疫接种确认预约",params);
    
        if (StringUtils.startsWith(result, "OK")){
            result = "OK";
        }
    
        return result;
    }
     /***************************************易联众计免接口**********************************************************/
    /**
     * 计免预约Post接口
     */
    private String ylzImmGetSecond(String apistr,String content, Map<String,String> params) throws Exception
    {
        String re = "";
        ZysoftApi api = ZysoftApi.getSingleton();
        //新增日志
        String method = "GET";
        Boolean isSuccess = true;
        String error = "";
        int times = 0;
        try {
            re = api.get(immUrl+"/"+apistr, params, null,false);
            //---结果验证,并保存日志 ---START
            if (StringUtils.isEmpty(re)) {
                // 请求失败
                //保存http日志
                logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,"接口返回的结果为空");
                throw new Exception("接口返回的结果为空");
            } else if (StringUtils.startsWith(re, "System-Error")) {
                // 调用失败
                //保存http日志
                error = re.substring(re.indexOf(":") + 1, re.length());
                logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
                throw new Exception(error);
            } else if (StringUtils.startsWith(re, "Error")) {
                // 调用失败
                //保存http日志
                error = re.substring(re.indexOf(":") + 1, re.length());
                logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
                throw new Exception(error);
            }
            //---结果验证,并保存日志 ---END
            //保存http日志
            logService.saveHttpLog(isSuccess,apistr,content,method,apistr, net.sf.json.JSONObject.fromObject(params).toString(),re,error);
            //保存token到reids
            if (isSuccess && apistr.equals(GET_TOKEN)){
                //System.out.println();
                redisTemplate.opsForValue().set(redis_key, com.alibaba.fastjson.JSON.parseObject(re).getString("body"),4,TimeUnit.HOURS);
            }
        }
        catch (Exception ex)
        {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
            isSuccess = false;
            //保存http日志
            logService.saveHttpLog(isSuccess,apistr,content,method,apistr,net.sf.json.JSONObject.fromObject(params).toString(),re,error);
            if(ex instanceof ApiException)
            {
                ApiException apiEx = (ApiException) ex;
                throw new HttpApiException(apiEx.errorCode(),ex.getMessage());
            }
            else{
                throw new HttpApiException(-1,ex.getMessage());
            }
        }
        return re;
    }
    private String apiString = "Action";
    /**
     * 获取口令,4小时有效,465439011
     * @return
     */
    public String getToken() throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("act", GET_TOKEN);
        params.put("accId", accId);
        return ylzImmGetSecond("getToken","计免预约-获取口令",params);
    }
    /**
     * 获取社区疫苗字典
     * @return
     */
    public String ymjsAll() throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("act", "ymjsAll");
        params.put("accId", "q9Bt3TE00KaigEW5EJVIMA==");
        params.put("_token", "525870222");
        return ylzImmGetSecond(apiString,"计免预约-获取社区疫苗字典",params);
    }
    /**
     * 获取计划免疫接种记录
     * @return
     */
    public String findWzymBymykh() throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("act", "findWzymBymykh");
        params.put("accId", "q9Bt3TE00KaigEW5EJVIMA==");
        params.put("_token", "118328844");
        params.put("etmykh", "0052182708");
        return ylzImmGetSecond(apiString,"计免预约-获取计划免疫接种记录",params);
    }
    /**
     * 获取计划免疫接种记录
     * @return
     */
    public String findMyVaccin(String deptNum ,String etmykh) throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("act", FIND_MY_VACCIN);
        params.put("accId", accId);
        params.put("token", getTokenCheck());
        params.put("deptNum",deptNum);
        params.put("etmykh", etmykh);
        //params.put("etmykh", "0052182708");
        return ylzImmGetSecond(FIND_MY_VACCIN,"计免预约-获取计划免疫接种记录",params);
    }
    /**
     * 获取接种门诊
     * @param etmykh
     * @return
     * @throws Exception
     */
    public String findDept(String etmykh) throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("act", FIND_DEPT);
        params.put("accId", accId);
        params.put("token", getTokenCheck());
        params.put("etmykh", etmykh);
        //params.put("etmykh", "0052182708");
        return ylzImmGetSecond(FIND_DEPT,"计免预约-获取接种门诊",params);
    }
    public String getTokenCheck() throws Exception{
        String token = "";
        if (!redisTemplate.hasKey(redis_key)){
            getToken();
        }
        token = redisTemplate.opsForValue().get(redis_key).toString();
        return token;
    }
}

+ 17 - 16
patient-co-service/wlyy_service/src/main/resources/system.properties

@ -1,20 +1,21 @@
###基卫测试环境服务
#gateway_url = http://117.25.173.18:18280/
#gateway_licence = 5YGl5bq45LmL7Lev
#gateway_public_key = PublicKeyTest.key
#jw_hospital = 350211B1013
#jw_licence = 5YGl5bq45LmL7Lev
#ca_url = http://117.29.183.114:8081/XMCAService?wsdl
#ca_namespace = http://platfomservice.xmca.com/
gateway_url = http://117.25.173.18:18280/
gateway_licence = 5YGl5bq45LmL7Lev
accId= q9Bt3TE00KaigEW5EJVIMA==
gateway_public_key = PublicKeyTest.key
jw_hospital = 350211B1013
jw_licence = 5YGl5bq45LmL7Lev
ca_url = http://117.29.183.114:8081/XMCAService?wsdl
ca_namespace = http://platfomservice.xmca.com/
##基卫服务
guahao_url =  http://10.95.18.10/urp.service/urp.open.service/ReservationPulic.asmx
guahao_namespace = http://www.zysoft.com.cn/
gateway_url = http://10.95.21.21:18280/
gateway_licence = 5YGl5bq45LmL7Lev
gateway_public_key = PublicGov.key
jw_hospital = 350211B1004
jw_licence = 5YGl5bq35LmL6LevMzUwMjExQjEwMDQ=
ca_url = http://10.95.21.21:18280/base/XMCA6_UnifiedCallInterface
ca_namespace = http://platfomservice.xmca.com/
#guahao_url =  http://10.95.18.10/urp.service/urp.open.service/ReservationPulic.asmx
#guahao_namespace = http://www.zysoft.com.cn/
#gateway_url = http://10.95.21.21:18280/
#gateway_licence = 5YGl5bq45LmL7Lev
#gateway_public_key = PublicGov.key
#jw_hospital = 350211B1004
#jw_licence = 5YGl5bq35LmL6LevMzUwMjExQjEwMDQ=
#ca_url = http://10.95.21.21:18280/base/XMCA6_UnifiedCallInterface
#ca_namespace = http://platfomservice.xmca.com/

+ 17 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -607,21 +607,23 @@ public class FamilyMemberService extends BaseService {
                for (PatientFamilyTemp temp:tempList){
                    JSONObject obj = new JSONObject();
                    Patient p = patientDao.findByCode(temp.getFamilyMember());
                    obj.put("code", p.getCode());
                    obj.put("name", p.getName());
                    obj.put("sex", p.getSex());
                    obj.put("isAuthorize", 0);//0:未授权,1:已授权
                    obj.put("birthday", p.getBirthday());
                    obj.put("idcard", StringUtils.isEmpty(p.getIdcard()) ? "" : p.getIdcard());
                    obj.put("photo", p.getPhoto());
                    obj.put("mobile", p.getMobile());
                    obj.put("address", StringUtils.isEmpty(p.getAddress()) ? "" : p.getAddress());
                    obj.put("familyRelation", temp.getFamilyRelation());
                    obj.put("familyRelationName", relations.get(temp.getFamilyRelation()));
                    obj.put("signType", 0);
                    obj.put("state","0");//0 :未处理;1:已同意;2:已拒绝
                    obj.put("id",temp.getId());
                    resultArray.put(obj);
                    if (p!=null){
                        obj.put("code", p.getCode());
                        obj.put("name", p.getName());
                        obj.put("sex", p.getSex());
                        obj.put("isAuthorize", 0);//0:未授权,1:已授权
                        obj.put("birthday", p.getBirthday());
                        obj.put("idcard", StringUtils.isEmpty(p.getIdcard()) ? "" : p.getIdcard());
                        obj.put("photo", p.getPhoto());
                        obj.put("mobile", p.getMobile());
                        obj.put("address", StringUtils.isEmpty(p.getAddress()) ? "" : p.getAddress());
                        obj.put("familyRelation", temp.getFamilyRelation());
                        obj.put("familyRelationName", relations.get(temp.getFamilyRelation()));
                        obj.put("signType", 0);
                        obj.put("state","0");//0 :未处理;1:已同意;2:已拒绝
                        obj.put("id",temp.getId());
                        resultArray.put(obj);
                    }
                }
            }
        }

+ 101 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/vaccin/VaccinService.java

@ -0,0 +1,101 @@
package com.yihu.wlyy.service.app.vaccin;
import com.google.common.collect.Lists;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeamMember;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamilyRenew;
import com.yihu.wlyy.entity.vaccin.Vaccin;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyRenewDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.third.jw.JwSignService;
import com.yihu.wlyy.util.PinYinUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
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.springframework.util.StringUtils;
import java.util.*;
/**
 * 国家免疫计划
 *
 * @author 张丹
 */
@Component
@Transactional
public class VaccinService extends BaseService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public Map<String,Object> getVaccinPlanList(){
        String sql ="SELECT vp.`code`," +
                "vp.vaccin_code vaccinCode," +
                "v.`name`," +
                "v.type," +
                "vp.is_interval isInterval," +
                "vp.interval_time intervalTime," +
                "vp.specific_population specificPopulation," +
                "vp.specific_age specificAge," +
                "vp.remark," +
                "vp.inoculation_age inoculationAge" +
                " FROM `wlyy_vaccin_plan` vp LEFT JOIN wlyy_vaccin v " +
                " ON vp.vaccin_code = v.`code` ORDER BY inoculationAge";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        Map<String,Object> result = new HashedMap();
        for (Map<String,Object> map : list){
            //不是特定人群
            if (!String.valueOf(map.get("specificPopulation")).equals("1")){
                List<Map<String,Object>> mapList = (List<Map<String,Object>>)result.get(String.valueOf(map.get("inoculationAge")));
                if (mapList==null){
                    mapList = new ArrayList<>();
                }
                    mapList.add(map);
                result.put(String.valueOf(map.get("inoculationAge")),mapList);
            }else {
                List<Map<String,Object>> mapList = (List<Map<String,Object>>)result.get("specificPopulation");
                if (mapList==null){
                    mapList = new ArrayList<>();
                }
                mapList.add(map);
                result.put("specificPopulation",mapList);
            }
        }
        return  result;
    }
    public Vaccin getVaccinInfo(String vaccinCode){
        String sql ="SELECT * FROM wlyy_vaccin WHERE code='"+vaccinCode+"'";
        List<Vaccin> vaccinList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(Vaccin.class));
        if (vaccinList!=null && vaccinList.size()>0){
            return  vaccinList.get(0);
        }else {
            return null;
        }
    }
}

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java

@ -99,7 +99,7 @@ public class ChildFamilyImmuneService extends BaseService {
	 * @param doctorcode
	 * @return
	 */
	public List<Map<String,Object>> getImmVaccinList(String doctorcode) {
	public List<Map<String,Object>> getImmVaccinList(String doctorcode,int pageNo,int pageSize) {
		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 " +
@ -107,7 +107,9 @@ public class ChildFamilyImmuneService extends BaseService {
				" on a.family_code = b.patient " +
				" left join wlyy_child_info c on c.`code` = a.child_code " +
				") m on m.barcode = t.barcode ";
		
		int start = (pageNo-1)*pageSize;
		sql +=" limit "+start+","+pageSize;
		List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql);
		return rs;
	}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java

@ -47,7 +47,7 @@ public class ImmuneService {
	 * @throws Exception
	 */
	public String GetChildrenInfo(String barcode) throws Exception{
		String url = jwUrl + "/third/guahao/imm/GetChildrenInfo";
		String url = jwUrl + "/third/jm/imm/GetChildrenInfo";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("barCode", barcode));
		

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

@ -4,6 +4,7 @@ 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;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -82,16 +83,20 @@ public class DoctorImmController extends BaseController {
	
	@RequestMapping(value = "/getImmVaccinList", method = RequestMethod.GET)
	@ApiOperation(value = "获取签约居民待接种疫苗列表")
	public String getImmVaccinList(@ApiParam(name = "doctorcode", value = "医生CODE", defaultValue = "")
	                               @RequestParam(value = "doctorcode", required = false) String doctorcode){
	public String getImmVaccinList(@ApiParam(name = "doctorCode", value = "医生CODE", defaultValue = "")@RequestParam(value = "doctorCode", required = false) String doctorCode,
								   @ApiParam(name = "pageNo", value = "页码", defaultValue = "1")@RequestParam(value = "pageNo", required = true) String pageNo,
								   @ApiParam(name = "pageSize", value = "页面显示条数", defaultValue = "10") @RequestParam(value = "pageSize", required = false) String pageSize){
		
		try {
			if (StringUtils.isEmpty(pageNo)){
				pageNo="1";
			}
			
			if(StringUtils.isBlank(doctorcode)){
				doctorcode = getUID();
			if(StringUtils.isBlank(doctorCode)){
				doctorCode = getUID();
			}
			
			List<Map<String, Object>> immrs = childFamilyImmuneService.getImmVaccinList(doctorcode);
			List<Map<String, Object>> immrs = childFamilyImmuneService.getImmVaccinList(doctorCode,Integer.valueOf(pageNo),Integer.valueOf(pageSize));
			JSONArray jsonArray = new JSONArray();
			if (immrs != null) {
				for (Map<String, Object> map : immrs) {
@ -103,6 +108,10 @@ public class DoctorImmController extends BaseController {
					json.put("ymkc", map.get("ymkc"));//true:可约,false:不可约
					json.put("alert_tag", map.get("alert_tag"));//0待提醒,1已提醒
					json.put("barcode", map.get("barcode"));//儿童免疫条码
					String idCard = String.valueOf(map.get("idcard"));
					json.put("sex",IdCardUtil.getSexForIdcard_new(idCard));//性别
					json.put("jzzc",map.get("jzzc"));//接种针次
					json.put("ymkc",map.get("ymkc"));//true:可约,false:不可约
					jsonArray.put(json);
				}
			}

+ 41 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java

@ -7,6 +7,7 @@ import com.yihu.wlyy.entity.message.SMS;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.entity.vaccin.Vaccin;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.imm.ChildImmuneRegisterRecordDao;
@ -15,6 +16,7 @@ import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.app.reservation.PatientReservationService;
import com.yihu.wlyy.service.app.vaccin.VaccinService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.imm.ChildInfoService;
import com.yihu.wlyy.service.third.guahao.GuahaoXMService;
@ -88,6 +90,8 @@ public class PatientBookingController extends WeixinBaseController{
    private ChildImmuneRegisterRecordDao childImmuneRegisterRecordDao;
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private VaccinService vaccinService;
    @RequestMapping(value = "CancelOrder", method = RequestMethod.POST)
@ -537,7 +541,43 @@ public class PatientBookingController extends WeixinBaseController{
            return error(-1, e.getMessage());
        }
    }
    
    @RequestMapping(value = "/getVaccinPlan", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:获取免疫计划表")
    public String getVaccinPlan (){
        try{
            return write(200, "查询成功!","data",vaccinService.getVaccinPlanList());
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/getVaccinInfo", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:获取免疫详情")
    public String getVaccinInfo (@ApiParam(name="vaccinCode",value="疫苗code",defaultValue = "")@RequestParam String vaccinCode){
        try{
            if (StringUtils.isEmpty(vaccinCode)){
                return write(-1, "参数不能为空!");
            }
             Vaccin vaccin = vaccinService.getVaccinInfo(vaccinCode);
            if (vaccin!=null){
                return write(200, "查询成功!","data",vaccin);
            }else {
                return write(-1, "疫苗不存在!");
            }
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    /**
     * 发送短信参数