|  | @ -1,6 +1,8 @@
 | 
												
													
														
															|  | package com.yihu.jw.care.service.prescription;
 |  | package com.yihu.jw.care.service.prescription;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import com.alibaba.fastjson.JSON;
 | 
												
													
														
															|  | import com.alibaba.fastjson.JSONObject;
 |  | import com.alibaba.fastjson.JSONObject;
 | 
												
													
														
															|  | 
 |  | import com.alibaba.fastjson.serializer.SerializerFeature;
 | 
												
													
														
															|  | import com.yihu.jw.care.dao.prescription.BaseCarePrescriptionDao;
 |  | import com.yihu.jw.care.dao.prescription.BaseCarePrescriptionDao;
 | 
												
													
														
															|  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 |  | import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
												
											
												
													
														
															|  | @ -10,6 +12,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.care.prescription.BaseCarePrescriptionDO;
 |  | import com.yihu.jw.entity.care.prescription.BaseCarePrescriptionDO;
 | 
												
													
														
															|  | import com.yihu.jw.patient.dao.BasePatientDao;
 |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.ResponseContant;
 |  | import com.yihu.jw.restmodel.ResponseContant;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
												
													
														
															|  | import org.apache.commons.lang3.StringUtils;
 |  | import org.apache.commons.lang3.StringUtils;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Autowired;
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | import org.springframework.jdbc.core.BeanPropertyRowMapper;
 |  | import org.springframework.jdbc.core.BeanPropertyRowMapper;
 | 
												
											
												
													
														
															|  | @ -96,6 +99,35 @@ public class BaseCarePrescriptionService {
 | 
												
													
														
															|  |         return result;
 |  |         return result;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getPrescriptionInfo(String id,String patient){
 | 
												
													
														
															|  | 
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  | 
 |  |         BaseCarePrescriptionDO prescriptionDO = null;
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isNotBlank(id)){
 | 
												
													
														
															|  | 
 |  |             prescriptionDO =  carePrescriptionDao.findOne(id);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         else if (StringUtils.isNotBlank(patient)){
 | 
												
													
														
															|  | 
 |  |             prescriptionDO = carePrescriptionDao.selectOneByPatient(patient);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         if (null==prescriptionDO){
 | 
												
													
														
															|  | 
 |  |             result.put(ResponseContant.resultFlag,ResponseContant.fail);
 | 
												
													
														
															|  | 
 |  |             result.put(ResponseContant.resultMsg,"续方记录不存在");
 | 
												
													
														
															|  | 
 |  |         }else {
 | 
												
													
														
															|  | 
 |  |             BasePatientDO patientDO = patientDao.findById(prescriptionDO.getPatient());
 | 
												
													
														
															|  | 
 |  |             if (null!=patientDO){
 | 
												
													
														
															|  | 
 |  |                 Integer sex = patientDO.getSex();
 | 
												
													
														
															|  | 
 |  |                 prescriptionDO.setSex(null==sex?null:1==sex?"男":"女");
 | 
												
													
														
															|  | 
 |  |                 prescriptionDO.setPhoto(patientDO.getPhoto());
 | 
												
													
														
															|  | 
 |  |                 try{
 | 
												
													
														
															|  | 
 |  |                     prescriptionDO.setAge(IdCardUtil.getAgeByIdcardOrBirthday(patientDO.getIdcard(),patientDO.getBirthday())+"");
 | 
												
													
														
															|  | 
 |  |                 }catch (Exception e){}
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             JSONObject objDo = JSONObject.parseObject(JSON.toJSONStringWithDateFormat(prescriptionDO,"yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteMapNullValue));
 | 
												
													
														
															|  | 
 |  |             result.put(ResponseContant.resultFlag,ResponseContant.success);
 | 
												
													
														
															|  | 
 |  |             result.put(ResponseContant.resultMsg,objDo);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         return result;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 居民端列表查询
 |  |      * 居民端列表查询
 | 
												
													
														
															|  |      * @param patientId
 |  |      * @param patientId
 |