| 
					
				 | 
			
			
				@ -12,7 +12,6 @@ import com.yihu.jw.entity.base.dict.DictDeptDescDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.dict.DictHospitalDeptDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.doctor.BaseDoctorDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.im.ConsultDo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.im.ConsultTeamDo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.entity.base.org.BaseOrgDO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -80,7 +79,6 @@ import com.yihu.jw.util.wechat.WeixinMessagePushUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.GenerateUserSig; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.Pkis.PKIService_PortType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.StringUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.WebserviceUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.utils.hibernate.HibenateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.wechat.dao.BasePatientWechatDao; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -281,9 +279,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag,String ksdm) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag,String ksdm,String cardNo) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patient:" + patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient,cardNo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -300,7 +298,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyOutpatientVO findOutpatientInfo(String patient, String conNo) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        logger.info("findOutpatientList patient:" + patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /*String patNo = patientMappingService.findHisPatNoByPatient(patient);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMappingDO patientMappingDO = patientMappingDao.findByIdcardAndSource(patientDO.getIdcard(),"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientMappingDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patNo = patientMappingDO.getMappingCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -309,7 +316,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (list != null && list.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            WlyyOutpatientVO outpatientVO = list.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO patientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientVO.setSex(patientDO.getSex() + ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientVO.setBirthday(patientDO.getBirthday()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            outpatientVO.setIdcard(patientDO.getIdcard()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -322,7 +328,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn, String patient, String realOrder, String admNo, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /*String patNo = patientMappingService.findHisPatNoByPatient(patient);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMappingDO patientMappingDO = patientMappingDao.findByIdcardAndSource(patientDO.getIdcard(),"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientMappingDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patNo = patientMappingDO.getMappingCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -348,7 +363,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @throws Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyPrescriptionVO findOriginPrescription(String registerSn, String patient, String admNo, String realOrder, boolean demoFlag) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        /*String patNo = patientMappingService.findHisPatNoByPatient(patient);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        BasePatientDO patientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        PatientMappingDO patientMappingDO = patientMappingDao.findByIdcardAndSource(patientDO.getIdcard(),"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patNo = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (patientMappingDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patNo = patientMappingDO.getMappingCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isBlank(patNo)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1453,7 +1477,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param dept 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findDoctorWithWork(String orgCode, String dept, String chargeType, String doctorCode, String outpatientType, String startDate, String endDate, String key, String consultStatus, Integer page, Integer size) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop findDoctorWithWork(String orgCode, String dept, String chargeType, String doctorCode, String outpatientType, String startDate, String endDate, String key, String consultStatus, Integer page, Integer size,String ywCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String totalSql = "SELECT " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " count(1) AS \"total\" " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1607,7 +1631,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //获取排班 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            for (Map<String, Object> doctor : list) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String id = (String) doctor.get("id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(id, orgCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(id, orgCode,ywCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                doctor.put("workTime", times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                String deptTyepCode = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1631,6 +1655,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "\ta.req_fee as \"spfzFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "\tb.req_fee as \"spzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "\tv.req_fee as \"twzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "\tg.req_fee as \"jyzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "\td.req_fee as \"xtzxFee\"\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "\tbase_doctor t\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1638,7 +1663,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "LEFT JOIN wlyy_charge_dict d ON t.twzx_charge_type = d.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        "WHERE t.id = '"+doctor.get("id")+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                /*if (null!=doctor.get("chargeType")){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1671,7 +1697,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyDoctorWorkTimeVO> findDoctorWorkTime(String doctor, String hospital) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyDoctorWorkTimeVO> findDoctorWorkTime(String doctor, String hospital,String ywCode) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyHospitalWorkRuleDO> list = wlyyHospitalWorkRuleDao.findByHospital(hospital); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1692,12 +1718,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Date endDate = DateUtil.stringToDate(maxDateString, "yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyDoctorWorkTimeVO> timeVOs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            List<WlyyDoctorWorkTimeDO> timeDOs = doctorWorkTimeDao.findDoctorWorkTime(doctor, new Date(), endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (timeDOs != null && timeDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                convertToModels(timeDOs, timeVOs, WlyyDoctorWorkTimeVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (timeVOs != null && timeVOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    for (WlyyDoctorWorkTimeVO timeVO : timeVOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        timeVO.setCount(findWorkTimeInfoCout(timeVO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            String isCheckWork = "1";//1需要判断医生在班0不需要 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNoneBlank(ywCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById(ywCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (wlyyHospitalSysDictDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    isCheckWork = wlyyHospitalSysDictDO.getDictValue(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if ("1".equalsIgnoreCase(isCheckWork)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                List<WlyyDoctorWorkTimeDO> timeDOs = doctorWorkTimeDao.findDoctorWorkTime(doctor, new Date(), endDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (timeDOs != null && timeDOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    convertToModels(timeDOs, timeVOs, WlyyDoctorWorkTimeVO.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    if (timeVOs != null && timeVOs.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        for (WlyyDoctorWorkTimeVO timeVO : timeVOs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            timeVO.setCount(findWorkTimeInfoCout(timeVO.getId())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3577,6 +3613,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\ta.req_fee as \"spfzFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tb.req_fee as \"spzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tv.req_fee as \"twzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tg.req_fee as \"jyzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\td.req_fee as \"xtzxFee\"\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tbase_doctor t\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3585,6 +3622,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "WHERE t.id = '"+doctorDO.getId()+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("chargeTypeList",chargeDictDOLists); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3598,7 +3636,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                rs.put("dept", hospitalDOs.get(0).getDeptCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (StringUtils.isNotBlank(withWork) && "1".equals(withWork)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor, hospitalDOs.get(0).getOrgCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    List<WlyyDoctorWorkTimeVO> times = findDoctorWorkTime(doctor, hospitalDOs.get(0).getOrgCode(),""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    rs.put("workTime", times); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } else { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3861,6 +3899,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\ta.req_fee as \"spfzFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tb.req_fee as \"spzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tv.req_fee as \"twzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tg.req_fee as \"jyzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\td.req_fee as \"xtzxFee\"\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tbase_doctor t\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -3869,6 +3908,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "WHERE t.id = '"+doctorDO.getId()+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            rs.put("chargeTypeList",chargeDictDOLists); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4676,7 +4716,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += "date_format(room.reservation_time ,'%Y-%m-%d %H:%i:%S' ) AS timedate_format,"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += "outpatient.disease_img AS \"disease_img\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql += " outpatient.disease_img AS \"disease_img\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "outpatient.description AS \"description\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "room.reservation_type AS \"reservation_type\"," + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "outpatient.origin_con_no AS \"origin_con_no\" " + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -4716,7 +4756,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            //在线复诊 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND room.reservation_type !=3 AND room.consult_type =2"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql += " AND room.reservation_type !=2"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(dept)) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5442,6 +5482,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\ta.req_fee as \"spfzFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tb.req_fee as \"spzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tv.req_fee as \"twzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tg.req_fee as \"jyzxFee\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\td.req_fee as \"xtzxFee\"\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "\tbase_doctor t\n" + 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -5450,6 +5491,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    "WHERE t.id = '"+map.get("id")+"' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            map.put("chargeTypeList",chargeDictDOLists); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -7635,7 +7677,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public JSONArray findPatientRecord(String idcard, String patient, String admitNum, String ybcard) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String patientId = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNotBlank(patient)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            patientId = patientMappingService.findHisPatNoByPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            /*patientId = patientMappingService.findHisPatNoByPatient(patient);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BasePatientDO patientDO = basePatientDao.findById(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (patientDO==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            PatientMappingDO patientMappingDO = patientMappingDao.findByIdcardAndSource(patientDO.getIdcard(),"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (patientMappingDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                patientId = patientMappingDO.getMappingCode(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return entranceService.BS10008(idcard, null,null,patientId, admitNum, ybcard, demoFlag); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -9655,19 +9705,19 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                doctorDO.setSpzxChargeType(chargeDictDO.getChargeType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (StringUtils.isNoneBlank(doctorDO.getOutpatientType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    if (!doctorDO.getOutpatientType().contains("zj")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        doctorDO.setOutpatientType(doctorDO.getOutpatientType()+",zj"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    if (!doctorDO.getOutpatientType().contains("zjsp")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        doctorDO.setOutpatientType(doctorDO.getOutpatientType()+",zjsp"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    doctorDO.setOutpatientType("zj"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    doctorDO.setOutpatientType("zjsp"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                if (StringUtils.isNoneBlank(doctorDO.getOutpatientType())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    if (doctorDO.getOutpatientType().contains("zj")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        doctorDO.getOutpatientType().replace(",zj",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    if (doctorDO.getOutpatientType().contains("zjsp")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                        doctorDO.getOutpatientType().replace(",zjsp",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    doctorDO.setOutpatientType("zj"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                    doctorDO.setOutpatientType("zjsp"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -9753,11 +9803,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        doctorDO.setSpzxChargeType(chargeDictDO.getChargeType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        if (StringUtils.isNoneBlank(doctorDO.getOutpatientType())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if (!doctorDO.getOutpatientType().contains("zj")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                doctorDO.setOutpatientType(doctorDO.getOutpatientType() + ",zj"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            if (!doctorDO.getOutpatientType().contains("zjsp")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                                doctorDO.setOutpatientType(doctorDO.getOutpatientType() + ",zjsp"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            doctorDO.setOutpatientType("zj"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                            doctorDO.setOutpatientType("zjsp"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    baseDoctorDao.save(doctorDO); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -9775,10 +9825,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tt.source as \"source\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tt.outpatient_type as \"outpatientType\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tt.create_time as \"createTime\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\th.org_code as \"orgCode\",\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tb.idcard as \"idCard\" \n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "FROM\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\twlyy_outpatient t\n" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tLEFT JOIN base_patient b ON t.patient = b.id where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                "\tLEFT JOIN base_patient b ON t.patient = b.id " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " left join base_doctor_hospital h on t.doctor = h.doctor_code where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isNoneBlank(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("xm_ykyy_wx".equals(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (flag){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -9805,11 +9857,59 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        for (Map<String,Object> map:list){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (map.get("createTime")!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("createTime",DateUtil.dateToStrLong(DateUtil.strToDateLong(map.get("createTime").toString()))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                map.put("orgCode",wechatId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public com.alibaba.fastjson.JSONObject getWorkDoctorCount(String nowTime,String orgCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select count(*) as \"total\",t.doctor as \"doctor\" from wlyy_doctor_work_time t " + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                " left join base_doctor_hospital b on t.doctor = b.doctor_code where 1=1 "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNoneBlank(nowTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if("xm_ykyy_wx".equals(wechatId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                if (flag){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql+=" and t.start_time >= '" + nowTime + " 00:00:00' and t.end_time <='"+nowTime+" 23:59:59' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                    sql+=" and t.start_time >= to_date('" + nowTime + " 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and t.end_time <=to_date('"+nowTime+" 23:59:59', 'yyyy-mm-dd hh24:mi:ss') "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                sql+=" and t.start_time >= '" + nowTime + " 00:00:00' and t.end_time <='"+nowTime+" 23:59:59' "; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(StringUtils.isNoneBlank(orgCode)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            sql+=" and b.org_code ='"+orgCode+"'"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        sql+=" group by t.doctor"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        long count =0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(list!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            count = list.size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        jsonObject.put("workDoctorCount",count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  jsonObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyHospitalSysDictDO> findAllDict(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findAlldict(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  wlyyHospitalSysDictDOS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyHospitalSysDictDO findDictById(String dictId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHospitalSysDictDO wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findById(dictId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  wlyyHospitalSysDictDOS; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public WlyyHospitalSysDictDO updateDictById(String dictId,String dictValue){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById(dictId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if(wlyyHospitalSysDictDO!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            if (StringUtils.isNoneBlank(dictValue)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyHospitalSysDictDO.setDictValue(dictValue); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                wlyyHospitalSysDictDao.save(wlyyHospitalSysDictDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return  wlyyHospitalSysDictDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<WlyyHospitalSysDictDO> findSysByDictCode(String dictCode){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<WlyyHospitalSysDictDO> isWork=sysDictDao.findByDictCode(dictCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return isWork; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				} 
			 |