| 
					
				 | 
			
			
				@ -5,11 +5,13 @@ import com.alibaba.fastjson.JSONArray; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.fasterxml.jackson.databind.ObjectMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.doctor.dao.BaseDoctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.door.dao.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.door.dao.followup.FollowUpDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.door.util.MessageUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.door.util.StreamUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				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.patient.BasePatientDO; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -90,6 +92,8 @@ public class DoorOrderService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private WlyyDoorDoctorStatusDao doctorStatusDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseDoctorDao doctorDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private BaseDoctorHospitalDao doctorHospitalDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				/*    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ServerPackageItemPatientDao serverPackageItemPatientDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -301,7 +305,7 @@ public class DoorOrderService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public List<Map<String, Object>> getDoorFeeDetailGroupByStatus(String orderId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT d.id, d.status, d.pay_status payStatus,d.name,d.code,sum(d.number) num,fee,sum(d.number)*fee sum from wlyy_door_fee_detail d where order_id=? and type=1 GROUP BY status,code"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT d.id, d.status, CONCAT(d.pay_status,'') payStatus,d.name,d.code,sum(d.number) num,fee,sum(d.number)*fee sum from wlyy_door_fee_detail d where order_id=? and type=1 GROUP BY status,code"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return list; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1350,14 +1354,14 @@ public class DoorOrderService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param jsonData 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @org.springframework.transaction.annotation.Transactional(rollbackFor = Exception.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void updatePackageItemInfo(String jsonData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void updatePackageItemInfo(String jsonData,String doctorId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject jsonObjectParam = JSONObject.parseObject(jsonData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String orderId = String.valueOf(jsonObjectParam.get("orderId")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        WlyyDoorServiceOrderDO order = doorServiceOrderDao.findOne(orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 删除出诊医生或服务项 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wlyyDoorServiceOrderService.orderWithFeeDelete(jsonObjectParam,order); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 更新服务包信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wlyyDoorServiceOrderService.orderWithPackageItemFeeAdd(new JSONObject(), jsonObjectParam, order); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        wlyyDoorServiceOrderService.orderWithPackageItemFeeAdd(new JSONObject(), jsonObjectParam, order,doctorId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        // 发送微信模板消息,通知居民服务项目已经变更(smyyyjjd-服务项目变更通知) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       BasePatientDO patient = patientInfoService.findById(order.getProxyPatient());//· 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -1740,15 +1744,26 @@ public class DoorOrderService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param openId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param patientName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param deptName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param payTypeName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctorName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orderId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param doctorId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param orderDO 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   public void putTemplateTobePay(String openId,String patientName,String deptName,String payTypeName,String doctorName,String orderId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   public void putTemplateTobePay(WlyyDoorServiceOrderDO orderDO,String doctorId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if(StringUtils.isEmpty(doctorId)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       JSONObject json = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       String orderId = orderDO.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       String payTypeName = "上门服务"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       BasePatientDO patientDO = patientInfoService.findById(orderDO.getPatient()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       String openId = patientDO.getOpenid(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       String patientName = patientDO.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       String doctorName = doctorDO.getName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       String deptName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       List<BaseDoctorHospitalDO> doctorHospitalDOs = doctorHospitalDao.findByOrgCodeAndDoctorCode("350211A1002",doctorId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       if(doctorHospitalDOs.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           deptName = doctorHospitalDOs.get(0).getDeptName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       json.put("orderId",orderId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       messageUtil.putTemplateWxMessage(wxId,"template_to_be_pay","smfwqrfk",openId,DateUtil.dateToStr(new Date(), "yyyy/MM/dd HH:mm"),null,null,35,json,patientName,deptName,payTypeName,doctorName,DateUtil.dateToChineseTime(new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 |