|  | @ -15,6 +15,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 |  | import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
 |  | import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.score.BaseEvaluateDO;
 |  | import com.yihu.jw.entity.base.score.BaseEvaluateDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
 |  | import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
 |  | import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
 | 
												
											
												
													
														
															|  | @ -31,6 +32,7 @@ import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
 |  | import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.ykyy.service.YkyyService;
 |  | import com.yihu.jw.hospital.ykyy.service.YkyyService;
 | 
												
													
														
															|  | 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.restmodel.hospital.prescription.WlyyOutpatientVO;
 |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
 |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
 | 
												
													
														
															|  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
 |  | import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
 | 
												
											
												
													
														
															|  | @ -130,6 +132,8 @@ public class YkyyEntranceService {
 | 
												
													
														
															|  |     private JdbcTemplate jdbcTemplate;
 |  |     private JdbcTemplate jdbcTemplate;
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private DictDoctorDutyDao dictDoctorDutyDao;
 |  |     private DictDoctorDutyDao dictDoctorDutyDao;
 | 
												
													
														
															|  | 
 |  |     @Autowired
 | 
												
													
														
															|  | 
 |  |     private BasePatientMedicareCardDao patientMedicareCardDao;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @Autowired
 |  |     @Autowired
 | 
												
													
														
															|  |     private YkyyService ykyyService;
 |  |     private YkyyService ykyyService;
 | 
												
											
												
													
														
															|  | @ -1099,17 +1103,17 @@ public class YkyyEntranceService {
 | 
												
													
														
															|  |                 "yp.pzwh as \"pzwh\""+  " FROM " +
 |  |                 "yp.pzwh as \"pzwh\""+  " FROM " +
 | 
												
													
														
															|  |                 "V_ZKSG_MZ_YPXX yp where 1=1 ";
 |  |                 "V_ZKSG_MZ_YPXX yp where 1=1 ";
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(ypdm)){
 |  |         if (StringUtils.isNoneBlank(ypdm)){
 | 
												
													
														
															|  |             sql+=" and yp.ypdm like '%"+ypdm+"%' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |             sql+=" and lower(yp.ypdm) like '%"+ypdm.toLowerCase()+"%' ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(ypmc)){
 |  |         if (StringUtils.isNoneBlank(ypmc)){
 | 
												
													
														
															|  |             sql+=" and yp.ypmc like '%"+ypmc+"%' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |             sql+=" and lower(yp.ypmc) like '%"+ypmc.toLowerCase()+"%' ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(kusl)){
 |  |         if (StringUtils.isNoneBlank(kusl)){
 | 
												
													
														
															|  |             sql+=" and yp.kusl like '%"+kusl+"%' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |             sql+=" and lower(yp.kusl) like '%"+kusl.toLowerCase()+"%' ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(pydm)){
 |  |         if (StringUtils.isNoneBlank(pydm)){
 | 
												
													
														
															|  |             sql+=" and yp.pydm like '%"+pydm+"%' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |             sql+=" and lower(yp.pydm) like '%"+pydm.toLowerCase()+"%' ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         JSONArray array = new JSONArray();
 |  |         JSONArray array = new JSONArray();
 | 
												
													
														
															|  |         Map<String,Object> params = new HashedMap();
 |  |         Map<String,Object> params = new HashedMap();
 | 
												
											
												
													
														
															|  | @ -1173,7 +1177,7 @@ public class YkyyEntranceService {
 | 
												
													
														
															|  |                 "FROM\n" +
 |  |                 "FROM\n" +
 | 
												
													
														
															|  |                 "\tV_ZKSG_JCXM_MZ mz where 1=1 ";
 |  |                 "\tV_ZKSG_JCXM_MZ mz where 1=1 ";
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(pydm)){
 |  |         if (StringUtils.isNoneBlank(pydm)){
 | 
												
													
														
															|  |             sql+=" and pydm = '%"+pydm+"%'";
 |  | 
 | 
												
													
														
															|  | 
 |  |             sql+=" and lower(pydm) = '%"+pydm.toLowerCase()+"%'";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);*/
 |  |         /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);*/
 | 
												
													
														
															|  |         JSONArray array = new JSONArray();
 |  |         JSONArray array = new JSONArray();
 | 
												
											
												
													
														
															|  | @ -1199,7 +1203,7 @@ public class YkyyEntranceService {
 | 
												
													
														
															|  |     public JSONArray findSypc(String pcbm) throws Exception {
 |  |     public JSONArray findSypc(String pcbm) throws Exception {
 | 
												
													
														
															|  |         String sql = "select s.pcbm as \"pcbm\",s.pcmc as \"pcmc\",s.pcmc1 as \"pcmc1\" from v_hlw_sypc s where 1=1 ";
 |  |         String sql = "select s.pcbm as \"pcbm\",s.pcmc as \"pcmc\",s.pcmc1 as \"pcmc1\" from v_hlw_sypc s where 1=1 ";
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(pcbm)){
 |  |         if (StringUtils.isNoneBlank(pcbm)){
 | 
												
													
														
															|  |             sql+=" and s.pcbm='"+pcbm+"' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |             sql+=" and lower(s.pcbm)='"+pcbm.toLowerCase()+"' ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
 |  |         /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
 | 
												
													
														
															|  |         return list;*/
 |  |         return list;*/
 | 
												
											
												
													
														
															|  | @ -1225,7 +1229,7 @@ public class YkyyEntranceService {
 | 
												
													
														
															|  |     public JSONArray findYpyf(String pydm) throws Exception {
 |  |     public JSONArray findYpyf(String pydm) throws Exception {
 | 
												
													
														
															|  |         String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1  and y.pydm is not null";
 |  |         String sql = "select y.ypyf as \"ypyf\",y.pydm as \"pydm\",y.xmmc as \"xmmc\" from v_hlw_ypyf y where 1=1  and y.pydm is not null";
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(pydm)){
 |  |         if (StringUtils.isNoneBlank(pydm)){
 | 
												
													
														
															|  |             sql+=" and y.pydm='"+pydm+"' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |             sql+=" and lower(y.pydm)='"+pydm.toLowerCase()+"' ";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
 |  |         /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
 | 
												
													
														
															|  |         return list;*/
 |  |         return list;*/
 | 
												
											
												
													
														
															|  | @ -1247,11 +1251,11 @@ public class YkyyEntranceService {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  |     /**
 | 
												
													
														
															|  |      * 获取his病人信息
 |  |      * 获取his病人信息
 | 
												
													
														
															|  |      * @param idcard
 |  | 
 | 
												
													
														
															|  | 
 |  |      * @param ssc
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      * @throws Exception
 |  |      * @throws Exception
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public JSONArray findHisPatient(String idcard) throws Exception {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONArray findHisPatient(String ssc) throws Exception {
 | 
												
													
														
															|  |         String sql = "SELECT\n" +
 |  |         String sql = "SELECT\n" +
 | 
												
													
														
															|  |                 "\tx.brid AS \"brid\",\n" +
 |  |                 "\tx.brid AS \"brid\",\n" +
 | 
												
													
														
															|  |                 "\tx.mzhm AS \"mzhm\",\n" +
 |  |                 "\tx.mzhm AS \"mzhm\",\n" +
 | 
												
											
												
													
														
															|  | @ -1269,7 +1273,7 @@ public class YkyyEntranceService {
 | 
												
													
														
															|  |                 "FROM\n" +
 |  |                 "FROM\n" +
 | 
												
													
														
															|  |                 "\tV_ZKSG_BRCX x\n" +
 |  |                 "\tV_ZKSG_BRCX x\n" +
 | 
												
													
														
															|  |                 "WHERE\n" +
 |  |                 "WHERE\n" +
 | 
												
													
														
															|  |                 "\tx.sfzh = '"+idcard+"' ";
 |  | 
 | 
												
													
														
															|  | 
 |  |                 "\tx.jzkh = '"+ssc+"' ";
 | 
												
													
														
															|  |         JSONArray array = new JSONArray();
 |  |         JSONArray array = new JSONArray();
 | 
												
													
														
															|  |         Map<String,Object> params = new HashedMap();
 |  |         Map<String,Object> params = new HashedMap();
 | 
												
													
														
															|  |         params.put("sql",sql);
 |  |         params.put("sql",sql);
 | 
												
											
												
													
														
															|  | @ -1314,7 +1318,7 @@ public class YkyyEntranceService {
 | 
												
													
														
															|  |         String sql = "select i.code as \"code\",i.name as \"name\",i.disea_reason as \"disea_reason\",i.death_reason as \"death_reason\",i.py_code as \"py_code\",i.flag as \"flag\",i.add_code as \"add_code\",i.emr as \"emr\" from v_hlw_icd10 i";
 |  |         String sql = "select i.code as \"code\",i.name as \"name\",i.disea_reason as \"disea_reason\",i.death_reason as \"death_reason\",i.py_code as \"py_code\",i.flag as \"flag\",i.add_code as \"add_code\",i.emr as \"emr\" from v_hlw_icd10 i";
 | 
												
													
														
															|  |         JSONArray array = new JSONArray();
 |  |         JSONArray array = new JSONArray();
 | 
												
													
														
															|  |         if (StringUtils.isNoneBlank(pyCode)){
 |  |         if (StringUtils.isNoneBlank(pyCode)){
 | 
												
													
														
															|  |             sql +="  where i.py_code like '%"+pyCode+"%'";
 |  | 
 | 
												
													
														
															|  | 
 |  |             sql +="  where lower(i.py_code) like '%"+pyCode.toLowerCase()+"%'";
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |         Map<String,Object> params = new HashedMap();
 |  |         Map<String,Object> params = new HashedMap();
 | 
												
													
														
															|  |         params.put("sql",sql);
 |  |         params.put("sql",sql);
 | 
												
											
												
													
														
															|  | @ -1465,6 +1469,9 @@ public class YkyyEntranceService {
 | 
												
													
														
															|  |         DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
 |  |         DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
 | 
												
													
														
															|  |         String patient = wlyyPrescriptionVO.getPatientCode();
 |  |         String patient = wlyyPrescriptionVO.getPatientCode();
 | 
												
													
														
															|  |         PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
 |  |         PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
 | 
												
													
														
															|  | 
 |  |         BasePatientDO patientDO = basePatientDao.findById(patient);
 | 
												
													
														
															|  | 
 |  |         PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         Integer GHXH = 0;
 |  |         Integer GHXH = 0;
 | 
												
													
														
															|  |         //挂号明细表HLW_GHMX
 |  |         //挂号明细表HLW_GHMX
 | 
												
											
												
													
														
															|  | @ -1494,7 +1501,7 @@ public class YkyyEntranceService {
 | 
												
													
														
															|  |         hlwGhmxDO.setYSDM(doctorMappingDO.getMappingCode());//医生代码
 |  |         hlwGhmxDO.setYSDM(doctorMappingDO.getMappingCode());//医生代码
 | 
												
													
														
															|  |         hlwGhmxDO.setJZYS(doctorMappingDO.getMappingCode());//接诊医生
 |  |         hlwGhmxDO.setJZYS(doctorMappingDO.getMappingCode());//接诊医生
 | 
												
													
														
															|  |         //病人性质
 |  |         //病人性质
 | 
												
													
														
															|  |         JSONArray jsonArray = findHisPatient(patientMappingDO.getIdcard());
 |  | 
 | 
												
													
														
															|  | 
 |  |         JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode());
 | 
												
													
														
															|  |         if(jsonArray!=null&&jsonArray.size()>0){
 |  |         if(jsonArray!=null&&jsonArray.size()>0){
 | 
												
													
														
															|  |             //获取居民信息
 |  |             //获取居民信息
 | 
												
													
														
															|  |             JSONObject json = jsonArray.getJSONObject(0);
 |  |             JSONObject json = jsonArray.getJSONObject(0);
 | 
												
											
												
													
														
															|  | @ -1552,6 +1559,7 @@ public class YkyyEntranceService {
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         Integer icd10Flag = 0;
 |  |         Integer icd10Flag = 0;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(code,1);
 |  |         List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(code,1);
 | 
												
													
														
															|  |         if(diagnosisDOs!=null&&diagnosisDOs.size()>0){
 |  |         if(diagnosisDOs!=null&&diagnosisDOs.size()>0){
 | 
												
													
														
															|  |             WlyyPrescriptionDiagnosisDO diagnosisDO = diagnosisDOs.get(0);
 |  |             WlyyPrescriptionDiagnosisDO diagnosisDO = diagnosisDOs.get(0);
 |