待回访业务逻辑
package com.casking.ccss.modules.cs.service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.casking.ccss.common.persistence.Page;
import com.casking.ccss.common.service.CrudService;
import com.casking.ccss.modules.cs.dao.CustomerDao;
import com.casking.ccss.modules.cs.entity.CustomerInfo;
/**
* 顾客服务业务类
*
* @author samwu
*
*/
@Service
@Transactional(readOnly = true)
public class CustomerService extends CrudService<CustomerDao, CustomerInfo> {
@Autowired
private CustomerDao cp;
// 分页查询
public Page<CustomerInfo> findPage(Page<CustomerInfo> page, CustomerInfo ci) {
System.out.println("待回访:>>>>>>>>>>>>>>待回访页面");
return super.findPage(page, ci);
}
/** 回访弹窗查询患者信息 */
public CustomerInfo find(CustomerInfo ci) {
return cp.findVisit(ci);
}
/** 更新回访状态 */
public void updateState(CustomerInfo ci) {
cp.updateState(ci);
}
public void save(CustomerInfo info) {
super.save(info);
}
public void insertBatch(List<CustomerInfo> batchList) {
cp.insertBatch(batchList);
}
/** 查询回访状态 */
public CustomerInfo findVisitState(CustomerInfo ci) {
return cp.findVisitState(ci);
}
/** 查询新增记录数 */
public Integer findCount(CustomerInfo ci) {
return cp.findCount(ci);
}
/** 更新已回访页面的回访状态 */
public void upAllState(CustomerInfo ci) {
cp.upAllState(ci);
}
/** 任务类型二级菜单操作 */
public Map<String, Object> findTask(String idKey) throws Exception {
CustomerInfo ci = new CustomerInfo();
Map<String, Object> josnMap = new HashMap<String, Object>();
ci.setTaskType(idKey);
ArrayList<CustomerInfo> tasks = cp.findTask(ci);
List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
if (tasks.size() > 0) {
for (CustomerInfo info : tasks) {
System.out.println("info:" + info);
Map<String, String> taskMap = new HashMap<String, String>();
taskMap.put("taskType", info.getTaskType());
taskMap.put("taskName", info.getTaskName());
list.add((HashMap<String, String>) taskMap);
}
} else {
Map<String, String> taskMap = new HashMap<String, String>();
taskMap.put("taskType", "all");
taskMap.put("taskName", null);
list.add((HashMap<String, String>) taskMap);
}
josnMap.put("tasks", list);
return josnMap;
}
/** 就诊类型三级菜单操作 */
public Map<String, Object> findDiagnoseType(String idKey) throws Exception {
CustomerInfo ci = new CustomerInfo();
Map<String, Object> josnMap1 = new HashMap<String, Object>();
ci.setDiagnoseType(idKey);
ArrayList<CustomerInfo> diagnose = cp.findDiagnoseType(ci);
List<HashMap<String, String>> list1 = new ArrayList<HashMap<String, String>>();
if (diagnose.size() > 0) {
for (CustomerInfo info : diagnose) {
System.out.println("info:" + info);
Map<String, String> diagnoseMap = new HashMap<String, String>();
diagnoseMap.put("diagnoseType", info.getDiagnoseType());
diagnoseMap.put("office", info.getOffice());
list1.add((HashMap<String, String>) diagnoseMap);
}
} else {
Map<String, String> diagnoseMap = new HashMap<String, String>();
diagnoseMap.put("diagnoseType", "all");
diagnoseMap.put("office", null);
list1.add((HashMap<String, String>) diagnoseMap);
}
josnMap1.put("diagnose", list1);
return josnMap1;
}
}