package com.docus.server.collection.util;

import com.docus.core.util.DateUtil;
import com.docus.core.util.Func;
import lombok.Data;

import java.util.Date;

/**
 * @BelongsProject: docus-webservice-sdry
 * @BelongsPackage: com.docus.server.collection.util
 * @Author: chierhao
 * @CreateTime: 2023-02-25  16:59
 * @Description: TODO
 * @Version: 1.0
 */
@Data
public class Result {



    public static String success(String serialId,String receive,String send){

        String createTime= Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);

        String message="成功";

        return "<MCCI_IN000002UV01 xmlns=\"urn:hl7-org:v3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ITSVersion=\"XML_1.0\" xsi:schemaLocation=\"urn:hl7-org:v3  file:///E:/hl7/HL7/v3ballot_fullsite_2011MAY/v3ballot/html/processable/multicacheschemas/MCCI _IN000002UV01.xsd\">  \n" +
                "  <id extension=\""+Func.randomUUID()+"\"/>  \n" +
                "  <creationTime value=\""+createTime+"\"/>  \n" +
                "  <interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\"/>  \n" +
                "  <processingCode code=\"P\"/>  \n" +
                "  <processingModeCode/>  \n" +
                "  <acceptAckCode code=\"AL\"/>  \n" +
                "  <receiver typeCode=\"RCV\"> \n" +
                "    <device classCode=\"DEV\" determinerCode=\"INSTANCE\"> \n" +
                "      <id> \n" +
                "        <item extension=\""+receive+"\"/> \n" +
                "      </id> \n" +
                "    </device> \n" +
                "  </receiver>  \n" +
                "  <sender typeCode=\"SND\"> \n" +
                "    <device classCode=\"DEV\" determinerCode=\"INSTANCE\"> \n" +
                "      <id> \n" +
                "        <item extension=\""+send+"\"/> \n" +
                "      </id> \n" +
                "    </device> \n" +
                "  </sender>  \n" +
                "  <acknowledgement typeCode=\"AA\"> \n" +
                "    <!--请求消息ID-->  \n" +
                "    <targetMessage> \n" +
                "      <id extension=\""+serialId+"\"/> \n" +
                "    </targetMessage>  \n" +
                "    <acknowledgementDetail> \n" +
                "      <text value=\""+message+"\"/> \n" +
                "    </acknowledgementDetail> \n" +
                "  </acknowledgement> \n" +
                "</MCCI_IN000002UV01>\n";
    }
    public static String failed(String serialId,String message,String receive,String send){

        String createTime= Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);


        return "<MCCI_IN000002UV01 xmlns=\"urn:hl7-org:v3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ITSVersion=\"XML_1.0\" xsi:schemaLocation=\"urn:hl7-org:v3  file:///E:/hl7/HL7/v3ballot_fullsite_2011MAY/v3ballot/html/processable/multicacheschemas/MCCI_IN000002UV01.xsd\">  \n" +
                "  <id extension=\""+Func.randomUUID()+"\"/>  \n" +
                "  <creationTime value=\""+createTime+"\"/>  \n" +
                "  <interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\" displayable=\"true\"/>  \n" +
                "  <processingCode code=\"P\"/>  \n" +
                "  <processingModeCode/>  \n" +
                "  <acceptAckCode code=\"AL\"/>  \n" +
                "  <receiver typeCode=\"RCV\"> \n" +
                "    <device classCode=\"DEV\" determinerCode=\"INSTANCE\"> \n" +
                "      <id> \n" +
                "        <item extension=\""+receive+"\"/> \n" +
                "      </id> \n" +
                "    </device> \n" +
                "  </receiver>  \n" +
                "  <sender typeCode=\"SND\"> \n" +
                "    <device classCode=\"DEV\" determinerCode=\"INSTANCE\"> \n" +
                "      <id> \n" +
                "        <item extension=\""+send+"\"/> \n" +
                "      </id> \n" +
                "    </device> \n" +
                "  </sender>  \n" +
                "  <acknowledgement typeCode=\"AE\"> \n" +
                "    <!--请求消息ID-->  \n" +
                "    <targetMessage> \n" +
                "      <id extension=\""+serialId+"\"/> \n" +
                "    </targetMessage>  \n" +
                "    <acknowledgementDetail> \n" +
                "      <text value=\""+message+"\"/> \n" +
                "    </acknowledgementDetail> \n" +
                "  </acknowledgement> \n" +
                "</MCCI_IN000002UV01>\n";
    }

}
