|  | @ -1,5 +1,6 @@
 | 
												
													
														
															|  | package com.yihu.jw.hospital.prescription.service;
 |  | package com.yihu.jw.hospital.prescription.service;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import com.fasterxml.jackson.databind.ObjectMapper;
 | 
												
													
														
															|  | import com.yihu.jw.dict.dao.DictHospitalDeptDao;
 |  | import com.yihu.jw.dict.dao.DictHospitalDeptDao;
 | 
												
													
														
															|  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 |  | import com.yihu.jw.doctor.dao.BaseDoctorDao;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
 |  | import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
 | 
												
											
												
													
														
															|  | @ -9,10 +10,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
 |  | import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
 |  | import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
 |  | import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
 |  | 
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
 |  | 
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.hospital.prescription.*;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.consult.dao.DoctorClinicRoomConsultDao;
 |  | import com.yihu.jw.hospital.consult.dao.DoctorClinicRoomConsultDao;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
 |  | import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.mapping.service.PatientMappingService;
 |  | import com.yihu.jw.hospital.mapping.service.PatientMappingService;
 | 
												
											
												
													
														
															|  | @ -21,12 +19,16 @@ import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
 | 
												
													
														
															|  | import com.yihu.jw.org.dao.BaseOrgDao;
 |  | import com.yihu.jw.org.dao.BaseOrgDao;
 | 
												
													
														
															|  | import com.yihu.jw.patient.dao.BasePatientDao;
 |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
												
													
														
															|  | import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
 |  | import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.restmodel.base.org.BaseOrgVO;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.hospital.prescription.*;
 |  | import com.yihu.jw.restmodel.hospital.prescription.*;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.web.MixEnvelop;
 |  | import com.yihu.jw.restmodel.web.MixEnvelop;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.rm.base.BaseRequestMapping;
 | 
												
													
														
															|  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 |  | import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
 | 
												
													
														
															|  | import com.yihu.jw.util.common.IdCardUtil;
 |  | import com.yihu.jw.util.common.IdCardUtil;
 | 
												
													
														
															|  | import com.yihu.jw.util.date.DateUtil;
 |  | import com.yihu.jw.util.date.DateUtil;
 | 
												
													
														
															|  | import com.yihu.mysql.query.BaseJpaService;
 |  | import com.yihu.mysql.query.BaseJpaService;
 | 
												
													
														
															|  | 
 |  | import net.sf.json.JSONArray;
 | 
												
													
														
															|  | import net.sf.json.JSONObject;
 |  | import net.sf.json.JSONObject;
 | 
												
													
														
															|  | import org.apache.commons.collections.map.HashedMap;
 |  | import org.apache.commons.collections.map.HashedMap;
 | 
												
													
														
															|  | import org.apache.commons.lang3.StringUtils;
 |  | import org.apache.commons.lang3.StringUtils;
 | 
												
											
												
													
														
															|  | @ -79,6 +81,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |     private PatientMappingService patientMappingService;
 |  |     private PatientMappingService patientMappingService;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private OutpatientDao outpatientDao;
 |  |     private OutpatientDao outpatientDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private ObjectMapper objectMapper;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @Value("${demo.flag}")
 |  |     @Value("${demo.flag}")
 | 
												
													
														
															|  |     private boolean demoFlag;
 |  |     private boolean demoFlag;
 | 
												
											
												
													
														
															|  | @ -97,6 +101,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         return entranceService.BS30025(patNo,null,null,startTime,endTime,demoFlag);
 |  |         return entranceService.BS30025(patNo,null,null,startTime,endTime,demoFlag);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 查询单条门诊记录
 | 
												
													
														
															|  | 
 |  |      * @param patient
 | 
												
													
														
															|  | 
 |  |      * @param registerSn
 | 
												
													
														
															|  | 
 |  |      * @param admNo
 | 
												
													
														
															|  | 
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public WlyyOutpatientVO findOutpatientInfo(String patient,String registerSn,String admNo)throws Exception{
 | 
												
													
														
															|  | 
 |  |         String patNo =patientMappingService.findHisPatNoByPatient(patient);
 | 
												
													
														
															|  | 
 |  |         List<WlyyOutpatientVO> list = entranceService.BS30025(patNo,admNo,registerSn,null,null,demoFlag);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if(list!=null&&list.size()>0){
 | 
												
													
														
															|  | 
 |  |             return list.get(0);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         return null;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 原处方记录列表
 |  |      * 原处方记录列表
 | 
												
													
														
															|  |      * @param registerSn
 |  |      * @param registerSn
 | 
												
											
												
													
														
															|  | @ -130,7 +151,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      *
 |  | 
 | 
												
													
														
															|  | 
 |  |      * 获取复诊记录列表
 | 
												
													
														
															|  |      * @param patient
 |  |      * @param patient
 | 
												
													
														
															|  |      * @param status
 |  |      * @param status
 | 
												
													
														
															|  |      * @param page
 |  |      * @param page
 | 
												
											
												
													
														
															|  | @ -143,8 +164,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_outpatient o " +
 |  |                 " wlyy_outpatient o " +
 | 
												
													
														
															|  |                 " WHERE " +
 |  |                 " WHERE " +
 | 
												
													
														
															|  |                 " o.patient = '"+patient+"'" +
 |  | 
 | 
												
													
														
															|  |                 " o.status = "+status;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " o.patient = '"+patient+"'";
 | 
												
													
														
															|  | 
 |  |         if(status!=null){
 | 
												
													
														
															|  | 
 |  |             totalSql +=  " AND o.status = "+status;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(startTime)){
 |  |         if(StringUtils.isNotBlank(startTime)){
 | 
												
													
														
															|  |             totalSql += " AND create_time >='"+startTime+" 00:00:00'";
 |  |             totalSql += " AND create_time >='"+startTime+" 00:00:00'";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -162,6 +185,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 " o.origin_adm_no AS originAdmNo, " +
 |  |                 " o.origin_adm_no AS originAdmNo, " +
 | 
												
													
														
															|  |                 " o.register_no AS registerNo, " +
 |  |                 " o.register_no AS registerNo, " +
 | 
												
													
														
															|  |                 " o.origin_register_no AS originRegisterNo, " +
 |  |                 " o.origin_register_no AS originRegisterNo, " +
 | 
												
													
														
															|  | 
 |  |                 " o.hos" +
 | 
												
													
														
															|  |                 " o.dept AS dept, " +
 |  |                 " o.dept AS dept, " +
 | 
												
													
														
															|  |                 " o.dept_name AS deptName, " +
 |  |                 " o.dept_name AS deptName, " +
 | 
												
													
														
															|  |                 " o.patient AS patient, " +
 |  |                 " o.patient AS patient, " +
 | 
												
											
												
													
														
															|  | @ -169,6 +193,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 " o.doctor AS doctor, " +
 |  |                 " o.doctor AS doctor, " +
 | 
												
													
														
															|  |                 " o.doctor_name AS doctorName, " +
 |  |                 " o.doctor_name AS doctorName, " +
 | 
												
													
														
															|  |                 " o.idcard AS idcard, " +
 |  |                 " o.idcard AS idcard, " +
 | 
												
													
														
															|  | 
 |  |                 " o.card_no AS cardNo," +
 | 
												
													
														
															|  |                 " o.mjz AS mjz, " +
 |  |                 " o.mjz AS mjz, " +
 | 
												
													
														
															|  |                 " o.icd10 AS icd10, " +
 |  |                 " o.icd10 AS icd10, " +
 | 
												
													
														
															|  |                 " o.icd10_name AS icd10Name, " +
 |  |                 " o.icd10_name AS icd10Name, " +
 | 
												
											
												
													
														
															|  | @ -181,13 +206,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |                 " FROM " +
 |  |                 " FROM " +
 | 
												
													
														
															|  |                 " wlyy_outpatient o " +
 |  |                 " wlyy_outpatient o " +
 | 
												
													
														
															|  |                 " WHERE " +
 |  |                 " WHERE " +
 | 
												
													
														
															|  |                 " o.patient = '"+patient+"'" +
 |  | 
 | 
												
													
														
															|  |                 " o.status = "+status;
 |  | 
 | 
												
													
														
															|  | 
 |  |                 " o.patient = '"+patient+"'";
 | 
												
													
														
															|  | 
 |  |         if(status!=null){
 | 
												
													
														
															|  | 
 |  |             sql +=  " AND o.status = "+status;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(startTime)){
 |  |         if(StringUtils.isNotBlank(startTime)){
 | 
												
													
														
															|  |             totalSql += " AND create_time >='"+startTime+" 00:00:00'";
 |  | 
 | 
												
													
														
															|  | 
 |  |             sql += " AND create_time >='"+startTime+" 00:00:00'";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         if(StringUtils.isNotBlank(endTime)){
 |  |         if(StringUtils.isNotBlank(endTime)){
 | 
												
													
														
															|  |             totalSql += " AND create_time <='"+endTime+" 23:59:59'";
 |  | 
 | 
												
													
														
															|  | 
 |  |             sql += " AND create_time <='"+endTime+" 23:59:59'";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         sql += " LIMIT " + (page - 1) * size + "," + size + "";
 |  |         sql += " LIMIT " + (page - 1) * size + "," + size + "";
 | 
												
													
														
															|  |         List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class));
 |  |         List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class));
 | 
												
											
												
													
														
															|  | @ -195,6 +222,57 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
 |  |         return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 获取单条复诊记录信息
 | 
												
													
														
															|  | 
 |  |      * @param outpatientId
 | 
												
													
														
															|  | 
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId){
 | 
												
													
														
															|  | 
 |  |         com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         //复诊信息
 | 
												
													
														
															|  | 
 |  |         WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId);
 | 
												
													
														
															|  | 
 |  |         rs.put("outpatient",convertToModel(outpatientDO,WlyyOutpatientVO.class));
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         //居民详情
 | 
												
													
														
															|  | 
 |  |         BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
 | 
												
													
														
															|  | 
 |  |         rs.put("patientName",basePatientDO.getName());
 | 
												
													
														
															|  | 
 |  |         rs.put("patientId",basePatientDO.getId());
 | 
												
													
														
															|  | 
 |  |         rs.put("idCard",basePatientDO.getIdcard());
 | 
												
													
														
															|  | 
 |  |         rs.put("sex", basePatientDO.getSex());
 | 
												
													
														
															|  | 
 |  |         PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),outpatientDO.getPatient(),"1");
 | 
												
													
														
															|  | 
 |  |         rs.put("ssc",cardDO);
 | 
												
													
														
															|  | 
 |  |         rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         //获取处方信息
 | 
												
													
														
															|  | 
 |  |         List<WlyyPrescriptionDO> prescriptionDOs = prescriptionDao.findByOutpatientId(outpatientId);
 | 
												
													
														
															|  | 
 |  |         List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  |         if(prescriptionDOs!=null&&prescriptionDOs.size()>0){
 | 
												
													
														
															|  | 
 |  |             convertToModels(prescriptionDOs,prescriptionVOs,WlyyPrescriptionVO.class);
 | 
												
													
														
															|  | 
 |  |             for(WlyyPrescriptionVO vo:prescriptionVOs){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |                 //疾病信息
 | 
												
													
														
															|  | 
 |  |                 vo.setDiagnosisVOs(findDiagnosisById(vo.getId()));
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |                 //药品信息
 | 
												
													
														
															|  | 
 |  |                 List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  |                 vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()),infoVOs,WlyyPrescriptionInfoVO.class));
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         rs.put("prescriptions",prescriptionVOs);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         //物流信息
 | 
												
													
														
															|  | 
 |  |         List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByOutpatientId(outpatientId);
 | 
												
													
														
															|  | 
 |  |         if(expressageDOs!=null&&expressageDOs.size()>0){
 | 
												
													
														
															|  | 
 |  |             rs.put("expressage",convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class));
 | 
												
													
														
															|  | 
 |  |         }else{
 | 
												
													
														
															|  | 
 |  |             rs.put("expressage",null);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         return rs;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 查询历史
 |  |      * 查询历史
 | 
												
													
														
															|  |      * @param patient
 |  |      * @param patient
 | 
												
											
												
													
														
															|  | @ -329,14 +407,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         rs.put("ssc",cardDO);
 |  |         rs.put("ssc",cardDO);
 | 
												
													
														
															|  |         rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
 |  |         rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //物流信息
 |  | 
 | 
												
													
														
															|  |         List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByPrescriptionId(wlyyPrescriptionDO.getId());
 |  | 
 | 
												
													
														
															|  |         if(expressageDOs!=null&&expressageDOs.size()>0){
 |  | 
 | 
												
													
														
															|  |             rs.put("expressage",convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class));
 |  | 
 | 
												
													
														
															|  |         }else{
 |  | 
 | 
												
													
														
															|  |             rs.put("expressage",null);
 |  | 
 | 
												
													
														
															|  |         }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //诊断信息
 |  |         //诊断信息
 | 
												
													
														
															|  |         rs.put("diagnosis",findDiagnosisById(wlyyPrescriptionDO.getId()));
 |  |         rs.put("diagnosis",findDiagnosisById(wlyyPrescriptionDO.getId()));
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -354,119 +424,118 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  |         return true;
 |  |         return true;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  | 
 | 
												
													
														
															|  |      * 预约
 |  | 
 | 
												
													
														
															|  |      * @param json
 |  | 
 | 
												
													
														
															|  |      * @return
 |  | 
 | 
												
													
														
															|  |      */
 |  | 
 | 
												
													
														
															|  |     public Boolean appointmentRevisit(JSONObject json)throws Exception{
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //1.创建支付
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //2.支付回调
 |  | 
 | 
												
													
														
															|  |         paymentCallback(json);
 |  | 
 | 
												
													
														
															|  |         return true;
 |  | 
 | 
												
													
														
															|  |     }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      *
 |  | 
 | 
												
													
														
															|  |      * @param json
 |  | 
 | 
												
													
														
															|  | 
 |  |      * 发起图文和视频复诊
 | 
												
													
														
															|  | 
 |  |      * @param outpatientJson
 | 
												
													
														
															|  | 
 |  |      * @param expressageJson
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      * @throws Exception
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public String paymentCallback(JSONObject json)throws Exception{
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //创建续方
 |  | 
 | 
												
													
														
															|  |         createPrescription(json);
 |  | 
 | 
												
													
														
															|  |         //创建诊室
 |  | 
 | 
												
													
														
															|  |         createRoom(json);
 |  | 
 | 
												
													
														
															|  |         return null;
 |  | 
 | 
												
													
														
															|  |     }
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public Boolean createPrescription(JSONObject json) throws Exception{
 |  | 
 | 
												
													
														
															|  | 
 |  |     public Boolean appointmentRevisit(String outpatientJson,String expressageJson)throws Exception{
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String patient = json.getString("patient");
 |  | 
 | 
												
													
														
															|  |         String doctor = json.getString("doctor");
 |  | 
 | 
												
													
														
															|  | 
 |  |         //1.保存就诊实体
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String originRealOrder = json.getString("originRealOrder");
 |  | 
 | 
												
													
														
															|  |         String originAdmNo = json.getString("originAdmNo");
 |  | 
 | 
												
													
														
															|  |         String serialNo = json.getString("serialNo");
 |  | 
 | 
												
													
														
															|  | 
 |  |         WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class);
 | 
												
													
														
															|  | 
 |  |         BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         outpatientDO.setMjz("mz");
 | 
												
													
														
															|  | 
 |  |         outpatientDO.setStatus("0");
 | 
												
													
														
															|  | 
 |  |         outpatientDO.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  |         outpatientDO.setIdcard(patientDO.getIdcard());
 | 
												
													
														
															|  | 
 |  |         outpatientDO.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         BasePatientDO basePatientDO = basePatientDao.findById(patient);
 |  | 
 | 
												
													
														
															|  |         PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),patient,"1");
 |  | 
 | 
												
													
														
															|  |         BaseDoctorDO baseDoctorDO = baseDoctorDao.findOne(doctor);
 |  | 
 | 
												
													
														
															|  |         String patNo  = patientMappingService.findHisPatNoByIdCard(basePatientDO.getIdcard());
 |  | 
 | 
												
													
														
															|  | 
 |  |         WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         WlyyPrescriptionVO originPrescriptionVO = findOriginPrescription(serialNo,patNo,originAdmNo,originRealOrder,demoFlag);
 |  | 
 | 
												
													
														
															|  | 
 |  |         //2.物流信息
 | 
												
													
														
															|  | 
 |  |         WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson,WlyyPrescriptionExpressageDO.class);
 | 
												
													
														
															|  | 
 |  |         expressageDO.setDel(1);
 | 
												
													
														
															|  | 
 |  |         expressageDO.setCreateTime(new Date());
 | 
												
													
														
															|  | 
 |  |         prescriptionExpressageDao.save(expressageDO);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         WlyyPrescriptionDO prescription = new WlyyPrescriptionDO();
 |  | 
 | 
												
													
														
															|  |         prescription.setOriginAdmNo(originAdmNo);
 |  | 
 | 
												
													
														
															|  |         prescription.setOriginRealOrder(originRealOrder);
 |  | 
 | 
												
													
														
															|  |         prescription.setOriginSerialNo(serialNo);
 |  | 
 | 
												
													
														
															|  |         prescription.setStatus(0);
 |  | 
 | 
												
													
														
															|  |         prescription.setPatientCode(patient);
 |  | 
 | 
												
													
														
															|  |         prescription.setPatientName(basePatientDO.getName());
 |  | 
 | 
												
													
														
															|  |         prescription.setSsc(cardDO.getCode());
 |  | 
 | 
												
													
														
															|  |         prescription.setDoctor(doctor);
 |  | 
 | 
												
													
														
															|  |         prescription.setDoctorName(baseDoctorDO.getName());
 |  | 
 | 
												
													
														
															|  | 
 |  |         //3.创建候诊室
 | 
												
													
														
															|  | 
 |  |         createRoom(outpatient);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         List<WlyyPrescriptionInfoVO> originInfoVOs = originPrescriptionVO.getInfoVOs();
 |  | 
 | 
												
													
														
															|  |         List<WlyyPrescriptionInfoDO> infoDOs = new ArrayList<>();
 |  | 
 | 
												
													
														
															|  |         List<WlyyPrescriptionDiagnosisVO> diagnosisVOs = originPrescriptionVO.getDiagnosisVOs();
 |  | 
 | 
												
													
														
															|  |         List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = new ArrayList<>();
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         prescriptionInfoDao.save(convertToModels(originInfoVOs,infoDOs,WlyyPrescriptionInfoDO.class));
 |  | 
 | 
												
													
														
															|  |         prescriptionDiagnosisDao.save(convertToModels(diagnosisVOs,diagnosisDOs,WlyyPrescriptionDiagnosisDO.class));
 |  | 
 | 
												
													
														
															|  |         prescriptionDao.save(prescription);
 |  | 
 | 
												
													
														
															|  |         return true;
 |  |         return true;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | //    /**
 | 
												
													
														
															|  | 
 |  | //     *
 | 
												
													
														
															|  | 
 |  | //     * @param json
 | 
												
													
														
															|  | 
 |  | //     * @return
 | 
												
													
														
															|  | 
 |  | //     */
 | 
												
													
														
															|  | 
 |  | //    public String paymentCallback(JSONObject json)throws Exception{
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //        //创建续方
 | 
												
													
														
															|  | 
 |  | //        createPrescription(json);
 | 
												
													
														
															|  | 
 |  | //        //创建诊室
 | 
												
													
														
															|  | 
 |  | //        createRoom(json);
 | 
												
													
														
															|  | 
 |  | //        return null;
 | 
												
													
														
															|  | 
 |  | //    }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | //    public Boolean createPrescription(JSONObject json) throws Exception{
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //        String patient = json.getString("patient");
 | 
												
													
														
															|  | 
 |  | //        String doctor = json.getString("doctor");
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //        String originRealOrder = json.getString("originRealOrder");
 | 
												
													
														
															|  | 
 |  | //        String originAdmNo = json.getString("originAdmNo");
 | 
												
													
														
															|  | 
 |  | //        String serialNo = json.getString("serialNo");
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //        BasePatientDO basePatientDO = basePatientDao.findById(patient);
 | 
												
													
														
															|  | 
 |  | //        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),patient,"1");
 | 
												
													
														
															|  | 
 |  | //        BaseDoctorDO baseDoctorDO = baseDoctorDao.findOne(doctor);
 | 
												
													
														
															|  | 
 |  | //        String patNo  = patientMappingService.findHisPatNoByIdCard(basePatientDO.getIdcard());
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //        WlyyPrescriptionVO originPrescriptionVO = findOriginPrescription(serialNo,patNo,originAdmNo,originRealOrder,demoFlag);
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //        WlyyPrescriptionDO prescription = new WlyyPrescriptionDO();
 | 
												
													
														
															|  | 
 |  | //        prescription.setOriginAdmNo(originAdmNo);
 | 
												
													
														
															|  | 
 |  | //        prescription.setOriginRealOrder(originRealOrder);
 | 
												
													
														
															|  | 
 |  | //        prescription.setOriginSerialNo(serialNo);
 | 
												
													
														
															|  | 
 |  | //        prescription.setStatus(0);
 | 
												
													
														
															|  | 
 |  | //        prescription.setPatientCode(patient);
 | 
												
													
														
															|  | 
 |  | //        prescription.setPatientName(basePatientDO.getName());
 | 
												
													
														
															|  | 
 |  | //        prescription.setSsc(cardDO.getCode());
 | 
												
													
														
															|  | 
 |  | //        prescription.setDoctor(doctor);
 | 
												
													
														
															|  | 
 |  | //        prescription.setDoctorName(baseDoctorDO.getName());
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //        List<WlyyPrescriptionInfoVO> originInfoVOs = originPrescriptionVO.getInfoVOs();
 | 
												
													
														
															|  | 
 |  | //        List<WlyyPrescriptionInfoDO> infoDOs = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  | //        List<WlyyPrescriptionDiagnosisVO> diagnosisVOs = originPrescriptionVO.getDiagnosisVOs();
 | 
												
													
														
															|  | 
 |  | //        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  | //
 | 
												
													
														
															|  | 
 |  | //        prescriptionInfoDao.save(convertToModels(originInfoVOs,infoDOs,WlyyPrescriptionInfoDO.class));
 | 
												
													
														
															|  | 
 |  | //        prescriptionDiagnosisDao.save(convertToModels(diagnosisVOs,diagnosisDOs,WlyyPrescriptionDiagnosisDO.class));
 | 
												
													
														
															|  | 
 |  | //        prescriptionDao.save(prescription);
 | 
												
													
														
															|  | 
 |  | //        return true;
 | 
												
													
														
															|  | 
 |  | //    }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     public Boolean createRoom(JSONObject json){
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         String patient = json.getString("patient");
 |  | 
 | 
												
													
														
															|  |         String doctor = json.getString("doctor");
 |  | 
 | 
												
													
														
															|  |         String dept = json.getString("dept");
 |  | 
 | 
												
													
														
															|  |         String hospital = json.getString("hospital");
 |  | 
 | 
												
													
														
															|  |         String reservationTime = json.getString("reservationTime");
 |  | 
 | 
												
													
														
															|  |         Integer consultType = json.getInt("consultType");
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         BasePatientDO basePatientDO = basePatientDao.findById(patient);
 |  | 
 | 
												
													
														
															|  |         BaseDoctorDO baseDoctorDO = baseDoctorDao.findOne(doctor);
 |  | 
 | 
												
													
														
															|  |         List<WlyyDoctorClinicRoomDO> list = doctorClinicRoomConsultDao.findByDoctorAndStatus(doctor,1);
 |  | 
 | 
												
													
														
															|  |         if(list!=null&&list.size()>0){
 |  | 
 | 
												
													
														
															|  |             //已经有诊室不做操作
 |  | 
 | 
												
													
														
															|  |         }else{
 |  | 
 | 
												
													
														
															|  |             //未有诊室则新增
 |  | 
 | 
												
													
														
															|  |             WlyyDoctorClinicRoomDO room = new WlyyDoctorClinicRoomDO();
 |  | 
 | 
												
													
														
															|  |             room.setDoctor(doctor);
 |  | 
 | 
												
													
														
															|  |             room.setDoctorName(baseDoctorDO.getName());
 |  | 
 | 
												
													
														
															|  |             room.setClinicName(baseDoctorDO.getName());
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             DictHospitalDeptDO deptDO = dictHospitalDeptDao.findByCode(dept);
 |  | 
 | 
												
													
														
															|  |             room.setDept(dept);
 |  | 
 | 
												
													
														
															|  |             room.setDept(deptDO.getName());
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             BaseOrgDO baseOrgDO = baseOrgDao.findByCode(hospital);
 |  | 
 | 
												
													
														
															|  |             room.setDept(hospital);
 |  | 
 | 
												
													
														
															|  |             room.setDept(baseOrgDO.getName());
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             room.setClinicStatus(-1);
 |  | 
 | 
												
													
														
															|  |             room.setDate(new Date());
 |  | 
 | 
												
													
														
															|  |             room.setStatus(1);
 |  | 
 | 
												
													
														
															|  |             doctorClinicRoomConsultDao.save(room);
 |  | 
 | 
												
													
														
															|  |         }
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 创建候诊室
 | 
												
													
														
															|  | 
 |  |      * @param outpatientDO
 | 
												
													
														
															|  | 
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public Boolean createRoom(WlyyOutpatientDO outpatientDO){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO();
 |  |         WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO();
 | 
												
													
														
															|  |         waitingRoom.setConsultType(1);
 |  |         waitingRoom.setConsultType(1);
 | 
												
													
														
															|  |         waitingRoom.setPatientId(patient);
 |  | 
 | 
												
													
														
															|  |         waitingRoom.setPatientName(basePatientDO.getName());
 |  | 
 | 
												
													
														
															|  |         waitingRoom.setReservationTime(DateUtil.strToDate(reservationTime));
 |  | 
 | 
												
													
														
															|  | 
 |  |         waitingRoom.setPatientId(outpatientDO.getPatient());
 | 
												
													
														
															|  | 
 |  |         waitingRoom.setPatientName(outpatientDO.getPatientName());
 | 
												
													
														
															|  | 
 |  |         waitingRoom.setReservationTime(outpatientDO.getAdmDate());
 | 
												
													
														
															|  |         waitingRoom.setVisitStatus(0);
 |  |         waitingRoom.setVisitStatus(0);
 | 
												
													
														
															|  |         waitingRoom.setReservationType(1);
 |  |         waitingRoom.setReservationType(1);
 | 
												
													
														
															|  |         waitingRoom.setSort(0);
 |  |         waitingRoom.setSort(0);
 | 
												
													
														
															|  |         waitingRoom.setConsultType(consultType);
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType()));
 | 
												
													
														
															|  | 
 |  |         if(StringUtils.isNotBlank(outpatientDO.getDoctor())){
 | 
												
													
														
															|  | 
 |  |             waitingRoom.setDoctor(outpatientDO.getDoctor());
 | 
												
													
														
															|  | 
 |  |             waitingRoom.setDoctor(outpatientDO.getDoctorName());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         waitingRoom.setOutpatientId(outpatientDO.getId());
 | 
												
													
														
															|  | 
 |  |         waitingRoom.setCreateTime(new Date());
 | 
												
													
														
															|  |         HospitalWaitingRoomDao.save(waitingRoom);
 |  |         HospitalWaitingRoomDao.save(waitingRoom);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         return true;
 |  |         return true;
 | 
												
											
												
													
														
															|  | @ -481,16 +550,98 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      *
 |  | 
 | 
												
													
														
															|  | 
 |  |      *@param admNo 门诊唯一号
 | 
												
													
														
															|  | 
 |  |      * @param realOrder 处方号
 | 
												
													
														
															|  | 
 |  |      *  @param status 处方状态 1审方失败,2审核完成,3结算完成
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public boolean updatePrescriptionByHisStatu(String admNo,String realOrder,String status)throws Exception{
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         //TODO 状态需要再判断
 |  | 
 | 
												
													
														
															|  |         String sql="UPDATE base.wlyy_prescription p SET p.`status`='',p.pay_status='' WHERE p.adm_no='"+admNo+"' AND p.real_order='"+realOrder+"' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |     public boolean updatePrescriptionByHisStatu(String admNo,String realOrder,String status)throws Exception {
 | 
												
													
														
															|  | 
 |  |         String sql = "";
 | 
												
													
														
															|  | 
 |  |         //status 处方流程状态 ,11 药师审核失败 / 调整中,12  药师审核完成,已完成:100 已完成
 | 
												
													
														
															|  | 
 |  |         //pay_status`:处方结算状态,0为未结算,1为结算成功,默认为0',
 | 
												
													
														
															|  | 
 |  |         if ("1".equals(status)) {
 | 
												
													
														
															|  | 
 |  |             sql = "UPDATE base.wlyy_prescription p SET p.`status`='11' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
 | 
												
													
														
															|  | 
 |  |         } else if ("2".equals(status)) {
 | 
												
													
														
															|  | 
 |  |             sql = "UPDATE base.wlyy_prescription p SET p.`status`='12' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
 | 
												
													
														
															|  | 
 |  |         } else if ("3".equals(status)) {
 | 
												
													
														
															|  | 
 |  |             sql = "UPDATE base.wlyy_prescription p SET p.`status`='100',p.pay_status='1' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  |         jdbcTemplate.execute(sql);
 |  |         jdbcTemplate.execute(sql);
 | 
												
													
														
															|  |         return true;
 |  |         return true;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 获取卡记录
 | 
												
													
														
															|  | 
 |  |      * @param patient
 | 
												
													
														
															|  | 
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      * @throws Exception
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public JSONArray findPatientCard(String patient)throws Exception{
 | 
												
													
														
															|  | 
 |  |         BasePatientDO patientDO = basePatientDao.findById(patient);
 | 
												
													
														
															|  | 
 |  |         return entranceService.BS15018(patientDO.getIdcard(),null,demoFlag);
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject checkOutpatient(String patient){
 | 
												
													
														
															|  | 
 |  |         //-1卡余额不足,,-2 存在未结束的诊断热 1成功
 | 
												
													
														
															|  | 
 |  |         JSONObject rs = new JSONObject();
 | 
												
													
														
															|  | 
 |  |         //1.判断钱是否够
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         //2.判断是否有未结束的
 | 
												
													
														
															|  | 
 |  |         List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient);
 | 
												
													
														
															|  | 
 |  |         if(list!=null&&list.size()>0){
 | 
												
													
														
															|  | 
 |  |             rs.put("code",-2);
 | 
												
													
														
															|  | 
 |  |             rs.put("mes","存在未结束的诊断");
 | 
												
													
														
															|  | 
 |  |             return rs;
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |         rs.put("code",1);
 | 
												
													
														
															|  | 
 |  |         rs.put("mes","验证通过");
 | 
												
													
														
															|  | 
 |  |         return rs;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 获取所有医院列表
 | 
												
													
														
															|  | 
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public List<BaseOrgVO> findAllHospital(){
 | 
												
													
														
															|  | 
 |  |         List<BaseOrgDO> list = baseOrgDao.findByDel("1");
 | 
												
													
														
															|  | 
 |  |         List<BaseOrgVO> rs = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  |         return convertToModels(list,rs,BaseOrgVO.class);
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 获取机构下部门信息
 | 
												
													
														
															|  | 
 |  |      * @param orgCode
 | 
												
													
														
															|  | 
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public List<DictHospitalDeptVO> findDeptByHospital(String orgCode){
 | 
												
													
														
															|  | 
 |  |         List<DictHospitalDeptDO> list =  dictHospitalDeptDao.findByOrgCodeIn(orgCode);
 | 
												
													
														
															|  | 
 |  |         List<DictHospitalDeptVO> rs = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  |         return convertToModels(list,rs,DictHospitalDeptVO.class);
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     /**
 | 
												
													
														
															|  | 
 |  |      * 获取医生列表
 | 
												
													
														
															|  | 
 |  |      * @param orgCode
 | 
												
													
														
															|  | 
 |  |      * @param dept
 | 
												
													
														
															|  | 
 |  |      * @return
 | 
												
													
														
															|  | 
 |  |      */
 | 
												
													
														
															|  | 
 |  |     public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept){
 | 
												
													
														
															|  | 
 |  |         String sql ="SELECT " +
 | 
												
													
														
															|  | 
 |  |                 " d.id, " +
 | 
												
													
														
															|  | 
 |  |                 " d.photo, " +
 | 
												
													
														
															|  | 
 |  |                 " d.`name`, " +
 | 
												
													
														
															|  | 
 |  |                 " h.doctor_duty_code, " +
 | 
												
													
														
															|  | 
 |  |                 " h.doctor_duty_name " +
 | 
												
													
														
															|  | 
 |  |                 " FROM " +
 | 
												
													
														
															|  | 
 |  |                 " base_doctor d " +
 | 
												
													
														
															|  | 
 |  |                 " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
 | 
												
													
														
															|  | 
 |  |                 " WHERE  " +
 | 
												
													
														
															|  | 
 |  |                 " h.dept_code = '"+dept+"' " +
 | 
												
													
														
															|  | 
 |  |                 " AND h.org_code = '"+orgCode+"'";
 | 
												
													
														
															|  | 
 |  |         List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
 | 
												
													
														
															|  | 
 |  |         return list;
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | //    public JSONArray find
 | 
												
													
														
															|  | }
 |  | }
 |