|
@@ -42,6 +42,8 @@ func HisProjectRouters() {
|
42
|
42
|
beego.Router("/api/his/getallprojectlist", &HisProjectApiController{}, "Get:GetAllProjectList")
|
43
|
43
|
beego.Router("/api/his/addprojectlist", &HisProjectApiController{}, "Get:AddProjectList")
|
44
|
44
|
beego.Router("/api/his/deleteproject", &HisProjectApiController{}, "Get:DeleteProject")
|
|
45
|
+ beego.Router("/api/his/deletedrug", &HisProjectApiController{}, "Get:DeleteDrug")
|
|
46
|
+
|
45
|
47
|
beego.Router("/api/his/gethisproject", &HisProjectApiController{}, "Get:GetHisProject")
|
46
|
48
|
beego.Router("/api/his/getprojectteam", &HisProjectApiController{}, "Get:GetProjectTeam")
|
47
|
49
|
beego.Router("/api/his/getalldoctorlist", &HisProjectApiController{}, "Get:GetAllDoctorList")
|
|
@@ -133,6 +135,7 @@ func (this *HisProjectApiController) SaveProject() {
|
133
|
135
|
|
134
|
136
|
is_print, _ := this.GetInt64("is_print")
|
135
|
137
|
is_show, _ := this.GetInt64("is_show")
|
|
138
|
+
|
136
|
139
|
theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
137
|
140
|
adminUserInfo := this.GetAdminUserInfo()
|
138
|
141
|
orgId := adminUserInfo.CurrentOrgId
|
|
@@ -390,7 +393,6 @@ func (this *HisProjectApiController) DeleteHisProject() {
|
390
|
393
|
func (this *HisProjectApiController) SaveProjectTeam() {
|
391
|
394
|
|
392
|
395
|
project_team := this.GetString("project_team")
|
393
|
|
-
|
394
|
396
|
price := this.GetString("price")
|
395
|
397
|
price_float, _ := strconv.ParseFloat(price, 64)
|
396
|
398
|
pinyin := this.GetString("pinyin")
|
|
@@ -459,11 +461,13 @@ func (this *HisProjectApiController) SaveProjectTeam() {
|
459
|
461
|
}
|
460
|
462
|
types := int64(items["type"].(float64))
|
461
|
463
|
|
462
|
|
- if items["number"] == nil || reflect.TypeOf(items["number"]).String() != "string" {
|
463
|
|
- utils.ErrorLog("number")
|
|
464
|
+ if items["prescribing_number"] == nil || reflect.TypeOf(items["prescribing_number"]).String() != "string" {
|
|
465
|
+ utils.ErrorLog("prescribing_number")
|
|
466
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
467
|
+ return
|
464
|
468
|
}
|
465
|
469
|
|
466
|
|
- number, _ := strconv.ParseInt(items["number"].(string), 10, 64)
|
|
470
|
+ number, _ := strconv.ParseInt(items["prescribing_number"].(string), 10, 64)
|
467
|
471
|
|
468
|
472
|
list := models.XtHisProjectList{
|
469
|
473
|
Number: number,
|
|
@@ -484,11 +488,91 @@ func (this *HisProjectApiController) SaveProjectTeam() {
|
484
|
488
|
ids_str := strings.Join(ids, ",")
|
485
|
489
|
projectTeam.ItemId = ids_str
|
486
|
490
|
service.SaveProjectTeam(&projectTeam)
|
|
491
|
+ }
|
|
492
|
+ }
|
|
493
|
+
|
|
494
|
+ if dataBody["drug_info"] != nil && reflect.TypeOf(dataBody["drug_info"]).String() == "[]interface {}" {
|
|
495
|
+ infos, _ := dataBody["drug_info"].([]interface{})
|
|
496
|
+ if len(infos) > 0 {
|
|
497
|
+ var ids []string
|
|
498
|
+
|
|
499
|
+ for _, item := range infos {
|
|
500
|
+
|
|
501
|
+ var advice models.HisDoctorAdviceTeamInfo
|
|
502
|
+
|
|
503
|
+ items := item.(map[string]interface{})
|
|
504
|
+ if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
|
|
505
|
+ utils.ErrorLog("id")
|
|
506
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
507
|
+ return
|
|
508
|
+ }
|
|
509
|
+ id := int64(items["id"].(float64))
|
|
510
|
+
|
|
511
|
+ if items["drug_name"] == nil || reflect.TypeOf(items["drug_name"]).String() != "string" {
|
|
512
|
+ utils.ErrorLog("drug_name")
|
|
513
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
514
|
+ return
|
|
515
|
+ }
|
|
516
|
+ if items["min_unit"] != nil && reflect.TypeOf(items["min_unit"]).String() == "string" {
|
|
517
|
+ drugSpecUnit, _ := items["min_unit"].(string)
|
|
518
|
+ advice.DrugSpecUnit = drugSpecUnit
|
|
519
|
+ }
|
|
520
|
+ if items["remark"] != nil && reflect.TypeOf(items["remark"]).String() == "string" {
|
|
521
|
+ remark, _ := items["remark"].(string)
|
|
522
|
+ advice.Remark = remark
|
|
523
|
+ }
|
|
524
|
+ if items["single_dose"] != nil && reflect.TypeOf(items["single_dose"]).String() == "string" {
|
|
525
|
+ singleDose, _ := strconv.ParseFloat(items["single_dose"].(string), 64)
|
|
526
|
+ advice.SingleDose = singleDose
|
|
527
|
+ }
|
|
528
|
+ if items["single_dose_unit"] != nil && reflect.TypeOf(items["single_dose_unit"]).String() == "string" {
|
|
529
|
+ singleDoseUnit, _ := items["single_dose_unit"].(string)
|
|
530
|
+ advice.SingleDoseUnit = singleDoseUnit
|
|
531
|
+ }
|
|
532
|
+ if items["prescribing_number"] != nil && reflect.TypeOf(items["prescribing_number"]).String() == "string" {
|
|
533
|
+ prescribingNumber, _ := strconv.ParseFloat(items["prescribing_number"].(string), 64)
|
|
534
|
+ advice.PrescribingNumber = prescribingNumber
|
|
535
|
+ }
|
|
536
|
+ if items["prescribing_number_unit"] != nil && reflect.TypeOf(items["prescribing_number_unit"]).String() == "string" {
|
|
537
|
+ prescribingNumberUnit, _ := items["prescribing_number_unit"].(string)
|
|
538
|
+ advice.PrescribingNumberUnit = prescribingNumberUnit
|
|
539
|
+ }
|
|
540
|
+ if items["delivery_way"] != nil && reflect.TypeOf(items["delivery_way"]).String() == "string" {
|
|
541
|
+ deliveryWay, _ := items["delivery_way"].(string)
|
|
542
|
+ advice.DeliveryWay = deliveryWay
|
|
543
|
+ }
|
|
544
|
+ if items["execution_frequency"] != nil && reflect.TypeOf(items["execution_frequency"]).String() == "string" {
|
|
545
|
+ executionFrequency, _ := items["execution_frequency"].(string)
|
|
546
|
+ advice.ExecutionFrequency = executionFrequency
|
|
547
|
+ }
|
|
548
|
+ if items["day"] != nil && reflect.TypeOf(items["day"]).String() == "string" {
|
|
549
|
+ day, _ := items["day"].(string)
|
|
550
|
+ daycount, _ := strconv.ParseInt(day, 10, 64)
|
|
551
|
+ advice.DayCount = daycount
|
|
552
|
+ }
|
|
553
|
+
|
|
554
|
+ adviceName, _ := items["drug_name"].(string)
|
|
555
|
+ adviceDesc, _ := items["advice_desc"].(string)
|
|
556
|
+ advice.UserOrgId = this.GetAdminUserInfo().CurrentOrgId
|
|
557
|
+ advice.AdviceName = adviceName
|
|
558
|
+ advice.AdviceDesc = adviceDesc
|
|
559
|
+ advice.DrugId = id
|
|
560
|
+ advice.Status = 1
|
|
561
|
+ service.CreateDoctorAdviceTeamList(&advice)
|
|
562
|
+ ids = append(ids, strconv.FormatInt(advice.ID, 10))
|
|
563
|
+ }
|
|
564
|
+ ids_str := strings.Join(ids, ",")
|
|
565
|
+ projectTeam.DrugItemId = ids_str
|
|
566
|
+ service.SaveProjectTeam(&projectTeam)
|
487
|
567
|
this.ServeSuccessJSON(map[string]interface{}{
|
488
|
568
|
"projectTeam": projectTeam,
|
489
|
569
|
})
|
490
|
570
|
}
|
491
|
571
|
}
|
|
572
|
+
|
|
573
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
574
|
+ "projectTeam": projectTeam,
|
|
575
|
+ })
|
492
|
576
|
return
|
493
|
577
|
} else if errcodes == nil {
|
494
|
578
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
@@ -524,6 +608,9 @@ func (this *HisProjectApiController) GetProjectTeamDetail() {
|
524
|
608
|
ids := strings.Split(projectTeamDetail.ItemId, ",")
|
525
|
609
|
hisList, err := service.GetProjectHisListByIds(ids)
|
526
|
610
|
|
|
611
|
+ ids_drug := strings.Split(projectTeamDetail.DrugItemId, ",")
|
|
612
|
+ hisList_drug, err := service.GetDrugHisListByIds(ids_drug)
|
|
613
|
+
|
527
|
614
|
//list, err := service.GetAllProjectList(orgId)
|
528
|
615
|
if err != nil {
|
529
|
616
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
@@ -532,7 +619,8 @@ func (this *HisProjectApiController) GetProjectTeamDetail() {
|
532
|
619
|
this.ServeSuccessJSON(map[string]interface{}{
|
533
|
620
|
"projectTeamDetail": projectTeamDetail,
|
534
|
621
|
//"list": list,
|
535
|
|
- "hisList": hisList,
|
|
622
|
+ "hisList": hisList,
|
|
623
|
+ "hisList_drug": hisList_drug,
|
536
|
624
|
})
|
537
|
625
|
return
|
538
|
626
|
}
|
|
@@ -613,17 +701,134 @@ func (this *HisProjectApiController) UpdatedProjectTeam() {
|
613
|
701
|
Type: types,
|
614
|
702
|
}
|
615
|
703
|
|
616
|
|
- service.CreateProjectList(&list)
|
617
|
|
-
|
|
704
|
+ if items["m_id"] == nil || reflect.TypeOf(items["m_id"]).String() != "float64" {
|
|
705
|
+ utils.ErrorLog("m_id")
|
|
706
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
707
|
+ return
|
|
708
|
+ }
|
|
709
|
+ m_id := int64(items["m_id"].(float64))
|
|
710
|
+ list.ID = m_id
|
|
711
|
+ service.SaveProjectList(&list)
|
618
|
712
|
ids = append(ids, strconv.FormatInt(list.ID, 10))
|
619
|
|
-
|
620
|
713
|
}
|
621
|
714
|
ids_str := strings.Join(ids, ",")
|
622
|
715
|
projectTeam.ItemId = projectTeam.ItemId + "," + ids_str
|
623
|
716
|
service.SaveProjectTeam(&projectTeam)
|
624
|
|
- this.ServeSuccessJSON(map[string]interface{}{
|
625
|
|
- "projectTeam": projectTeam,
|
626
|
|
- })
|
|
717
|
+
|
|
718
|
+ }
|
|
719
|
+ }
|
|
720
|
+
|
|
721
|
+ if dataBody["drug_info"] != nil && reflect.TypeOf(dataBody["drug_info"]).String() == "[]interface {}" {
|
|
722
|
+ infos, _ := dataBody["drug_info"].([]interface{})
|
|
723
|
+ if len(infos) > 0 {
|
|
724
|
+ var ids []string
|
|
725
|
+
|
|
726
|
+ for _, item := range infos {
|
|
727
|
+
|
|
728
|
+ var advice models.HisDoctorAdviceTeamInfo
|
|
729
|
+
|
|
730
|
+ items := item.(map[string]interface{})
|
|
731
|
+
|
|
732
|
+ if items["m_id"] == nil || reflect.TypeOf(items["m_id"]).String() != "float64" {
|
|
733
|
+ utils.ErrorLog("id")
|
|
734
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
735
|
+ return
|
|
736
|
+ }
|
|
737
|
+ m_id := int64(items["m_id"].(float64))
|
|
738
|
+ advice, _ = service.GetHisDrugByID(m_id)
|
|
739
|
+
|
|
740
|
+ if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
|
|
741
|
+ utils.ErrorLog("id")
|
|
742
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
743
|
+ return
|
|
744
|
+ }
|
|
745
|
+ id := int64(items["id"].(float64))
|
|
746
|
+
|
|
747
|
+ if items["drug_name"] == nil || reflect.TypeOf(items["drug_name"]).String() != "string" {
|
|
748
|
+ utils.ErrorLog("drug_name")
|
|
749
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
750
|
+ return
|
|
751
|
+ }
|
|
752
|
+ if items["min_unit"] != nil && reflect.TypeOf(items["min_unit"]).String() == "string" {
|
|
753
|
+ drugSpecUnit, _ := items["min_unit"].(string)
|
|
754
|
+ advice.DrugSpecUnit = drugSpecUnit
|
|
755
|
+ }
|
|
756
|
+ if items["remark"] != nil && reflect.TypeOf(items["remark"]).String() == "string" {
|
|
757
|
+ remark, _ := items["remark"].(string)
|
|
758
|
+ advice.Remark = remark
|
|
759
|
+ }
|
|
760
|
+ if items["single_dose"] != nil && reflect.TypeOf(items["single_dose"]).String() == "string" {
|
|
761
|
+ singleDose, _ := strconv.ParseFloat(items["single_dose"].(string), 64)
|
|
762
|
+ fmt.Println("singleDose")
|
|
763
|
+ fmt.Println(singleDose)
|
|
764
|
+
|
|
765
|
+ advice.SingleDose = singleDose
|
|
766
|
+ }
|
|
767
|
+ if items["single_dose_unit"] != nil && reflect.TypeOf(items["single_dose_unit"]).String() == "string" {
|
|
768
|
+ singleDoseUnit, _ := items["single_dose_unit"].(string)
|
|
769
|
+
|
|
770
|
+ fmt.Println("singleDoseUnit")
|
|
771
|
+ fmt.Println(singleDoseUnit)
|
|
772
|
+ advice.SingleDoseUnit = singleDoseUnit
|
|
773
|
+ }
|
|
774
|
+ if items["prescribing_number"] != nil && reflect.TypeOf(items["prescribing_number"]).String() == "string" {
|
|
775
|
+ prescribingNumber, _ := strconv.ParseFloat(items["prescribing_number"].(string), 64)
|
|
776
|
+ advice.PrescribingNumber = prescribingNumber
|
|
777
|
+
|
|
778
|
+ fmt.Println("prescribingNumber")
|
|
779
|
+ fmt.Println(prescribingNumber)
|
|
780
|
+ }
|
|
781
|
+ if items["prescribing_number_unit"] != nil && reflect.TypeOf(items["prescribing_number_unit"]).String() == "string" {
|
|
782
|
+ prescribingNumberUnit, _ := items["prescribing_number_unit"].(string)
|
|
783
|
+ advice.PrescribingNumberUnit = prescribingNumberUnit
|
|
784
|
+
|
|
785
|
+ fmt.Println("prescribing_number_unit")
|
|
786
|
+ fmt.Println(prescribingNumberUnit)
|
|
787
|
+ }
|
|
788
|
+ if items["delivery_way"] != nil && reflect.TypeOf(items["delivery_way"]).String() == "string" {
|
|
789
|
+ deliveryWay, _ := items["delivery_way"].(string)
|
|
790
|
+ advice.DeliveryWay = deliveryWay
|
|
791
|
+
|
|
792
|
+ fmt.Println("delivery_way")
|
|
793
|
+ fmt.Println(deliveryWay)
|
|
794
|
+ }
|
|
795
|
+ if items["execution_frequency"] != nil && reflect.TypeOf(items["execution_frequency"]).String() == "string" {
|
|
796
|
+ executionFrequency, _ := items["execution_frequency"].(string)
|
|
797
|
+ advice.ExecutionFrequency = executionFrequency
|
|
798
|
+
|
|
799
|
+ fmt.Println("execution_frequency")
|
|
800
|
+ fmt.Println(executionFrequency)
|
|
801
|
+ }
|
|
802
|
+ if items["day"] != nil && reflect.TypeOf(items["day"]).String() == "string" {
|
|
803
|
+ day, _ := items["day"].(string)
|
|
804
|
+ daycount, _ := strconv.ParseInt(day, 10, 64)
|
|
805
|
+ advice.DayCount = daycount
|
|
806
|
+
|
|
807
|
+ fmt.Println("day")
|
|
808
|
+ fmt.Println(day)
|
|
809
|
+ }
|
|
810
|
+
|
|
811
|
+ adviceName, _ := items["drug_name"].(string)
|
|
812
|
+ //adviceDesc, _ := items["advice_desc"].(string)
|
|
813
|
+ advice.UserOrgId = this.GetAdminUserInfo().CurrentOrgId
|
|
814
|
+ advice.AdviceName = adviceName
|
|
815
|
+ //advice.AdviceDesc = adviceDesc
|
|
816
|
+ advice.Status = 1
|
|
817
|
+
|
|
818
|
+ advice.DrugId = id
|
|
819
|
+ advice.ID = m_id
|
|
820
|
+ if m_id > 0 {
|
|
821
|
+ service.CreateDoctorAdviceTeamList(&advice)
|
|
822
|
+ ids = append(ids, strconv.FormatInt(advice.ID, 10))
|
|
823
|
+
|
|
824
|
+ } else {
|
|
825
|
+ service.CreateDoctorAdviceTeamList(&advice)
|
|
826
|
+ ids = append(ids, strconv.FormatInt(advice.ID, 10))
|
|
827
|
+ }
|
|
828
|
+ }
|
|
829
|
+ ids_str := strings.Join(ids, ",")
|
|
830
|
+ projectTeam.DrugItemId = ids_str
|
|
831
|
+ service.SaveProjectTeam(&projectTeam)
|
627
|
832
|
}
|
628
|
833
|
}
|
629
|
834
|
|
|
@@ -822,7 +1027,8 @@ func (this *HisProjectApiController) GetAllProjectList() {
|
822
|
1027
|
orgId := adminUserInfo.CurrentOrgId
|
823
|
1028
|
projectList, err := service.GetAllProjectList(orgId, keyword)
|
824
|
1029
|
goodInfos, err := service.GetGoodInfomationList(orgId, keyword)
|
825
|
|
-
|
|
1030
|
+ drug, _ := service.GetDrugInfomationList(orgId, keyword)
|
|
1031
|
+ //goodInfos, err := service.GetAllDrugList(orgId)
|
826
|
1032
|
//获取列表数据
|
827
|
1033
|
hisprojectlist, err := service.GetHisProjectListByOrgId(orgId)
|
828
|
1034
|
|
|
@@ -834,6 +1040,7 @@ func (this *HisProjectApiController) GetAllProjectList() {
|
834
|
1040
|
"projectList": projectList,
|
835
|
1041
|
"hisprojectlist": hisprojectlist,
|
836
|
1042
|
"good_info": goodInfos,
|
|
1043
|
+ "drug": drug,
|
837
|
1044
|
})
|
838
|
1045
|
return
|
839
|
1046
|
}
|
|
@@ -894,6 +1101,19 @@ func (this *HisProjectApiController) DeleteProject() {
|
894
|
1101
|
return
|
895
|
1102
|
}
|
896
|
1103
|
|
|
1104
|
+func (this *HisProjectApiController) DeleteDrug() {
|
|
1105
|
+ id, _ := this.GetInt64("id")
|
|
1106
|
+ err := service.DeleteDrugList(id)
|
|
1107
|
+ if err != nil {
|
|
1108
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "失败")
|
|
1109
|
+ return
|
|
1110
|
+ }
|
|
1111
|
+ returnData := make(map[string]interface{}, 0)
|
|
1112
|
+ returnData["msg"] = "ok"
|
|
1113
|
+ this.ServeSuccessJSON(returnData)
|
|
1114
|
+ return
|
|
1115
|
+}
|
|
1116
|
+
|
897
|
1117
|
func (this *HisProjectApiController) GetHisProject() {
|
898
|
1118
|
adminUserInfo := this.GetAdminUserInfo()
|
899
|
1119
|
orgId := adminUserInfo.CurrentOrgId
|
|
@@ -1139,14 +1359,21 @@ func (this *HisProjectApiController) GetProjectListById() {
|
1139
|
1359
|
adminUserInfo := this.GetAdminUserInfo()
|
1140
|
1360
|
orgId := adminUserInfo.CurrentOrgId
|
1141
|
1361
|
project_id := this.GetString("project_id")
|
|
1362
|
+ drug_id := this.GetString("drug_id")
|
|
1363
|
+
|
1142
|
1364
|
idStrs := strings.Split(project_id, ",")
|
|
1365
|
+ drug_idStrs := strings.Split(drug_id, ",")
|
|
1366
|
+
|
1143
|
1367
|
project, err := service.GetProjectListById(orgId, idStrs)
|
|
1368
|
+ advice, _ := service.GetAdviceTeamListById(orgId, drug_idStrs)
|
|
1369
|
+
|
1144
|
1370
|
if err != nil {
|
1145
|
1371
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
1146
|
1372
|
return
|
1147
|
1373
|
}
|
1148
|
1374
|
this.ServeSuccessJSON(map[string]interface{}{
|
1149
|
1375
|
"project": project,
|
|
1376
|
+ "advice": advice,
|
1150
|
1377
|
})
|
1151
|
1378
|
}
|
1152
|
1379
|
|