高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
@isTest
private class CancelPostponePlanTriggerTest {
    
    @isTest 
    static void test_method_one() {
        //2021/02/07 liying  SWAG-BXVDPJ start
        SS_Batch_Column_Mapping__c opdMapping = new SS_Batch_Column_Mapping__c(Name = 'Rental_Apply_OPD_Cancle', SS_TableName__c='Rental_Apply_OPD_Cancle');
        opdMapping.From_Column_001__c = '手术取消';
        opdMapping.SS_Column_001__c = '取消OPD试用;主动取消';
        opdMapping.From_Column_002__c = '信息填写错误';
        opdMapping.SS_Column_002__c = '信息填写错误;主动取消';
        insert new SS_Batch_Column_Mapping__c[] {opdMapping};       
        //2021/02/07 liying SWAG-BXVDPJ end      
        OPDPlan__c oPDPlan = new OPDPlan__c();
        oPDPlan.Status__c = '计划中';
        oPDPlan.OPDPlan_ImplementDate__c = Date.today().addDays(5);
        oPDPlan.NoOpp_Reason__c = 'HCP对应';
        oPDPlan.Rental_Apply2__c =null;
        oPDPlan.Rental_Apply1__c =null;
        oPDPlan.Rental_Apply3__c = null;
        insert oPDPlan;
        //备品借出申请
        Rental_Apply__c raObj = new Rental_Apply__c();
        raObj.OPDPlan__c = oPDPlan.Id;
        raObj.Name = 'testra';
        raObj.Product_category__c = 'GI';
        raObj.Demo_purpose1__c = '产品试用';
        raObj.demo_purpose2__c = FixtureUtil.raDemo_purpose2MAP.get('shiyongwuxunjia');
        raObj.direct_send__c = '医疗机构';
        raObj.Loaner_received_staff__c = '王五';
        raObj.Loaner_received_staff_phone__c = '110';
        raObj.direct_shippment_address__c = '北京市';
        raObj.Status__c = '草案中';
        raObj.Request_shipping_day__c = Date.toDay();  // 希望到货日
        raObj.Hope_Lonaer_date_Num__c = 1;  // 希望借用天数
        raObj.Phone_number__c = '1234567890';
        insert raObj;
        
        Test.startTest();
        CancelPostponePlan__c cpp = new CancelPostponePlan__c();
        //2021-01-20 mzy add   OPD计划取消延期 审批 通过后更新【OPD计划实施日期temp】   
        cpp.RecordTypeId = '01210000000gQyL';
        //2021-01-20 mzy  add   OPD计划取消延期 审批 通过后更新【OPD计划实施日期temp】  
        cpp.Status__c = '取消';
        cpp.cancelReasonCombobox__c='手术取消';//2021/02/07 liying  SWAG-BXVDPJ
        cpp.cancelReason__c = 'Test';
        cpp.CancelOPDPlan__c = oPDPlan.Id;
        cpp.if_HaveRental_Apply__c = false;
        insert cpp;
        cpp.Status__c = '取消成功';
        update cpp;
        Test.stopTest();
        
    }
    
    @isTest 
    static void test_method_two() {
        OPDPlan__c oPDPlan = new OPDPlan__c();
        oPDPlan.Status__c = '计划中';
        oPDPlan.OPDPlan_ImplementDate__c = Date.today().addDays(5);
        oPDPlan.NoOpp_Reason__c = 'HCP对应';
        insert oPDPlan;
 
        CancelPostponePlan__c cpp = new CancelPostponePlan__c();
        cpp.Status__c = '延期报告';
        cpp.RecordTypeId = '01210000000gQyM';
        cpp.cancelReason__c = 'Test';
        cpp.CancelOPDPlan__c = oPDPlan.Id;
        cpp.NextPlanDate__c = Date.today().addDays(10);
        insert cpp;
 
        cpp.Status__c = '延期成功';
        update cpp;
 
    }
    
    //2021-08-01  mzy   SWAG-C5RAZV  事件——计划 延期 调查  start
    @isTest 
    static void test_method_three() {
        Event insertTarget = new Event();
        insertTarget.Subject = 'test00';
        insertTarget.StartDateTime =  Datetime.now().adddays(5);
        //2021-08-09   mzy   SWAG-C4YB9J  事件页面优化 update   start
        //insertTarget.DurationInMinutes = 60;
        insertTarget.EndDateTime = Datetime.now().adddays(5).addMinutes(60);
        //2021-08-09   mzy   SWAG-C4YB9J  事件页面优化 update   end
        insertTarget.Location = 'testLocation';
        insertTarget.Activity_Type2__c = '病院';
        insertTarget.OPDPlan_Flag__c = true ;
        insertTarget.PlanProdDetail__c = 'CV-290*4; GI-290镜子*1; GI-290镜子CF*1;';
        insert insertTarget;
 
        OPDPlan__c oPDPlan = new OPDPlan__c();
        oPDPlan.Status__c = '计划中';
        oPDPlan.OPDPlan_ImplementDate__c = Date.today().addDays(5);
        oPDPlan.NoOpp_Reason__c = 'HCP对应';
        insert oPDPlan;
 
        task__c task0 = new Task__c();
        task0.RecordTypeId = '01210000000cWfX';
        task0.taskDifferent__c = '被动任务';
        task0.taskStatus__c = '05 延期';
        task0.Activity_Date__c = Date.today().addDays(5);
        task0.Opd_Plan__c = oPDPlan.Id;
        insert task0;
        
        task__c task = new Task__c();
        task.RecordTypeId = '01210000000cWfX';
        task.taskDifferent__c = '被动任务';
        task.taskStatus__c = '01 分配';
        task.Activity_Date__c = Date.today().addDays(5);
        task.Opd_Plan__c = oPDPlan.Id;
        task.Initial_Task__c = task0.Id;
        insert task;
 
        oPDPlan.Task_ID__c = task.id;
        update oPDPlan;
 
        insertTarget.Task_ID__c = task.id;
        insertTarget.Opd_Plan__c = oPDPlan.Id;
        update insertTarget;
 
        CancelPostponePlan__c cpp = new CancelPostponePlan__c();
        //2021-01-20 mzy add   OPD计划取消延期 审批 通过后更新【OPD计划实施日期temp】   
        cpp.RecordTypeId = '01210000000gQyL';
        //2021-01-20 mzy  add   OPD计划取消延期 审批 通过后更新【OPD计划实施日期temp】  
        cpp.Status__c = '取消';
        cpp.cancelReasonCombobox__c='担当离职';
        cpp.CancelOPDPlan__c = oPDPlan.Id;
        cpp.if_HaveRental_Apply__c = false;
        insert cpp;
        cpp.Status__c = '取消成功';
        update cpp;
 
    }
    //2021-08-01  mzy   SWAG-C5RAZV  事件——计划 延期 调查  end
}