Browse Source

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

huangwenjie 7 years ago
parent
commit
96101ba280

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

@ -1,8 +1,18 @@
package com.yihu.wlyy.service.third.guahao;
package com.yihu.wlyy.service.third.guahao;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -10,8 +20,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.text.SimpleDateFormat;
import java.util.*;
/**
/**
 * 免疫接种预约挂号
 * 免疫接种预约挂号
@ -28,6 +38,10 @@ public class ImmuneService {
	private HttpClientUtil httpClientUtil;
	private HttpClientUtil httpClientUtil;
	@Autowired
	@Autowired
	private JdbcTemplate jdbcTemplate;
	private JdbcTemplate jdbcTemplate;
	@Autowired
	private HospitalMappingDao hospitalMappingDao;
	@Autowired
	private HospitalDao hospitalDao;
	
	
	
	
	/**
	/**
@ -45,4 +59,447 @@ public class ImmuneService {
		
		
		return response;
		return response;
	}
	}
	
	/**
	 * 计免:获取免疫接种机构列表
	 * @return
	 * @throws Exception
	 */
	public List<Map<String,String>> getOrgImmuneList()throws Exception {
		
		List<Map<String, String>> re = new ArrayList<>();
		
		String url = jwUrl + "/third/guahao/imm/GetOrgImmuneList";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("Condition", ""));
		
		String response = httpClientUtil.post(url, params, "UTF-8");
		
		JSONObject data = JSONObject.parseObject(response);
		int status = data.getInteger("status");
		String xml = data.getString("data");
		if(200 == status && StringUtils.isNotBlank(xml)){
			Document document = DocumentHelper.parseText(xml);
			Element root = document.getRootElement();
			List<?> child = root.elements();
			for (Object o : child) {
				Element e = (Element) o;
				String shortName = e.attribute("short_name").getValue();//机构简称
				String code = e.attribute("code").getValue();//机构编码
				String name = e.getText();//机构全称
				String zone_name = e.attribute("zone_name").getValue();//行政区
				String zone_code = e.attribute("zone_code").getValue();//行政区编码
				Map<String, String> map = new HashMap<>();
				map.put("id", code);
				map.put("shortName", shortName);//机构简称
				map.put("name", name);//机构全称
				map.put("zone_name", zone_name);//行政区名称
				map.put("zone_code", zone_code);//行政区编码
				String photo = hospitalMappingDao.getPhotoByMappingCode(code, "1");
				map.put("photo", photo);
				re.add(map);
			}
		}else{
			throw new Exception("获取免疫接种机构列表息失败!");
		}
		
		return re;
	}
	
	/**
	 * 计免:获取免疫接种排班信息和号源信息
	 * @param orgCode
	 * @return
	 */
	public JSONObject getOrgScheduleAndNumberList(String orgCode) throws Exception{
	
		String url = jwUrl + "/imm/GetOrgScheduleAndNumberList";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("OrgCode", "orgCode"));
		String response = httpClientUtil.post(url, params, "UTF-8");
		JSONObject data = JSONObject.parseObject(response);
		int status = data.getInteger("status");
		String xml = data.getString("data");
//		int status = 200;
//		String xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
//				"<ArrayOfImmuneSchudleModel\n" +
//				"    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
//				"    xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" +
//				"    <ImmuneSchudleModel>\n" +
//				"        <ORG_ID>501</ORG_ID>\n" +
//				"        <ORG_CODE>350211A1025</ORG_CODE>\n" +
//				"        <ORG_NAME>新阳街道社区卫生服务中心</ORG_NAME>\n" +
//				"        <DateNumbers>\n" +
//				"            <DateNumber>\n" +
//				"                <SECTIONLIST>\n" +
//				"                    <Section>\n" +
//				"                        <ID>081000</ID>\n" +
//				"                        <MAX>1</MAX>\n" +
//				"                        <USED>0</USED>\n" +
//				"                        <START_TIME>2017-08-12T08:00:00</START_TIME>\n" +
//				"                        <END_TIME>2017-08-12T08:08:00</END_TIME>\n" +
//				"                        <TIME>AM</TIME>\n" +
//				"                        <PLATFORM_FLAG>0</PLATFORM_FLAG>\n" +
//				"                    </Section>\n" +
//				"                    <Section>\n" +
//				"                        <ID>081001</ID>\n" +
//				"                        <MAX>1</MAX>\n" +
//				"                        <USED>0</USED>\n" +
//				"                        <START_TIME>2017-08-12T15:00:00</START_TIME>\n" +
//				"                        <END_TIME>2017-08-12T15:08:00</END_TIME>\n" +
//				"                        <TIME>PM</TIME>\n" +
//				"                        <PLATFORM_FLAG>0</PLATFORM_FLAG>\n" +
//				"                    </Section>\n" +
//				"                </SECTIONLIST>\n" +
//				"                <ID>350211B10392017081802</ID>\n" +
//				"                <DATE>2017-08-18T00:00:00</DATE>\n" +
//				"                <TIME>PM</TIME>\n" +
//				"                <MAX>10</MAX>\n" +
//				"                <USED>0</USED>\n" +
//				"                <FEE>0</FEE>\n" +
//				"                <STATUS>1</STATUS>\n" +
//				"            </DateNumber>\n" +
//				"            <DateNumber>\n" +
//				"                <SECTIONLIST>\n" +
//				"                    <Section>\n" +
//				"                        <ID>081000</ID>\n" +
//				"                        <MAX>1</MAX>\n" +
//				"                        <USED>0</USED>\n" +
//				"                        <START_TIME>2017-08-12T08:00:00</START_TIME>\n" +
//				"                        <END_TIME>2017-08-12T08:08:00</END_TIME>\n" +
//				"                        <TIME>AM</TIME>\n" +
//				"                        <PLATFORM_FLAG>0</PLATFORM_FLAG>\n" +
//				"                    </Section>\n" +
//				"                    <Section>\n" +
//				"                        <ID>081001</ID>\n" +
//				"                        <MAX>1</MAX>\n" +
//				"                        <USED>0</USED>\n" +
//				"                        <START_TIME>2017-08-12T15:00:00</START_TIME>\n" +
//				"                        <END_TIME>2017-08-12T15:08:00</END_TIME>\n" +
//				"                        <TIME>PM</TIME>\n" +
//				"                        <PLATFORM_FLAG>0</PLATFORM_FLAG>\n" +
//				"                    </Section>\n" +
//				"                </SECTIONLIST>\n" +
//				"                <ID>350211B10392017081802</ID>\n" +
//				"                <DATE>2017-08-18T00:00:00</DATE>\n" +
//				"                <TIME>PM</TIME>\n" +
//				"                <MAX>10</MAX>\n" +
//				"                <USED>0</USED>\n" +
//				"                <FEE>0</FEE>\n" +
//				"                <STATUS>1</STATUS>\n" +
//				"            </DateNumber>\n" +
//				"        </DateNumbers>\n" +
//				"    </ImmuneSchudleModel>\n" +
//				"</ArrayOfImmuneSchudleModel>";
		
		
		
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
		
		JSONObject result = new JSONObject();
		if(200 == status && StringUtils.isNotBlank(xml)){
			Document document = DocumentHelper.parseText(xml);
			Element ArrayOfImmuneSchudleModel = document.getRootElement();
			Element ImmuneSchudleModel = ArrayOfImmuneSchudleModel.element("ImmuneSchudleModel");
			Element ORG_ID = ImmuneSchudleModel.element("ORG_ID");
			Element ORG_CODE = ImmuneSchudleModel.element("ORG_CODE");
			Element ORG_NAME = ImmuneSchudleModel.element("ORG_NAME");
			result.put("ORG_CODE",ORG_CODE.getTextTrim());//机构ID
			result.put("ORG_NAME",ORG_NAME.getTextTrim());//机构名称
			String hospitalcode = hospitalMappingDao.getCodeByMapping(ORG_CODE.getTextTrim(), "1");
			Hospital hospital = hospitalDao.findByCode(hospitalcode);
			result.put("ORG_PHOTO",hospital.getPhoto());//机构图片
			result.put("ORG_PHONE",hospital.getPhone());//机构电话
			result.put("ORG_ADDRESS",hospital.getAddress());//机构地址
			result.put("ORG_INFO",hospital.getIntro());//机构简介
			
			//排班列表
			Element DateNumbers = ImmuneSchudleModel.element("DateNumbers");
			Iterator<Element> iterator = DateNumbers.elementIterator();
			JSONArray DateNumbersJSON = new JSONArray();
			while(iterator.hasNext()){
				JSONObject DateNumberJSON = new JSONObject();
				Element e = iterator.next();
				Element ID = e.element("ID");
				Element DATE = e.element("DATE");
				Element TIME = e.element("TIME");
				Element MAX = e.element("MAX");
				Element USED = e.element("USED");
				Element FEE = e.element("FEE");
				Element STATUS = e.element("STATUS");
				DateNumberJSON.put("ID",ID.getTextTrim());//排班ID
				DateNumberJSON.put("DATE",DATE.getTextTrim());//排班日期
				DateNumberJSON.put("TIME",TIME.getTextTrim());//上午或者下去
				DateNumberJSON.put("MAX",MAX.getTextTrim());//号源数量
				DateNumberJSON.put("USED",USED.getTextTrim());//已使用
				DateNumberJSON.put("FEE",FEE.getTextTrim());//费用
				DateNumberJSON.put("STATUS",STATUS.getTextTrim());//排班状态:1可用,0不可用
				
				
				Date datevo = dateFormat.parse(DATE.getTextTrim());
				DateNumberJSON.put("DATEVO", DateUtil.dateToStrLong(datevo));
				DateNumberJSON.put("WEEK",DateUtil.getWeekByDate(datevo));
				
				//号源
				Element SECTIONLIST = e.element("SECTIONLIST");
				Iterator<Element> iteratorSection = SECTIONLIST.elementIterator();
				JSONArray SECTIONLISTJSON = new JSONArray();
				while(iteratorSection.hasNext()){
					JSONObject SectionJSON = new JSONObject();
					Element f = iteratorSection.next();
					Element SectionID = f.element("ID");
					Element SectionMAX = f.element("MAX");
					Element SectionUSED = f.element("USED");
					Element SectionSTART_TIME = f.element("START_TIME");
					Element SectionEND_TIME = f.element("END_TIME");
					Element SectionTIME = f.element("TIME");
					Element SectionSectionPLATFORM_FLAG = f.element("PLATFORM_FLAG");
					SectionJSON.put("ID",SectionID.getTextTrim());//号源ID
					SectionJSON.put("MAX",SectionMAX.getTextTrim());//号源数量
					SectionJSON.put("USED",SectionUSED.getTextTrim());//已使用
					SectionJSON.put("START_TIME",SectionSTART_TIME.getTextTrim());//开始时间-预约用
					SectionJSON.put("END_TIME",SectionEND_TIME.getTextTrim());//结束时间-预约用
					SectionJSON.put("TIME",SectionTIME.getTextTrim());//上午或者下午
					SectionJSON.put("PLATFORM_FLAG",SectionSectionPLATFORM_FLAG.getTextTrim());//平台标志
					
					Date START_TIME_VO = dateFormat.parse(SectionSTART_TIME.getTextTrim());
					Date END_TIME_VO = dateFormat.parse(SectionEND_TIME.getTextTrim());
					SectionJSON.put("START_TIME_VO",DateUtil.dateToStrLong(START_TIME_VO));//开始时间-前端展示用
					SectionJSON.put("END_TIME_VO",DateUtil.dateToStrLong(END_TIME_VO));//结束时间-前端展示用
					
					SECTIONLISTJSON.add(SectionJSON);
				}
				DateNumberJSON.put("SECTIONLIST",SECTIONLISTJSON);
				DateNumbersJSON.add(DateNumberJSON);
			}
			
			result.put("DateNumbers",DateNumbersJSON);
			return result;
		}else{
			throw new Exception("获取免疫接种机构列表息失败!");
		}
	}
	/**
	 *免疫接种确认预约
	 * @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 url = jwUrl + "/third/guahao/imm/RegisterImmune";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("BarCode", barCode));
		params.add(new BasicNameValuePair("OrgCode", orgCode));
		params.add(new BasicNameValuePair("SectionType", sectionType));
		params.add(new BasicNameValuePair("strStart", strStart));
		params.add(new BasicNameValuePair("SSID", ssid));
		params.add(new BasicNameValuePair("PatientName", patientName));
		params.add(new BasicNameValuePair("PatientID", patientID));
		params.add(new BasicNameValuePair("PatientPhone", patientPhone));
		
		String response = httpClientUtil.post(url, params, "UTF-8");
		
		JSONObject data = JSONObject.parseObject(response);
		int status = data.getInteger("status");
		String xml = data.getString("data");
		if(200 != status || StringUtils.isBlank(xml)){
			throw new Exception("免疫接种预约失败!");
		}else{
			return response;
		}
	}
	
	/**
	 *免疫接种确认预约
	 * @param barCode
	 * @param orgCode
	 * @param sectionType
	 * @param strStart
	 * @param ssid
	 * @param patientName
	 * @param patientID
	 * @param patientPhone
	 * @return
	 */
	public String UnResRegisterImmune(String barCode,
	                             String orgCode,
	                             String sectionType,
	                             String strStart,
	                             String ssid,
	                             String patientName,
	                             String patientID,
	                             String patientPhone) throws Exception{
		String url = jwUrl + "/third/guahao/imm/UnResRegisterImmune";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("BarCode", barCode));
		params.add(new BasicNameValuePair("OrgCode", orgCode));
		params.add(new BasicNameValuePair("SectionType", sectionType));
		params.add(new BasicNameValuePair("strStart", strStart));
		params.add(new BasicNameValuePair("SSID", ssid));
		params.add(new BasicNameValuePair("PatientName", patientName));
		params.add(new BasicNameValuePair("PatientID", patientID));
		params.add(new BasicNameValuePair("PatientPhone", patientPhone));
		
		String response = httpClientUtil.post(url, params, "UTF-8");
		
		JSONObject data = JSONObject.parseObject(response);
		int status = data.getInteger("status");
		String xml = data.getString("data");
		if(200 != status || StringUtils.isBlank(xml)){
			throw new Exception("取消免疫接种失败!");
		}else{
			return response;
		}
	}
	
	/**
	 * 计免:根据条形码获取预约记录
	 * @param barCode  新生儿条码
	 * @return
	 * @throws Exception
	 */
	public JSONArray GetResImmuneListWithBarCode(String barCode) throws Exception{
		
		String url = jwUrl + "/third/guahao/imm/GetResImmuneListWithBarCode";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("BarCode", barCode));
		String response = httpClientUtil.post(url, params, "UTF-8");
		JSONObject data = JSONObject.parseObject(response);
		int status = data.getInteger("status");
		String xml = data.getString("data");
//		int status = 200;
//		String xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
//				"<ArrayOfV_RESERVATION_IMMUNE\n" +
//				"    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
//				"    xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" +
//				"    <V_RESERVATION_IMMUNE>\n" +
//				"        <ORG_ID>502</ORG_ID>\n" +
//				"        <ORG_CODE>350211B1040</ORG_CODE>\n" +
//				"        <ORG_NAME>金山街道社区卫生服务中心</ORG_NAME>\n" +
//				"        <RES_DATE>2017-08-22</RES_DATE>\n" +
//				"        <REGISTER_TIME>2017-08-18T15:21:28</REGISTER_TIME>\n" +
//				"        <STATUS>1</STATUS>\n" +
//				"        <START_TIME>08:24</START_TIME>\n" +
//				"        <END_TIME>08:32</END_TIME>\n" +
//				"        <SOURCE xsi:nil=\"true\" />\n" +
//				"        <RES_TELEPHONE>18798989988</RES_TELEPHONE>\n" +
//				"        <CANCEL_DATE xsi:nil=\"true\" />\n" +
//				"        <NOTICE_STATUS xsi:nil=\"true\" />\n" +
//				"        <NOTICE_DATE xsi:nil=\"true\" />\n" +
//				"        <NUMBER_ID>084550</NUMBER_ID>\n" +
//				"        <NAME>刘柠</NAME>\n" +
//				"        <CARD_NO>D20111110</CARD_NO>\n" +
//				"        <ID_CARD>350426199009203039</ID_CARD>\n" +
//				"        <RES_ID>6b8c2b58d4254bc9b1c945cb8c90cb9e</RES_ID>\n" +
//				"        <UPDATE_TIME xsi:nil=\"true\" />\n" +
//				"        <CREATE_TIME xsi:nil=\"true\" />\n" +
//				"        <UPLOAD_STATUS xsi:nil=\"true\" />\n" +
//				"        <DATA_STATUS xsi:nil=\"true\" />\n" +
//				"        <IS_CORRECT xsi:nil=\"true\" />\n" +
//				"        <LOCAL_SOURCE xsi:nil=\"true\" />\n" +
//				"        <START_TIME_RATE xsi:nil=\"true\" />\n" +
//				"        <END_TIME_RATE xsi:nil=\"true\" />\n" +
//				"        <BARCODE>0052248552</BARCODE>\n" +
//				"     </V_RESERVATION_IMMUNE>\n" +
//				"     <V_RESERVATION_IMMUNE>\n" +
//				"        <ORG_ID>502</ORG_ID>\n" +
//				"        <ORG_CODE>350211B1040</ORG_CODE>\n" +
//				"        <ORG_NAME>金山街道社区卫生服务中心</ORG_NAME>\n" +
//				"        <RES_DATE>2017-08-22</RES_DATE>\n" +
//				"        <REGISTER_TIME>2017-08-18T15:21:28</REGISTER_TIME>\n" +
//				"        <STATUS>1</STATUS>\n" +
//				"        <START_TIME>08:24</START_TIME>\n" +
//				"        <END_TIME>08:32</END_TIME>\n" +
//				"        <SOURCE xsi:nil=\"true\" />\n" +
//				"        <RES_TELEPHONE>18798989988</RES_TELEPHONE>\n" +
//				"        <CANCEL_DATE xsi:nil=\"true\" />\n" +
//				"        <NOTICE_STATUS xsi:nil=\"true\" />\n" +
//				"        <NOTICE_DATE xsi:nil=\"true\" />\n" +
//				"        <NUMBER_ID>084550</NUMBER_ID>\n" +
//				"        <NAME>刘柠</NAME>\n" +
//				"        <CARD_NO>D20111110</CARD_NO>\n" +
//				"        <ID_CARD>350426199009203039</ID_CARD>\n" +
//				"        <RES_ID>6b8c2b58d4254bc9b1c945cb8c90cb9e</RES_ID>\n" +
//				"        <UPDATE_TIME xsi:nil=\"true\" />\n" +
//				"        <CREATE_TIME xsi:nil=\"true\" />\n" +
//				"        <UPLOAD_STATUS xsi:nil=\"true\" />\n" +
//				"        <DATA_STATUS xsi:nil=\"true\" />\n" +
//				"        <IS_CORRECT xsi:nil=\"true\" />\n" +
//				"        <LOCAL_SOURCE xsi:nil=\"true\" />\n" +
//				"        <START_TIME_RATE xsi:nil=\"true\" />\n" +
//				"        <END_TIME_RATE xsi:nil=\"true\" />\n" +
//				"        <BARCODE>0052248552</BARCODE>\n" +
//				"     </V_RESERVATION_IMMUNE>\n" +
//				"</ArrayOfV_RESERVATION_IMMUNE>";
		
		
		
//		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
		
		JSONArray result = new JSONArray();
		
		if(200 == status && StringUtils.isNotBlank(xml)){
			Document document = DocumentHelper.parseText(xml);
			Element ArrayOfV_RESERVATION_IMMUNE = document.getRootElement();
			
			Iterator<Element> iterator = ArrayOfV_RESERVATION_IMMUNE.elementIterator();
			while(iterator.hasNext()){
				JSONObject V_RESERVATION_IMMUNE_JSON = new JSONObject();
				Element f = iterator.next();
				Element ORG_CODE = f.element("ORG_CODE");
				Element ORG_NAME = f.element("ORG_NAME");
				Element RES_DATE = f.element("RES_DATE");
				Element REGISTER_TIME = f.element("REGISTER_TIME");
				Element STATUS = f.element("STATUS");
				Element START_TIME = f.element("START_TIME");
				Element END_TIME = f.element("END_TIME");
				Element RES_TELEPHONE = f.element("RES_TELEPHONE");
				Element NUMBER_ID = f.element("NUMBER_ID");
				Element NAME = f.element("NAME");
				Element CARD_NO = f.element("CARD_NO");
				Element ID_CARD = f.element("ID_CARD");
				Element RES_ID = f.element("RES_ID");
				Element BARCODE = f.element("BARCODE");
				
				V_RESERVATION_IMMUNE_JSON.put("ORG_CODE", ORG_CODE.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("ORG_NAME", ORG_NAME.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("RES_DATE", RES_DATE.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("REGISTER_TIME", REGISTER_TIME.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("STATUS", STATUS.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("START_TIME", START_TIME.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("END_TIME", END_TIME.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("RES_TELEPHONE", RES_TELEPHONE.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("NUMBER_ID", NUMBER_ID.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("NAME", NAME.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("CARD_NO", CARD_NO.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("ID_CARD", ID_CARD.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("RES_ID", RES_ID.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("BARCODE", BARCODE.getTextTrim());
				result.add(V_RESERVATION_IMMUNE_JSON);
			}
			
			return result;
			
		}else{
			throw new Exception("获取免疫接种机构列表息失败!");
		}
	}
}
}

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java

@ -1222,4 +1222,16 @@ public class DateUtil {
		ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
		ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
		return format.format(ca.getTime());
		return format.format(ca.getTime());
	}
	}
	
	/**
	 * 根据日期对象返回星期几
	 * @param date
	 * @return
	 */
	public static int getWeekByDate(Date date){
		Calendar c = Calendar.getInstance();
		c.setTime(date);
		int week = c.get(Calendar.DAY_OF_WEEK);
		return week;
	}
}
}

+ 120 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java

@ -9,6 +9,7 @@ import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.imm.ChildInfoService;
import com.yihu.wlyy.service.imm.ChildInfoService;
import com.yihu.wlyy.service.third.guahao.GuahaoXMService;
import com.yihu.wlyy.service.third.guahao.GuahaoXMService;
import com.yihu.wlyy.service.third.guahao.GuahaoYihuService;
import com.yihu.wlyy.service.third.guahao.GuahaoYihuService;
import com.yihu.wlyy.service.third.guahao.ImmuneService;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.web.WeixinBaseController;
@ -26,6 +27,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
/**
 * 预约挂号
 * 预约挂号
 * Created by yeshijie on 2017/2/4..
 * Created by yeshijie on 2017/2/4..
@ -50,6 +54,8 @@ public class PatientBookingController extends WeixinBaseController{
    private PushMsgTask pushMsgTask;
    private PushMsgTask pushMsgTask;
    @Autowired
    @Autowired
    private ChildInfoService childInfoService;
    private ChildInfoService childInfoService;
    @Autowired
    private ImmuneService immuneService;
    @RequestMapping(value = "CancelOrder", method = RequestMethod.POST)
    @RequestMapping(value = "CancelOrder", method = RequestMethod.POST)
@ -135,12 +141,14 @@ public class PatientBookingController extends WeixinBaseController{
        }
        }
    }
    }
    
    
    //-----------------计划免疫预约相关接口--------------START
    /**
     *-----------------计划免疫预约相关接口--------------START
     */
    
    
    @RequestMapping(value = "getChildrenInfo", method = RequestMethod.POST)
    @RequestMapping(value = "/imm/getChildrenInfo", method = RequestMethod.GET)
    @ResponseBody
    @ResponseBody
    @ObserverRequired
    @ObserverRequired
    @ApiOperation("根据条形编码获取儿童信息")
    @ApiOperation("计免:获取免疫接种儿童信息")
    public String getChildrenInfo (@ApiParam(name = "barCode", value = "条形编码", defaultValue = "0052248552")
    public String getChildrenInfo (@ApiParam(name = "barCode", value = "条形编码", defaultValue = "0052248552")
                                   @RequestParam(value = "barCode", required = true) String barCode){
                                   @RequestParam(value = "barCode", required = true) String barCode){
    
    
@ -152,6 +160,114 @@ public class PatientBookingController extends WeixinBaseController{
            return error(-1, e.getMessage());
            return error(-1, e.getMessage());
        }
        }
    }
    }
    @RequestMapping(value = "/imm/GetOrgImmuneList", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:获取免疫接种机构列表")
    public String GetOrgImmuneList (){
        
        try{
            List<Map<String, String>> list = immuneService.getOrgImmuneList();
            return write(200, "查询成功","data",list);
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    @RequestMapping(value = "/imm/GetOrgScheduleAndNumberList", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:获取免疫接种排班信息和号源信息")
    public String GetOrgScheduleAndNumberList (@ApiParam(name = "orgCode", value = "机构编码", defaultValue = "")
                                                   @RequestParam(value = "orgCode", required = true) String orgCode){
        
        try{
            com.alibaba.fastjson.JSONObject result = immuneService.getOrgScheduleAndNumberList(orgCode);
            return write(200, "查询成功","data",result);
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    @RequestMapping(value = "/imm/RegisterImmune", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:免疫接种确认预约")
    public String RegisterImmune (@ApiParam(name="BarCode",value="新生儿条形编码",defaultValue = "")
                                      @RequestParam String BarCode,
                                  @ApiParam(name="OrgCode",value="机构编码",defaultValue = "")
                                      @RequestParam String OrgCode,
                                  @ApiParam(name="SectionType",value="坐诊类型:取号源的TIME",defaultValue = "")
                                      @RequestParam String SectionType,
                                  @ApiParam(name="strStart",value="日期:取号源的START_TIME",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{
            immuneService.RegisterImmune(BarCode,OrgCode,SectionType,strStart,SSID,PatientName,PatientID,PatientPhone);
            return write(200, "预约成功");
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    @RequestMapping(value = "/imm/UnResRegisterImmune", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:免疫接种取消预约")
    public String UnResRegisterImmune (@ApiParam(name="BarCode",value="新生儿条形编码",defaultValue = "")
                                  @RequestParam String BarCode,
                                  @ApiParam(name="OrgCode",value="机构编码",defaultValue = "")
                                  @RequestParam String OrgCode,
                                  @ApiParam(name="SectionType",value="坐诊类型:取号源的TIME",defaultValue = "")
                                  @RequestParam String SectionType,
                                  @ApiParam(name="strStart",value="日期:取号源的START_TIME",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{
            immuneService.UnResRegisterImmune(BarCode,OrgCode,SectionType,strStart,SSID,PatientName,PatientID,PatientPhone);
            return write(200, "取消预约成功");
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    @RequestMapping(value = "/imm/GetResImmuneListWithBarCode", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:根据条形码获取预约记录")
    public String UnResRegisterImmune (@ApiParam(name="BarCode",value="新生儿条形编码",defaultValue = "")
                                       @RequestParam String BarCode){
        
        try{
            com.alibaba.fastjson.JSONArray result = immuneService.GetResImmuneListWithBarCode(BarCode);
            return write(200, "查询成功!","data",result);
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    
    //-----------------计划免疫预约相关接口--------------END
    /**
     *-----------------计划免疫预约相关接口--------------END
     */
}
}