|
@@ -631,6 +631,8 @@ func (c *HisApiController) CreateHisPrescription() {
|
631
|
631
|
|
632
|
632
|
}
|
633
|
633
|
|
|
634
|
+ patient, _ := service.GetPatientByIDTwo(adminInfo.CurrentOrgId, patient_id)
|
|
635
|
+
|
634
|
636
|
_, drugStockConfig := service.FindDrugStockAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
|
635
|
637
|
|
636
|
638
|
_, stockConfig := service.FindAutomaticReduceRecordByOrgId(c.GetAdminUserInfo().CurrentOrgId)
|
|
@@ -964,14 +966,63 @@ func (c *HisApiController) CreateHisPrescription() {
|
964
|
966
|
c.ServeFailJSONWithSGJErrorCode(errcode)
|
965
|
967
|
return
|
966
|
968
|
}
|
967
|
|
- service.CreateHisProjectTwo(&p)
|
968
|
969
|
|
|
970
|
+ service.CreateHisProjectTwo(&p)
|
969
|
971
|
var randNum int
|
970
|
972
|
randNum = rand.Intn(10000) + 1000
|
971
|
973
|
timestamp := time.Now().Unix()
|
972
|
974
|
tempTime := time.Unix(timestamp, 0)
|
973
|
975
|
timeFormat := tempTime.Format("20060102150405")
|
974
|
976
|
p.FeedetlSn = timeFormat + strconv.FormatInt(int64(randNum), 10) + "-" + "2" + "-" + strconv.FormatInt(p.ID, 10)
|
|
977
|
+
|
|
978
|
+ //新增或者编辑项目,修改对应的标签数据
|
|
979
|
+ labelOrigin, _ := service.GetProjectById(p.UserOrgId, p.ID, patient_id, recordDateTime)
|
|
980
|
+ if labelOrigin.ID == 0 { //当天某个人的处方中的项目不存在
|
|
981
|
+ var label models.HisLabelPrintInfo
|
|
982
|
+ project, _ := service.GetProjectDetail(p.ProjectId)
|
|
983
|
+ if project.CostClassify == 3 { //类别为检验检查
|
|
984
|
+ if p.TeamId > 0 { //检验检查组套
|
|
985
|
+ tempLabel, _ := service.GetProjectByTeamId(p.UserOrgId, p.TeamId, patient_id, recordDateTime)
|
|
986
|
+ if tempLabel.ID == 0 {
|
|
987
|
+ team, _ := service.GetProjectTeamDetail(p.TeamId)
|
|
988
|
+ label.Number = tempPrescription.PrescriptionNumber
|
|
989
|
+ label.ProjectId = project.ID
|
|
990
|
+ label.Status = 1
|
|
991
|
+ label.IsPrint = 2
|
|
992
|
+ label.DoctorId = info.DoctorId
|
|
993
|
+ label.UserOrgId = p.UserOrgId
|
|
994
|
+ label.PatientId = patient_id
|
|
995
|
+ label.RecordDate = recordDateTime
|
|
996
|
+ label.Ctime = time.Now().Unix()
|
|
997
|
+ label.Mtime = time.Now().Unix()
|
|
998
|
+ label.ItemId = p.TeamId
|
|
999
|
+ label.FeedetlSn = p.FeedetlSn
|
|
1000
|
+ label.PProjectId = p.ID
|
|
1001
|
+ label.ProjectName = team.ProjectTeam
|
|
1002
|
+ label.PatientName = patient.Name
|
|
1003
|
+ service.CreateHisLabelRecord(&label)
|
|
1004
|
+ }
|
|
1005
|
+ } else { //单条检验检查项目
|
|
1006
|
+ label.Number = tempPrescription.PrescriptionNumber
|
|
1007
|
+ label.ProjectId = project.ID
|
|
1008
|
+ label.Status = 1
|
|
1009
|
+ label.DoctorId = info.DoctorId
|
|
1010
|
+ label.UserOrgId = p.UserOrgId
|
|
1011
|
+ label.PatientId = patient_id
|
|
1012
|
+ label.RecordDate = recordDateTime
|
|
1013
|
+ label.IsPrint = 2
|
|
1014
|
+ label.Ctime = time.Now().Unix()
|
|
1015
|
+ label.Mtime = time.Now().Unix()
|
|
1016
|
+ label.FeedetlSn = p.FeedetlSn
|
|
1017
|
+ label.PProjectId = p.ID
|
|
1018
|
+ label.ItemId = p.TeamId
|
|
1019
|
+ label.ProjectName = project.ProjectName
|
|
1020
|
+ label.PatientName = patient.Name
|
|
1021
|
+ service.CreateHisLabelRecord(&label)
|
|
1022
|
+ }
|
|
1023
|
+ }
|
|
1024
|
+ }
|
|
1025
|
+
|
975
|
1026
|
service.SaveHisProjectTwo(&p)
|
976
|
1027
|
|
977
|
1028
|
if p.Type == 3 { //处理透前准备耗材数量数据
|
|
@@ -981,6 +1032,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
981
|
1032
|
service.UpdateConsumables(&consumables)
|
982
|
1033
|
}
|
983
|
1034
|
}
|
|
1035
|
+
|
984
|
1036
|
}
|
985
|
1037
|
}
|
986
|
1038
|
}
|
|
@@ -1378,6 +1430,10 @@ func (c *HisApiController) DeleteProject() {
|
1378
|
1430
|
}
|
1379
|
1431
|
err := service.DelelteProject(id, c.GetAdminUserInfo().CurrentOrgId)
|
1380
|
1432
|
if err == nil {
|
|
1433
|
+ label, _ := service.GetProjectById(adminInfo.CurrentOrgId, id, project.RecordDate, project.PatientId)
|
|
1434
|
+ label.Status = 0
|
|
1435
|
+ service.CreateHisLabelRecord(&label)
|
|
1436
|
+
|
1381
|
1437
|
if stockConfig.IsOpen == 1 {
|
1382
|
1438
|
if project.Type == 3 {
|
1383
|
1439
|
good, _ := service.FindGoodInfoByIdTwo(project.ProjectId)
|