|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace Rdh.SocketServer.Client.Models
- {
- /// <summary>
- /// 表示上传手术用药信息的类
- /// </summary>
- public class RequestOperationUsageProtocol : EleMedKitProtocol
- {
- public RequestOperationUsageProtocol()
- {
- this.Command = EleMedKitCommand.RequestPatientOperationUsage;
- this.MinLines = base.MinLines + 5;
- }
- public UserInfoProtocol? UserInfo { get; set; }
- public string? RoomCode { get; set; }
- public PatientOperationProtocol? OperationInfo { get; set; }
- public List<DrugUsageProtocol>? ListDrugs { get; set; }
- public string LineEnd { get => EleMedKitProtocolFlags.LineSpiltor; }
- public override string GetContent()
- {
- return base.GetContent()
- + UserInfo?.ToString()
- + AddLineContent(RoomCode)
- + OperationInfo?.ToString()
- + AddList<DrugUsageProtocol>(ListDrugs)
- + AddLineContent(LineEnd)
- + AddLineContent(CountFlag);
- }
- public override bool ParseContent(string[] lines)
- {
- if (!base.ParseContent(lines)
- || lines.Length < MinLines)
- {
- return false;
- }
- if (!lines[lines.Length - 2].Contains(LineEnd))
- {
- return false;
- }
- UserInfo = new UserInfoProtocol();
- if (!UserInfo.ParseContent(lines[2]))
- {
- return false;
- }
- RoomCode = EleMedKitProtocolHelper.GetLineContent(lines[3]);
- OperationInfo = new PatientOperationProtocol();
- if (!OperationInfo.ParseContent(lines[4]))
- {
- return false;
- }
- ListDrugs = new List<DrugUsageProtocol>();
- for (int i = 5; i < lines.Length - 2; i++)
- {
- DrugUsageProtocol drugInfo = new DrugUsageProtocol();
- if (drugInfo.ParseContent(lines[i]))
- {
- ListDrugs.Add(drugInfo);
- }
- else
- {
- return false;
- }
- }
- return base.ParseContent(lines);
- }
- }
- }
|