Claim Letter

1. Relevant table:

AClaims_ClaimLetter_Data stores    the real-time data of the Claim letter form

lkp_AClaims_ClaimLetter      Claim letter configuration table, configure the initialization field and dynamic parameter field of a Claim letter.

lkp_AClaims_ClaimLetter_DataOptions     Claim letter data source configuration table, including only select and radio data source configuration.

2. The current logic of the Claim letter

First configure the lkp_AClaims_ClaimLetter table and add the fields that ghostgraft wants, including initialization fields and fields with dynamic values. The lkp_AClaims_ClaimLetter_DataOptions table is the data source configuration sql that stores select and radio. Finally, save the values ​​of these fields to AClaims_ClaimLetter_Data, so that ghostgraft only needs one parameter cCLD_ID (AClaims_ClaimLetter_Data represents the guid of a record) to obtain the data required by the entire form.

3. How to configure Claim letter

Step 1: First configure system_report, there is nothing to say, then configure lkp_AClaims_ClaimLetter as follows   

 

insert  into dbo.lkp_AClaims_ClaimLetter
        (
         Code      -- - The unique label of this claim letter, it should be unique, it is best to be the same as the name of the real claim letter 
        , sREP_ID
        ,sREP_Name
        ,InitSQL     -- -Initialize sql, a form may not have all the required fields to fill in the fields, some fields are acquired fields, such as the num of the policy, the effective date. . , these fields do not need to be displayed in the place where the claim letter is set, and the values ​​of these fields need to be saved, and the ghostgraft form will use these fields. 
        ,Configration    /* [
                                        {
                                          "name": "Claimant", the name of the field to display on the page
                                          "field": "Claimant",     字段名
                                          "type": "text", the field type currently only supports text,select,checkbox,radio,textarea
                                          "default": "123", default value
                                          "required": "1", is required
                                          "order": 1 sort field
                                        },
                                        {
                                          "name": "Insured Name",
                                          "field": "InsuredName",
                                          "type": "select",
                                          "options": "A_002_CLAIMS_DISCLOSURE_TO_CLMNT_InsuredName", the data source of select type, there are two forms, 1: ['Purk', 'Lion'] is directly the array of js; 2: A_002_CLAIMS_DISCLOSURE_TO_CLMNT_InsuredName string, if it is a string, it will match lkp_AClaims_ClaimLetter_DataOptions table, and then fetch data according to the initialization sql inside.
                                          "default": "123",
                                          "required": "1",
                                          "order": 2
                                        },
                                        {
                                          "name": "Claimant CheckBox",
                                          "field": "ClaimantCheckBox",
                                          "type": "check_box",
                                          "default": "1",
                                          "required": "1",
                                          "order": 3
                                        },
                                        {
                                          "name": "Claimant Radio",
                                          "field": "ClaimantRadio",
                                          "type": "radio",
                                          "options": "A_002_CLAIMS_DISCLOSURE_TO_CLMNT_ClaimantRadio", data source of radio type, there are two forms, 1: [['1','Lion'],['2','Purk']] is directly an array of js, note that Array is set inside the array; 2: A_002_CLAIMS_DISCLOSURE_TO_CLMNT_ClaimantRadio string, when encountering a string, it will match the lkp_AClaims_ClaimLetter_DataOptions table, and then fetch data according to the initialization sql inside.
                                          "default": "123",
                                          "required": "0",
                                          "order": 4
                                        },
                                        {
                                          "name": "Claimant TextArea",
                                          "field": "ClaimantTextArea",
                                          "type": "text_area",
                                          "default": "123",
                                          "required": "1",
                                          "order": 5
                                        }]*/
        )
        select  'A_002_CLAIMS_DISCLOSURE_TO_CLMNT'
               ,sREP_ID
               ,sREP_Name
               ,'select  NowDate
                           ,cCD_ClaimCode
                           , cCD_DOL = convert (varchar (100), cCD_DOL, 101)
                           ,PD_ID
                           ,PD_InceptionDate = isnull(PD_InceptionDate, '''')
                           ,PD_EffectiveDate
                           ,PD_ExpirationDate
                           ,
                            --PD_GarageVehicleST,
                            Cancel_OR_Expiration = isnull(Cancel_OR_Expiration, '''')
                           ,Date_CancelExpiration
                           , LapseToDate = isnull (LapseToDate, '' '' )
                           ,sCT_Phys_State
                           ,PolicyNumber
                           ,AgencyName
                           ,AgencyAddress1
                           ,AgencyAddress2
                           ,AgencyCSZ
                           ,InsuredName
                           ,InsuredAddress1
                           ,InsuredAddress2
                           ,InsuredCSZ
                           ,AdjusterName
                           ,AdjusterPhone
                           ,cCD_LossReportDate = convert(varchar(100), cCD_LossReportDate, 101)
                    from    vw_Claims_LetterInfo with ( nolock )
                    where   cCD_ID = @cCD_ID
                    for xml path( '' root '' ) '    -- ------- must add for xml path('root'), so that it can be parsed normally 
               , ' [{
                      "name":"Claimant",        
                      "field":"Claimant",
                      "type":"text",
                      "default":"123",
                      "required":"1",
                      "order":1
                },{
                      "name":"Insured Name",
                      "field":"InsuredName",
                      "type":"select",
                      "options":"A_002_CLAIMS_DISCLOSURE_TO_CLMNT_InsuredName",
                      "default":"123",
                      "required":"1",
                      "order":2
                },{
                      "name":"Claimant CheckBox",
                      "field":"ClaimantCheckBox",
                      "type":"check_box",
                      "default":"1",
                      "required":"1",
                      "order":3
                },{
                      "name":"Claimant Radio",
                      "field":"ClaimantRadio",
                      "type":"radio",
                      "options":"A_002_CLAIMS_DISCLOSURE_TO_CLMNT_ClaimantRadio",
                      "default":"123",
                      "required":"0",
                      "order":4
                },{
                      "name":"Claimant TextArea",
                      "field":"ClaimantTextArea",
                      "type":"text_area",
                      "default":"123",
                      "required":"1",
                      "order":5
                }]'
        from    dbo.System_Reports
        where   sREP_Name = 'A_002_CLAIMS DISCLOSURE TO CLMNT'

step2: If the data source of select or radio is dynamic, you need to configure the lkp_AClaims_ClaimLetter_DataOptions table

 

insert  into dbo.lkp_AClaims_ClaimLetter_DataOptions
        (
         Code     -- - Match the code configured by lkp_AClaims_ClaimLetter 
        , Options    -- - Data source initialization sql, select only needs to return a collection of val (corresponding directly to the value and text of select), and display returns null. radio needs to return val (corresponding to the value of radio), display corresponds to the display name of radio 
        )
 values   ​​(
          ' A_002_CLAIMS_DISCLOSURE_TO_CLMNT_ClaimantRadio ' 
        , ' select 1 as val, '' Claimant Radio first '' as display from policy_quote where PQ_ID=@CLMID union select 2, '' Claimant Radio second '''  
        )

insert  into dbo.lkp_AClaims_ClaimLetter_DataOptions
        (
         Code
        ,Options
        )
values  (
         'A_002_CLAIMS_DISCLOSURE_TO_CLMNT_InsuredName'
        ,'select ''Purk Wu'',null from policy_quote where PQ_ID=@CLMID union select ''Lion Wu'',null'  
        )

step3: ghostgraft (to be improved)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324807801&siteId=291194637