public with sharing class IDInformationAnalyseHospitalController {
|
public String fileName { get; set; }
|
public List < ChoiceAssetDetailedInfo > choiceAssetDetailedview {
|
get;
|
set;
|
}
|
|
public IDInformationAnalyseHospitalController(ApexPages.StandardController stdController) {
|
|
}
|
public String AccountID; //医院Id
|
public String AssetModel; //设备型号
|
public String YearRange; //设备型号
|
public IDInformationAnalyseHospitalController() {
|
AccountID = ApexPages.currentPage().getParameters().get('Id');
|
AssetModel = ApexPages.currentPage().getParameters().get('Type');
|
YearRange = ApexPages.currentPage().getParameters().get('Year');
|
choiceAssetDetailedview = new List < ChoiceAssetDetailedInfo > ();
|
}
|
|
// 画面初始化
|
public void init() {
|
choiceAssetDetailedview.clear();
|
}
|
|
class ChoiceAssetDetailedInfo {
|
public Repair__c Repair { get; set; }
|
public Boolean ColorFlag; //颜色标记
|
public String StyleColor { get; set; }
|
public String RepairShippedDate { get; set; }
|
public String RepairOrderCompleteDay { get; set; }
|
public String RepairInspectionDate { get; set; } // WYL add
|
}
|
public String StyleColor1 = 'background-color:#FFF0F5';//EEEED1
|
public String StyleColor2 = 'background-color:#FFFFF0';//FFF5EE
|
public String StyleColor = StyleColor1;
|
public void hospitalCount(){
|
|
String url = '修理ID信息清单';
|
fileName = EncodingUtil.urlEncode(url, 'UTF-8');
|
Date dateToday = Date.today();
|
Integer year = dateToday.year() - Integer.valueOf(YearRange);
|
Date mon1stDate = Date.newInstance(year, dateToday.month(), dateToday.day());
|
system.debug('111111111111111111111111111日期'+mon1stDate);
|
system.debug('111111111111111111111111111设备型号'+AssetModel);
|
List<Repair__c> repairList = [select id,name,Repair_Severity_Rank__c,Repair_List_Price_formula__c,Hospital__c,Hospital__r.Name,Cumulative_Times__c,
|
SAP_Service_Repair_No__c,Status2__c,Account__c,Account__r.name,Repair_Shipped_Date__c
|
,RepairOrder_Complete_Day__c,Cumulative_Uses__c,Cycle_between_failure__c
|
,Average_Maintenance_Cost__c,Average_Usage_Time__c
|
,SerialNumber__c
|
//DB202310061111 LY 20231015 start
|
,Repair_Inspection_Date__c
|
,Repair_Rank__c
|
,Difference_in_repair_intervals__c
|
//DB202310061111 LY 20231015 end
|
from Repair__c where
|
Repair_Severity_Rank__c ='大修理' AND Status1__c !='0.删除' AND Status1__c !='0.取消'
|
AND Delivered_Product__r.Product2.Asset_Model_No__c like : AssetModel
|
AND createddate > :mon1stDate
|
AND Hospital__c = : AccountID
|
AND Hospital__r.Is_Active__c = '有効'
|
// Order by createddate Desc
|
Order by SerialNumber__c,RepairOrder_Complete_Day__c ASC
|
];//通过医院找修理
|
|
if (repairList.size()>0) {
|
Boolean ColorFlag = false;
|
String SerialNumber;
|
for (Repair__c re : repairList){
|
ChoiceAssetDetailedInfo cdinfo = new ChoiceAssetDetailedInfo();
|
cdinfo.Repair = re;
|
if (String.isBlank(SerialNumber) || SerialNumber == re.SerialNumber__c) {
|
cdinfo.ColorFlag = true;
|
}else{
|
StyleColor = colorChange(StyleColor);
|
}
|
SerialNumber = re.SerialNumber__c;
|
cdinfo.StyleColor = StyleColor;
|
cdinfo.RepairShippedDate = re.Repair_Shipped_Date__c != null?re.Repair_Shipped_Date__c.format():'';
|
cdinfo.RepairOrderCompleteDay = re.RepairOrder_Complete_Day__c != null?re.RepairOrder_Complete_Day__c.format():'';
|
cdinfo.RepairInspectionDate = re.Repair_Inspection_Date__c != null?re.Repair_Inspection_Date__c.format():''; // WYL add
|
if (!choiceAssetDetailedview.contains(cdinfo)) {
|
choiceAssetDetailedview.add(cdinfo);
|
}
|
}
|
}
|
|
}
|
//导出
|
public Pagereference exportBycsv() {
|
return page.IDInformationAnalyseHospitalcsv;
|
}
|
|
public String colorChange(String colornow) {
|
return colornow == StyleColor1 ? StyleColor2 : StyleColor1;
|
}
|
}
|