|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- 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 RequestMulOperationUsageProtocol : EleMedKitProtocol
- {
- public RequestMulOperationUsageProtocol()
- {
- 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[2]);
- 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);
- }
- }
- }
|