|
@@ -860,6 +860,7 @@ func (c *HisApiController) CreateHisPrescription() {
|
860
|
860
|
if stockConfig.IsOpen == 1 {
|
861
|
861
|
if dataBody["prescriptions"] != nil && reflect.TypeOf(dataBody["prescriptions"]).String() == "[]interface {}" {
|
862
|
862
|
prescriptions, _ := dataBody["prescriptions"].([]interface{})
|
|
863
|
+
|
863
|
864
|
if len(prescriptions) > 0 {
|
864
|
865
|
for _, item := range prescriptions {
|
865
|
866
|
|
|
@@ -867,12 +868,19 @@ func (c *HisApiController) CreateHisPrescription() {
|
867
|
868
|
if items["project"] != nil && reflect.TypeOf(items["project"]).String() == "[]interface {}" {
|
868
|
869
|
projects := items["project"].([]interface{})
|
869
|
870
|
if len(projects) > 0 {
|
|
871
|
+
|
870
|
872
|
for _, project := range projects {
|
|
873
|
+
|
871
|
874
|
var project_id int64
|
872
|
875
|
var project_type int64
|
873
|
876
|
var totals float64
|
874
|
877
|
var project_name string
|
875
|
878
|
var parsetotal int64
|
|
879
|
+ var id int64
|
|
880
|
+
|
|
881
|
+ if project.(map[string]interface{})["id"] != nil || reflect.TypeOf(project.(map[string]interface{})["id"]).String() == "float64" {
|
|
882
|
+ id = int64(project.(map[string]interface{})["id"].(float64))
|
|
883
|
+ }
|
876
|
884
|
if project.(map[string]interface{})["project_id"] != nil || reflect.TypeOf(project.(map[string]interface{})["project_id"]).String() == "float64" {
|
877
|
885
|
project_id = int64(project.(map[string]interface{})["project_id"].(float64))
|
878
|
886
|
}
|
|
@@ -884,17 +892,19 @@ func (c *HisApiController) CreateHisPrescription() {
|
884
|
892
|
totals, _ = strconv.ParseFloat(total, 64)
|
885
|
893
|
parsetotal, _ = strconv.ParseInt(total, 10, 64)
|
886
|
894
|
}
|
|
895
|
+
|
887
|
896
|
if project.(map[string]interface{})["project_name"] != nil || reflect.TypeOf(project.(map[string]interface{})["project_name"]).String() == "string" {
|
888
|
897
|
project_name = project.(map[string]interface{})["project_name"].(string)
|
889
|
898
|
|
890
|
899
|
}
|
891
|
900
|
if project_type == 3 {
|
|
901
|
+
|
892
|
902
|
//查找该耗材的出库记录
|
893
|
903
|
goodWarehouseInfo, _ := service.GetAutoRecordByGoodIdSevenEight(project_id, patient_id, recordDateTime)
|
894
|
|
- var total_count int64
|
895
|
|
- for _, it := range goodWarehouseInfo {
|
896
|
|
- total_count += it.Count
|
897
|
|
- }
|
|
904
|
+ //var total_count int64
|
|
905
|
+ //for _, it := range goodWarehouseInfo {
|
|
906
|
+ // total_count += it.Count
|
|
907
|
+ //}
|
898
|
908
|
if len(goodWarehouseInfo) == 0 {
|
899
|
909
|
//查询耗材库存
|
900
|
910
|
list, _ := service.GetGoodWarehouseInfoSeven(project_id)
|
|
@@ -911,21 +921,23 @@ func (c *HisApiController) CreateHisPrescription() {
|
911
|
921
|
}
|
912
|
922
|
if len(goodWarehouseInfo) > 0 {
|
913
|
923
|
//查询该患者耗材的历史数据
|
914
|
|
- ordProject, _ := service.GetHisProjectPrescriptionByPatientId(patient_id, recordDateTime)
|
915
|
|
- if total_count > 0 {
|
916
|
|
- //数量发生改变
|
917
|
|
- if parsetotal != total_count || len(ordProject) != len(projects) {
|
918
|
|
- //查找今日该患者已经出库的所有耗材
|
919
|
|
- goodList, _ := service.GetAllAutoRecordByPatient(patient_id, recordDateTime)
|
920
|
|
- fmt.Println("goodList3323223232323232323", goodList)
|
921
|
|
- for _, item := range goodList {
|
922
|
|
- //回退库存
|
923
|
|
- service.ModefyWarehouseInfo(item.Count, item.WarehouseInfotId)
|
924
|
|
- }
|
925
|
|
- //删除记录
|
926
|
|
- service.DeleteAutoWarehouse(patient_id, recordDateTime)
|
|
924
|
+ ordProject, _ := service.GetHisProjectPrescriptionByPatientIdOne(id)
|
|
925
|
+ count, _ := strconv.ParseInt(ordProject.Count, 10, 64)
|
|
926
|
+ fmt.Println("parsetotal33223232323232323", parsetotal)
|
|
927
|
+ fmt.Println("count2332322332232332", count)
|
|
928
|
+ //数量发生改变
|
|
929
|
+ if parsetotal != count {
|
|
930
|
+ //查找今日该患者已经出库的所有耗材
|
|
931
|
+ goodList, _ := service.GetAllAutoRecordByPatient(patient_id, recordDateTime)
|
|
932
|
+ fmt.Println("goodList3323223232323232323", goodList)
|
|
933
|
+ for _, item := range goodList {
|
|
934
|
+ //回退库存
|
|
935
|
+ service.ModefyWarehouseInfo(item.Count, item.WarehouseInfotId)
|
927
|
936
|
}
|
|
937
|
+ //删除记录
|
|
938
|
+ service.DeleteAutoWarehouse(patient_id, recordDateTime)
|
928
|
939
|
}
|
|
940
|
+
|
929
|
941
|
}
|
930
|
942
|
}
|
931
|
943
|
}
|